From 64d13a46bdd096f02a8b350cc0870548ed27756f Mon Sep 17 00:00:00 2001 From: Evan Date: Thu, 13 Feb 2025 11:50:15 -0800 Subject: [PATCH] bugfix: bots were not losing troops in attack. rebalanced difficulties. --- src/core/configuration/DefaultConfig.ts | 6 +++--- src/core/execution/AttackExecution.ts | 2 +- src/core/execution/BotExecution.ts | 2 -- src/core/execution/FakeHumanExecution.ts | 6 ++++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 2c21ee40a..b97d1363d 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -387,11 +387,11 @@ export class DefaultConfig implements Config { case Difficulty.Easy: return maxPop * 0.5; case Difficulty.Medium: - return maxPop * 0.7; - case Difficulty.Hard: return maxPop * 1; - case Difficulty.Impossible: + case Difficulty.Hard: return maxPop * 1.5; + case Difficulty.Impossible: + return maxPop * 2; } } diff --git a/src/core/execution/AttackExecution.ts b/src/core/execution/AttackExecution.ts index b016539e6..d85434947 100644 --- a/src/core/execution/AttackExecution.ts +++ b/src/core/execution/AttackExecution.ts @@ -44,7 +44,7 @@ export class AttackExecution implements Execution { private startTroops: number | null = null, private _ownerID: PlayerID, private _targetID: PlayerID | null, - private sourceTile: TileRef | null, + private sourceTile: TileRef | null = null, private removeTroops: boolean = true, ) {} diff --git a/src/core/execution/BotExecution.ts b/src/core/execution/BotExecution.ts index 7fde24e19..956fb90a8 100644 --- a/src/core/execution/BotExecution.ts +++ b/src/core/execution/BotExecution.ts @@ -103,8 +103,6 @@ export class BotExecution implements Execution { this.bot.troops() / 20, this.bot.id(), toAttack.isPlayer() ? toAttack.id() : null, - null, - null, ), ); } diff --git a/src/core/execution/FakeHumanExecution.ts b/src/core/execution/FakeHumanExecution.ts index d3921adca..682c3e44f 100644 --- a/src/core/execution/FakeHumanExecution.ts +++ b/src/core/execution/FakeHumanExecution.ts @@ -26,6 +26,7 @@ import { closestTwoTiles } from "./Util"; import { calculateBoundingBox, simpleHash } from "../Util"; import { andFN, manhattanDistFN, TileRef } from "../game/GameMap"; import { ConstructionExecution } from "./ConstructionExecution"; +import { renderTroops } from "../../client/Utils"; export class FakeHumanExecution implements Execution { private firstMove = true; @@ -545,13 +546,14 @@ export class FakeHumanExecution implements Execution { } sendAttack(toAttack: Player | TerraNullius) { + console.log( + `${this.player.name()} sending troops ${renderTroops(this.player.troops() / 5)}`, + ); this.mg.addExecution( new AttackExecution( this.player.troops() / 5, this.player.id(), toAttack.isPlayer() ? toAttack.id() : null, - null, - null, ), ); }