From fc8f13bdda470ae3cb50bcd7a29f4584ececfc33 Mon Sep 17 00:00:00 2001 From: 1brucben <1benjbruce@gmail.com> Date: Tue, 6 May 2025 17:44:22 +0200 Subject: [PATCH] add attackingtroops and boattroops --- src/core/game/PlayerImpl.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index 3bffad0b9..d3fe768bd 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -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); }