diff --git a/TODO.txt b/TODO.txt index f40262e71..2597b9a69 100644 --- a/TODO.txt +++ b/TODO.txt @@ -121,6 +121,7 @@ * add traitor icon DONE 9/18/2024 * make alliance icon DONE 9/19/2024 * bots attack traitors +* BUG: alliance should stop attack * create event box * make fake humans easier * click alliance sends alliance request diff --git a/src/core/execution/BotExecution.ts b/src/core/execution/BotExecution.ts index f9e2f7182..c7f6d31c3 100644 --- a/src/core/execution/BotExecution.ts +++ b/src/core/execution/BotExecution.ts @@ -50,8 +50,10 @@ export class BotExecution implements Execution { const traitors = this.bot.neighbors().filter(n => n.isPlayer() && n.isTraitor()) as Player[] if (traitors.length > 0) { - if (this.random.chance(2)) { - this.sendAttack(this.random.randElement(traitors)) + const toAttack = this.random.randElement(traitors) + const odds = this.bot.alliedWith(toAttack) ? 6 : 3 + if (this.random.chance(odds)) { + this.sendAttack(toAttack) return } } diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index 9cd61a472..bac5a240f 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -144,7 +144,9 @@ export class PlayerImpl implements MutablePlayer { if (!this.alliedWith(other)) { throw new Error('cannot break alliance, already allied') } - this.isTraitor_ = true + if (!other.isTraitor()) { + this.isTraitor_ = true + } this.gs.breakAlliance(this, other) }