bugfix: make sure not to add TerraNullius as enemy in BotBehavior as the causes a crash when checking isFriendly

This commit is contained in:
evan
2025-04-28 09:53:07 -07:00
parent 96c8429a16
commit 8e8df5c308
+5 -6
View File
@@ -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;