Skip to content

Commit f48c813

Browse files
committed
optimize hasTooManyAlliances
1 parent 1a0ced6 commit f48c813

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/core/execution/nation/NationAllianceBehavior.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,16 @@ export class NationAllianceBehavior {
143143
return false;
144144
}
145145

146-
const totalPlayers = this.game.players().length;
146+
const totalPlayers = this.game
147+
.players()
148+
.filter((p) => p.type() !== PlayerType.Bot).length;
147149
const otherPlayerAlliances = otherPlayer.alliances().length;
148150

149-
return otherPlayerAlliances >= totalPlayers * 0.5;
151+
if (difficulty !== Difficulty.Hard) {
152+
return otherPlayerAlliances >= totalPlayers * 0.5;
153+
} else {
154+
return otherPlayerAlliances >= totalPlayers * 0.25;
155+
}
150156
}
151157

152158
private isConfused(): boolean {

0 commit comments

Comments
 (0)