can betray traitor without becoming traitor. allied bots less likely to attack traitor than non allied.

This commit is contained in:
evanpelle
2024-09-19 08:19:54 -07:00
parent 37e529ac84
commit 9e4b38c333
3 changed files with 8 additions and 3 deletions
+1
View File
@@ -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
+4 -2
View File
@@ -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
}
}
+3 -1
View File
@@ -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)
}