summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-06-22 11:13:22 +0200
committerTor Andersson <tor@ccxvii.net>2023-06-22 11:13:22 +0200
commitf8e31faf61c91789a89c7b96e77b8311aa48f3b4 (patch)
tree3806ba872ca3eac66e8f1379666f9005e6e4344b
parent18c3d9b322512fe6e52f0062a5efcbbe0db98b08 (diff)
downloadpax-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.js27
1 files changed, 25 insertions, 2 deletions
diff --git a/rules.js b/rules.js
index 9e9087d..93c6637 100644
--- a/rules.js
+++ b/rules.js
@@ -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) {