diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-01-15 21:41:09 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 11:54:52 +0100 |
commit | 518585adf1ad882df1f3c432311fd9999ac01602 (patch) | |
tree | 5da38c534f2e5b18c1c2a95703206cc3871a3039 | |
parent | fb61687c19e9eed7dd890caf67f9040bb93d78bc (diff) | |
download | wilderness-war-518585adf1ad882df1f3c432311fd9999ac01602.tar.gz |
British Ministerial Crisis.
-rw-r--r-- | rules.js | 52 |
1 files changed, 52 insertions, 0 deletions
@@ -3961,6 +3961,54 @@ events.françois_bigot = { }, } +const british_ministerial_crisis_cards = [ 47, 48, 54, 57, 58, 59, 60, 61, 63, 64 ]; + +events.british_ministerial_crisis = { + can_play() { + return enemy_player.hand.length > 0; + }, + play() { + let n = 0; + for (let i = 0; i < enemy_player.hand.length; ++i) { + let c = enemy_player.hand[i]; + if (british_ministerial_crisis_cards.includes(c)) + ++n; + } + if (n > 0) { + set_active(enemy()); + game.state = 'british_ministerial_crisis'; + game.count = 1; + } else { + log("British player has none of the listed cards in hand."); + end_action_phase(); + } + }, +} + +states.british_ministerial_crisis = { + prompt() { + view.prompt = "British Ministerial Crisis \u2014 discard one of the listed cards."; + if (game.count > 0) { + for (let i = 0; i < player.hand.length; ++i) { + let c = player.hand[i]; + if (british_ministerial_crisis_cards.includes(c)) + gen_action_discard(c); + } + } else { + gen_action_next(); + } + }, + discard(c) { + push_undo(); + game.count = 0; + discard_card(c, ""); + }, + next() { + set_active(enemy()); + end_action_phase(); + } +} + function is_card_removed(card) { return game.cards.removed.includes(card); } @@ -4687,6 +4735,10 @@ function gen_action_piece(piece) { gen_action('piece', piece); } +function gen_action_discard(card) { + gen_action('discard', card); +} + function load_game_state(state) { game = state; update_active_aliases(); |