mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 07:50:45 +00:00
adding destroyer
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user