mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-11 09:28:26 +00:00
First Commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user