add attackingtroops and boattroops

This commit is contained in:
1brucben
2025-05-06 17:44:22 +02:00
parent 250e75eadd
commit fc8f13bdda
+10
View File
@@ -642,6 +642,16 @@ export class PlayerImpl implements Player {
adjustedPopulation(): number {
return this.population() + this.boatTroops() + this.attackingTroops();
}
private attackingTroops(): number {
return this._outgoingAttacks
.filter((a) => a.isActive())
.reduce((sum, a) => sum + a.troops(), 0);
}
private boatTroops(): number {
return this.units(UnitType.TransportShip)
.map((u) => u.troops())
.reduce((sum, n) => sum + n, 0);
}
addWorkers(toAdd: number): void {
this._workers += toInt(toAdd);
}