mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-03 05:00:39 +00:00
bugfix: make sure not to add TerraNullius as enemy in BotBehavior as the causes a crash when checking isFriendly
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user