From 27a50d2349f8ec248d1d8ed134be1935ef3485a5 Mon Sep 17 00:00:00 2001 From: 1brucben <1benjbruce@gmail.com> Date: Thu, 24 Apr 2025 14:22:35 +0200 Subject: [PATCH] attack troops no longer show in pop display --- src/client/graphics/layers/WinModal.ts | 4 ++-- src/core/configuration/DefaultConfig.ts | 2 +- src/core/game/Game.ts | 1 + src/core/game/PlayerImpl.ts | 10 +++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/client/graphics/layers/WinModal.ts b/src/client/graphics/layers/WinModal.ts index 2892229f5..e983bca6c 100644 --- a/src/client/graphics/layers/WinModal.ts +++ b/src/client/graphics/layers/WinModal.ts @@ -218,10 +218,10 @@ export class WinModal extends LitElement implements Layer { new SendWinnerEvent(winner.clientID(), wu.allPlayersStats, "player"), ); if (winner == this.game.myPlayer()) { - this._title = "Chicken Jockey!"; + this._title = "You Won!"; this.won = true; } else { - this._title = `Chicken Jockey!`; + this._title = `${wu.winner} has won!`; this.won = false; } this.show(); diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index a5838a969..dc577d964 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -595,7 +595,7 @@ export class DefaultConfig implements Config { 10 + (800 / max + 1 / 160) * (0.7 * player.troops() + 1.3 * player.workers()); - const ratio = 1 - player.population() / max; + const ratio = 1 - player.adjustedPopulation() / max; toAdd *= ratio; if (player.type() == PlayerType.Bot) { diff --git a/src/core/game/Game.ts b/src/core/game/Game.ts index cde489f37..e7d4dd3b0 100644 --- a/src/core/game/Game.ts +++ b/src/core/game/Game.ts @@ -359,6 +359,7 @@ export interface Player { // Resources & Population gold(): Gold; population(): number; + adjustedPopulation(): number; workers(): number; troops(): number; targetTroopRatio(): number; diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index 8ba4609ca..42e8ce988 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -639,12 +639,12 @@ export class PlayerImpl implements Player { } population(): number { - return ( - Number(this._troops + this._workers) + - this.attackingTroops() + - this.boatTroops() - ); + return Number(this._troops + this._workers); } + adjustedPopulation(): number { + return this.population() + this.boatTroops() + this.attackingTroops(); + } + private attackingTroops(): number { return this._outgoingAttacks .filter((a) => a.isActive())