AI nukes avoid SAM launchers (#1045)

## Description:

AI nukes avoid SAM launchers

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
Co-authored-by: evanpelle <evanpelle@gmail.com>
This commit is contained in:
Scott Anderson
2025-06-05 13:02:25 -04:00
committed by 1brucben
parent 165aec0bcf
commit 71010ab14e
+9 -2
View File
@@ -373,14 +373,21 @@ export class FakeHumanExecution implements Execution {
return 50_000;
case UnitType.Port:
return 10_000;
case UnitType.SAMLauncher:
return 5_000;
default:
return 0;
}
})
.reduce((prev, cur) => prev + cur, 0);
// Avoid areas defended by SAM launchers
const dist50 = euclDistFN(tile, 50, false);
tileValue -=
50_000 *
targets.filter(
(unit) =>
unit.type() === UnitType.SAMLauncher && dist50(this.mg, unit.tile()),
).length;
// Prefer tiles that are closer to a silo
const siloTiles = silos.map((u) => u.tile());
const result = closestTwoTiles(this.mg, siloTiles, [tile]);