From 9e4b38c33359be64c6de759efe973ee99b7067b8 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Thu, 19 Sep 2024 08:19:54 -0700 Subject: [PATCH] can betray traitor without becoming traitor. allied bots less likely to attack traitor than non allied. --- TODO.txt | 1 + src/core/execution/BotExecution.ts | 6 ++++-- src/core/game/PlayerImpl.ts | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) 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) }