From 32d609af973b45da8b20f9b10071a1115058a6e0 Mon Sep 17 00:00:00 2001 From: 1brucben <1benjbruce@gmail.com> Date: Tue, 6 May 2025 15:19:36 +0200 Subject: [PATCH] dogpile fix --- src/core/execution/FakeHumanExecution.ts | 25 +++++++++++------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/core/execution/FakeHumanExecution.ts b/src/core/execution/FakeHumanExecution.ts index bcf511423..ef6d9977a 100644 --- a/src/core/execution/FakeHumanExecution.ts +++ b/src/core/execution/FakeHumanExecution.ts @@ -918,28 +918,25 @@ export class FakeHumanExecution implements Execution { if (this.mg.ticks() - this.dogpileLastChecked < CHECK_INTERVAL) return; this.dogpileLastChecked = this.mg.ticks(); - const alivePlayers = this.mg + const competitors = this.mg .players() .filter( - (p) => - p.isAlive() && - p.isPlayer() && - p.id() !== this.player?.id() && - !this.player?.isOnSameTeam(p), + (p) => p.isAlive() && p.isPlayer() && !this.player?.isOnSameTeam(p), ); - if (alivePlayers.length < 2) { + const sorted = competitors.sort( + (a, b) => b.numTilesOwned() - a.numTilesOwned(), + ); + + const top = sorted[0]; + const second = sorted[1]; + + // ✅ Don't dogpile if we are the top player + if (top.id() === this.player.id()) { this.dogpileTarget = null; return; } - const sorted = alivePlayers.sort( - (a, b) => b.numTilesOwned() - a.numTilesOwned(), - ); - const top = sorted[0]; - const second = sorted[1]; - - // Dominant player condition if (top.numTilesOwned() > second.numTilesOwned() * 2) { if (this.dogpileTarget !== top) { if (this.random.chance(20)) {