Skip to content

Commit 8837634

Browse files
committed
Fix bots
1 parent a6d3fb1 commit 8837634

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/core/execution/utils/BotBehavior.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ export class BotBehavior {
4444
this.game.addExecution(new EmojiExecution(this.player, player.id(), emoji));
4545
}
4646

47-
// Prevent attacking of humans on lower difficulties
47+
// Prevent attacking of humans on lower difficulties (or if we are a bot)
4848
private shouldAttack(other: Player | TerraNullius): boolean {
4949
// Always attack Terra Nullius, non-humans and traitors
5050
if (
5151
other.isPlayer() === false ||
5252
other.type() !== PlayerType.Human ||
53-
other.isTraitor()
53+
other.isTraitor() ||
54+
this.player.type() === PlayerType.Bot
5455
) {
5556
return true;
5657
}
@@ -374,7 +375,6 @@ export class BotBehavior {
374375
}
375376

376377
// Choose a new enemy randomly
377-
const { difficulty } = this.game.config().gameConfig();
378378
const neighbors = this.player.neighbors();
379379
for (const neighbor of this.random.shuffleArray(neighbors)) {
380380
if (!neighbor.isPlayer()) continue;
@@ -383,7 +383,7 @@ export class BotBehavior {
383383
neighbor.type() === PlayerType.FakeHuman ||
384384
neighbor.type() === PlayerType.Human
385385
) {
386-
if (this.random.chance(2) || difficulty === Difficulty.Easy) {
386+
if (this.random.chance(2)) {
387387
continue;
388388
}
389389
}

0 commit comments

Comments
 (0)