diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 97ece14b0..d35d50dba 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -616,10 +616,7 @@ export class DefaultConfig implements Config { let toAdd = 10 + (1400 / max + 1 / 125) * (0.8 * player.troops() + 1.2 * player.workers()); - const adjustedPop = - typeof player.adjustedPopulation === "function" - ? player.adjustedPopulation() - : player.population(); + const adjustedPop = player.adjustedPopulation(); const ratio = 1 - adjustedPop / max; toAdd *= ratio; @@ -645,7 +642,10 @@ export class DefaultConfig implements Config { } } - return Math.min(player.population() + toAdd, max) - player.population(); + return ( + Math.min(player.adjustedPopulation() + toAdd, max) - + player.adjustedPopulation() + ); } goldAdditionRate(player: Player): number { diff --git a/src/core/game/GameUpdates.ts b/src/core/game/GameUpdates.ts index 5f78111f9..4507ca8b2 100644 --- a/src/core/game/GameUpdates.ts +++ b/src/core/game/GameUpdates.ts @@ -99,6 +99,7 @@ export interface PlayerUpdate { tilesOwned: number; gold: number; population: number; + adjustedPopulation: number; workers: number; troops: number; targetTroopRatio: number; diff --git a/src/core/game/GameView.ts b/src/core/game/GameView.ts index 877ec19cf..27eebfc0a 100644 --- a/src/core/game/GameView.ts +++ b/src/core/game/GameView.ts @@ -225,6 +225,9 @@ export class PlayerView { population(): number { return this.data.population; } + adjustedPopulation(): number { + return this.data.adjustedPopulation; + } workers(): number { return this.data.workers; } diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index 52cbb6545..ebd6c63d9 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -137,6 +137,7 @@ export class PlayerImpl implements Player { tilesOwned: this.numTilesOwned(), gold: Number(this._gold), population: this.population(), + adjustedPopulation: this.adjustedPopulation(), workers: this.workers(), troops: this.troops(), targetTroopRatio: this.targetTroopRatio(),