mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 13:10:42 +00:00
25 lines
584 B
TypeScript
25 lines
584 B
TypeScript
import {Execution, MutableGame, MutablePlayer, PlayerID} from "../Game"
|
|
|
|
export class PlayerExecution implements Execution {
|
|
|
|
private player: MutablePlayer
|
|
|
|
constructor(private playerID: PlayerID) {
|
|
}
|
|
|
|
init(gs: MutableGame, ticks: number) {
|
|
this.player = gs.player(this.playerID)
|
|
}
|
|
|
|
tick(ticks: number) {
|
|
this.player.addTroops(Math.sqrt(this.player.numTilesOwned() * this.player.troops() + 1000) / 1000)
|
|
}
|
|
|
|
owner(): MutablePlayer {
|
|
return this.player
|
|
}
|
|
|
|
isActive(): boolean {
|
|
return this.player.isAlive()
|
|
}
|
|
} |