feat: move warship (#196)

This commit is contained in:
Ilan Schemoul
2025-03-14 16:30:30 -07:00
committed by GitHub
parent baf91db288
commit 275de50fcd
8 changed files with 182 additions and 52 deletions
+3
View File
@@ -238,6 +238,9 @@ export interface Unit {
dstPort(): Unit; // Only for trade ships
detonationDst(): TileRef; // Only for nukes
setMoveTarget(cell: TileRef): void;
moveTarget(): TileRef | null;
// Mutations
setTroops(troops: number): void;
delete(displayerMessage?: boolean): void;
+10 -1
View File
@@ -1,4 +1,4 @@
import { MessageType, nukeTypes, UnitSpecificInfos } from "./Game";
import { MessageType, UnitSpecificInfos } from "./Game";
import { UnitUpdate } from "./GameUpdates";
import { GameUpdateType } from "./GameUpdates";
import { simpleHash, toInt, within, withinInt } from "../Util";
@@ -14,6 +14,7 @@ export class UnitImpl implements Unit {
private _lastTile: TileRef = null;
// Currently only warship use it
private _target: Unit = null;
private _moveTarget: TileRef = null;
private _constructionType: UnitType = undefined;
@@ -184,4 +185,12 @@ export class UnitImpl implements Unit {
setDstPort(dstPort: Unit): void {
this._dstPort = dstPort;
}
setMoveTarget(moveTarget: TileRef) {
this._moveTarget = moveTarget;
}
moveTarget(): TileRef | null {
return this._moveTarget;
}
}