sam do not target twice same nuke (#270)

This commit is contained in:
Ilan Schemoul
2025-03-21 10:17:33 -07:00
committed by GitHub
parent d4ddffe1eb
commit 68621f326a
11 changed files with 200 additions and 33 deletions
+3
View File
@@ -244,6 +244,9 @@ export interface Unit {
setMoveTarget(cell: TileRef): void;
moveTarget(): TileRef | null;
setTargetedBySAM(targeted: boolean): void;
targetedBySAM(): boolean;
// Mutations
setTroops(troops: number): void;
delete(displayerMessage?: boolean): void;
+10 -1
View File
@@ -15,10 +15,11 @@ export class UnitImpl implements Unit {
// Currently only warship use it
private _target: Unit = null;
private _moveTarget: TileRef = null;
private _targetedBySAM = false;
private _constructionType: UnitType = undefined;
private _isSamCooldown: boolean;
private _isSamCooldown: boolean = false;
private _dstPort: Unit | null = null; // Only for trade ships
private _detonationDst: TileRef | null = null; // Only for nukes
private _warshipTarget: Unit | null = null;
@@ -204,4 +205,12 @@ export class UnitImpl implements Unit {
moveTarget(): TileRef | null {
return this._moveTarget;
}
setTargetedBySAM(targeted: boolean): void {
this._targetedBySAM = targeted;
}
targetedBySAM(): boolean {
return this._targetedBySAM;
}
}