mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 04:40:41 +00:00
39 lines
902 B
TypeScript
39 lines
902 B
TypeScript
import { AllPlayers, Cell, Execution, MutableGame, MutablePlayer, MutableUnit, PlayerID, UnitType } from "../game/Game";
|
|
|
|
export class DestroyerExecution implements Execution {
|
|
|
|
private _owner: MutablePlayer
|
|
private active = true
|
|
private destroyer: MutableUnit = null
|
|
private mg: MutableGame = null
|
|
|
|
constructor(
|
|
private playerID: PlayerID,
|
|
private cell: Cell,
|
|
) { }
|
|
|
|
|
|
init(mg: MutableGame, ticks: number): void {
|
|
this._owner = mg.player(this.playerID)
|
|
this.mg = mg
|
|
}
|
|
|
|
tick(ticks: number): void {
|
|
if (this.destroyer == null) {
|
|
this.destroyer = this._owner.addUnit(UnitType.Destroyer, 0, this.mg.tile(this.cell))
|
|
}
|
|
}
|
|
|
|
owner(): MutablePlayer {
|
|
return null
|
|
}
|
|
|
|
isActive(): boolean {
|
|
return this.active
|
|
}
|
|
|
|
activeDuringSpawnPhase(): boolean {
|
|
return false
|
|
}
|
|
|
|
} |