From 82a5f1795c0f54f8853f065acb98e8336ae96a88 Mon Sep 17 00:00:00 2001 From: 1brucben <1benjbruce@gmail.com> Date: Mon, 5 May 2025 21:27:05 +0200 Subject: [PATCH] dogpile fix --- src/core/configuration/DefaultConfig.ts | 2 +- src/core/execution/FakeHumanExecution.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 5c0d170c6..a6fc3d849 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -200,7 +200,7 @@ export class DefaultConfig implements Config { return 40; } defensePostDefenseBonus(): number { - return 4; + return 5; } spawnNPCs(): boolean { return !this._gameConfig.disableNPCs; diff --git a/src/core/execution/FakeHumanExecution.ts b/src/core/execution/FakeHumanExecution.ts index afdedf490..171646cb4 100644 --- a/src/core/execution/FakeHumanExecution.ts +++ b/src/core/execution/FakeHumanExecution.ts @@ -260,14 +260,15 @@ export class FakeHumanExecution implements Execution { handleEnemies() { this.behavior.forgetOldEnemies(); - this.behavior.checkIncomingAttacks(); - this.behavior.assistAllies(); const sharesBorderWithTN = Array.from(this.player.borderTiles()) .flatMap((t) => this.mg.neighbors(t)) .some((t) => this.mg.isLand(t) && !this.mg.hasOwner(t)); if (sharesBorderWithTN) return; + this.behavior.checkIncomingAttacks(); + this.behavior.assistAllies(); + let enemy: Player | null = null; if ( @@ -881,6 +882,8 @@ export class FakeHumanExecution implements Execution { } private updateDogpile() { + if (!this.player) return; + if (this.mg.ticks() < 3000) { this.dogpileTarget = null; return; @@ -921,7 +924,7 @@ export class FakeHumanExecution implements Execution { // Dominant player condition if (top.numTilesOwned() > second.numTilesOwned() * 2) { // Enter dogpile with probability (e.g. 30%) - if (this.dogpileTarget !== top && this.random.chance(5)) { + if (this.dogpileTarget !== top && this.random.chance(30)) { this.dogpileTarget = top; } } else {