diff --git a/src/core/GameRunner.ts b/src/core/GameRunner.ts index a78e39699..04a76c7cf 100644 --- a/src/core/GameRunner.ts +++ b/src/core/GameRunner.ts @@ -64,8 +64,13 @@ export async function createGameRunner( (n) => new Nation( new Cell(n.coordinates[0], n.coordinates[1]), - n.strength, - new PlayerInfo(n.name, PlayerType.FakeHuman, null, random.nextID()), + new PlayerInfo( + n.name, + PlayerType.FakeHuman, + null, + random.nextID(), + n.strength, + ), ), ); diff --git a/src/core/configuration/Config.ts b/src/core/configuration/Config.ts index f1f1b03c6..abe0f0018 100644 --- a/src/core/configuration/Config.ts +++ b/src/core/configuration/Config.ts @@ -93,6 +93,7 @@ export interface Config { userSettings(): UserSettings; playerTeams(): TeamCountConfig; + useNationStrengthForStartManpower(): boolean; startManpower(playerInfo: PlayerInfo): number; troopIncreaseRate(player: Player | PlayerView): number; goldAdditionRate(player: Player | PlayerView): Gold; diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 066a3e9ac..0dfc68e03 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -805,20 +805,31 @@ export class DefaultConfig implements Config { } } + useNationStrengthForStartManpower(): boolean { + // Currently disabled: FakeHumans became harder to play against due to AI improvements + // nation strength multiplier was unintentionally disabled during those AI improvements (playerInfo.nation was undefined), + // Re-enabling this without rebalancing FakeHuman difficulty elsewhere may make them overpowered + return false; + } + startManpower(playerInfo: PlayerInfo): number { if (playerInfo.playerType === PlayerType.Bot) { return 10_000; } if (playerInfo.playerType === PlayerType.FakeHuman) { + const strength = this.useNationStrengthForStartManpower() + ? (playerInfo.nationStrength ?? 1) + : 1; + switch (this._gameConfig.difficulty) { case Difficulty.Easy: - return 2_500 * (playerInfo?.nation?.strength ?? 1); + return 2_500 * strength; case Difficulty.Medium: - return 5_000 * (playerInfo?.nation?.strength ?? 1); + return 5_000 * strength; case Difficulty.Hard: - return 20_000 * (playerInfo?.nation?.strength ?? 1); + return 20_000 * strength; case Difficulty.Impossible: - return 50_000 * (playerInfo?.nation?.strength ?? 1); + return 50_000 * strength; } } return this.infiniteTroops() ? 1_000_000 : 25_000; diff --git a/src/core/game/Game.ts b/src/core/game/Game.ts index 1883063bb..2cf908b96 100644 --- a/src/core/game/Game.ts +++ b/src/core/game/Game.ts @@ -305,7 +305,6 @@ export enum Relation { export class Nation { constructor( public readonly spawnCell: Cell, - public readonly strength: number, public readonly playerInfo: PlayerInfo, ) {} } @@ -413,7 +412,7 @@ export class PlayerInfo { public readonly clientID: ClientID | null, // TODO: make player id the small id public readonly id: PlayerID, - public readonly nation?: Nation | null, + public readonly nationStrength?: number, ) { this.clan = getClanTag(name); } diff --git a/tests/FakeHumanMIRV.test.ts b/tests/FakeHumanMIRV.test.ts index 2d9c46cbb..11cad91fd 100644 --- a/tests/FakeHumanMIRV.test.ts +++ b/tests/FakeHumanMIRV.test.ts @@ -79,7 +79,7 @@ describe("FakeHuman MIRV Retaliation", () => { const mirvCountBefore = fakehuman.units(UnitType.MIRV).length; // Initialize fakehuman with FakeHumanExecution to enable retaliation logic - const fakehumanNation = new Nation(new Cell(50, 50), 1, fakehuman.info()); + const fakehumanNation = new Nation(new Cell(50, 50), fakehuman.info()); // Try different game IDs to account for hesitation odds const gameIds = Array.from({ length: 20 }, (_, i) => `game_${i}`); @@ -247,7 +247,7 @@ describe("FakeHuman MIRV Retaliation", () => { const mirvCountBefore = fakehuman.units(UnitType.MIRV).length; // Initialize fakehuman with FakeHumanExecution to enable victory denial logic - const fakehumanNation = new Nation(new Cell(50, 50), 1, fakehuman.info()); + const fakehumanNation = new Nation(new Cell(50, 50), fakehuman.info()); // Try different game IDs to account for hesitation odds const gameIds = Array.from({ length: 20 }, (_, i) => `game_${i}`); @@ -400,7 +400,7 @@ describe("FakeHuman MIRV Retaliation", () => { const mirvCountBefore = fakehuman.units(UnitType.MIRV).length; // Initialize fakehuman with FakeHumanExecution to enable steamroll stop logic - const fakehumanNation = new Nation(new Cell(50, 50), 1, fakehuman.info()); + const fakehumanNation = new Nation(new Cell(50, 50), fakehuman.info()); // Try different game IDs to account for hesitation odds const gameIds = Array.from({ length: 20 }, (_, i) => `game_${i}`); @@ -551,7 +551,7 @@ describe("FakeHuman MIRV Retaliation", () => { const mirvCountBefore = fakehuman.units(UnitType.MIRV).length; // Initialize fakehuman with FakeHumanExecution to enable steamroll stop logic - const fakehumanNation = new Nation(new Cell(50, 50), 1, fakehuman.info()); + const fakehumanNation = new Nation(new Cell(50, 50), fakehuman.info()); // Try different game IDs to account for hesitation odds const gameIds = Array.from({ length: 20 }, (_, i) => `game_${i}`); @@ -685,7 +685,7 @@ describe("FakeHuman MIRV Retaliation", () => { const mirvCountBefore = fakehuman.units(UnitType.MIRV).length; // Initialize fakehuman with FakeHumanExecution to enable team victory denial logic - const fakehumanNation = new Nation(new Cell(50, 50), 1, fakehuman.info()); + const fakehumanNation = new Nation(new Cell(50, 50), fakehuman.info()); // Try different game IDs to account for hesitation odds const gameIds = Array.from({ length: 20 }, (_, i) => `game_${i}`); diff --git a/tests/TeamAssignment.test.ts b/tests/TeamAssignment.test.ts index 5d9f5bcab..c3e11671b 100644 --- a/tests/TeamAssignment.test.ts +++ b/tests/TeamAssignment.test.ts @@ -11,7 +11,6 @@ describe("assignTeams", () => { PlayerType.Human, null, // clientID (null for testing) id, - null, // nation (null for testing) ); };