summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-05-07 11:36:47 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:31:29 +0100
commitf0f23bd0b25d7f7c1576e73f8300d595e20948bf (patch)
treeda2d0b5a63538e9acbd8df3c5f03f5e6e4c52328
parent00063afb60ab92d0216cfa1a4f811a4ddfc195fd (diff)
downloadpax-pamir-f0f23bd0b25d7f7c1576e73f8300d595e20948bf.tar.gz
Don't allow betray action if only spies are on bodyguards.
-rw-r--r--rules.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/rules.js b/rules.js
index 8ad6713..6e30820 100644
--- a/rules.js
+++ b/rules.js
@@ -408,11 +408,16 @@ function active_rules_any_region() {
return player_rules_any_region(game.active);
}
-function active_has_spy() {
+function active_can_betray() {
let x = active_cylinders();
- for (let i = x; i < x + 10; ++i)
- if (game.pieces[i] >= 1 && game.pieces[i] <= 100)
- return true;
+ for (let i = x; i < x + 10; ++i) {
+ if (game.pieces[i] >= 1 && game.pieces[i] <= 100) {
+ let c = game.pieces[i];
+ let p = find_card_in_court(c);
+ if (!player_has_bodyguards(p))
+ return true;
+ }
+ }
return false;
}
@@ -922,7 +927,7 @@ states.actions = {
usable = true;
}
- if (card.betray && player.coins >= 2 && active_has_spy()) {
+ if (card.betray && player.coins >= 2 && active_can_betray()) {
gen_action('betray', c);
usable = true;
}