From f788aea8c2a755eb68f2a6039964e839e117cc62 Mon Sep 17 00:00:00 2001 From: 1brucben <1benjbruce@gmail.com> Date: Thu, 24 Apr 2025 05:21:21 +0200 Subject: [PATCH] pop calc improvement --- src/core/game/PlayerImpl.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index de8c2bc96..8ba4609ca 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -639,7 +639,21 @@ export class PlayerImpl implements Player { } population(): number { - return Number(this._troops + this._workers); + return ( + Number(this._troops + this._workers) + + this.attackingTroops() + + this.boatTroops() + ); + } + 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); } workers(): number { return Math.max(1, Number(this._workers));