diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-06-22 11:13:22 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-06-22 11:13:22 +0200 |
commit | f8e31faf61c91789a89c7b96e77b8311aa48f3b4 (patch) | |
tree | 3806ba872ca3eac66e8f1379666f9005e6e4344b | |
parent | 18c3d9b322512fe6e52f0062a5efcbbe0db98b08 (diff) | |
download | pax-pamir-f8e31faf61c91789a89c7b96e77b8311aa48f3b4.tar.gz |
Streamline Prince Akbar Khan.
1) Don't change player if there are two Afghan blocks available.
2) Pause before changing player to allow undo after Dominance Check.
-rw-r--r-- | rules.js | 27 |
1 files changed, 25 insertions, 2 deletions
@@ -2291,6 +2291,14 @@ states.safe_house = { // PASSIVE: INSURRECTION +function count_available_afghan_blocks() { + let n = 0 + for (let i = 0; i < 12; ++i) + if (game.pieces[i] === 0) + n ++ + return n +} + function check_insurrection() { let prince = which_player_has_insurrection() if (prince >= 0) { @@ -2298,13 +2306,28 @@ function check_insurrection() { log(`Prince Akbar Khan`) game.count = 2 game.selected = select_afghan_block() - set_active(prince) - game.state = 'insurrection' + if (prince === game.active || count_available_afghan_blocks() >= 2) + game.state = 'insurrection' + else + game.state = 'insurrection_pause' } else { end_dominance_check() } } +states.insurrection_pause = { + prompt() { + let prince = which_player_has_insurrection() + view.prompt = `Insurrection \u2014 pass control to ${player_names[prince]}.` + gen_action('player_' + prince) + }, + player_0() { set_active(0); game.state = "insurrection" }, + player_1() { set_active(1); game.state = "insurrection" }, + player_2() { set_active(2); game.state = "insurrection" }, + player_3() { set_active(3); game.state = "insurrection" }, + player_4() { set_active(4); game.state = "insurrection" }, +} + states.insurrection = { prompt() { if (game.count > 0) { |