From 8e8df5c3089b0821d4982cb3f1a5a4c9a239e967 Mon Sep 17 00:00:00 2001 From: evan Date: Mon, 28 Apr 2025 09:53:07 -0700 Subject: [PATCH] bugfix: make sure not to add TerraNullius as enemy in BotBehavior as the causes a crash when checking isFriendly --- src/core/execution/utils/BotBehavior.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core/execution/utils/BotBehavior.ts b/src/core/execution/utils/BotBehavior.ts index b84d84859..0851e78bb 100644 --- a/src/core/execution/utils/BotBehavior.ts +++ b/src/core/execution/utils/BotBehavior.ts @@ -130,12 +130,11 @@ export class BotBehavior { // Choose a new enemy randomly const neighbors = this.player.neighbors(); for (const neighbor of this.random.shuffleArray(neighbors)) { - if (neighbor.isPlayer()) { - if (this.player.isFriendly(neighbor)) continue; - if (neighbor.type() == PlayerType.FakeHuman) { - if (this.random.chance(2)) { - continue; - } + if (!neighbor.isPlayer()) continue; + if (this.player.isFriendly(neighbor)) continue; + if (neighbor.type() == PlayerType.FakeHuman) { + if (this.random.chance(2)) { + continue; } } this.enemy = neighbor;