summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js55
1 files changed, 54 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index cb77a13..5c4018a 100644
--- a/rules.js
+++ b/rules.js
@@ -6187,9 +6187,12 @@ function goto_imperial_election() {
game.stage = 0
set_active_to_power(P_AUSTRIA)
log(power_name[game.power])
+
+ save_checkpoint()
}
function next_imperial_election() {
+ clear_checkpoint()
if (game.power === P_FRANCE) {
set_active_to_power(P_BAVARIA)
} else if (coop_major_power(P_SAXONY) === game.power) {
@@ -6202,6 +6205,7 @@ function next_imperial_election() {
set_active_to_power(POWER_FROM_IMPERIAL_ELECTION_STAGE[game.stage])
}
log(power_name[game.power])
+ save_checkpoint()
}
states.imperial_election = {
@@ -6242,7 +6246,7 @@ states.imperial_election = {
}
}
- next_imperial_election()
+ goto_validate_election()
},
pass() {
log(">No votes")
@@ -7278,6 +7282,55 @@ states.validate_winter_fail = {
},
}
+/* VALIDATE: IMPERIAL ELECTION */
+
+function goto_validate_election() {
+ game.proposal = 0
+ for (let other of all_powers)
+ if (should_validate_promise(game.power, other, V_ELECTION))
+ game.proposal |= (1 << other)
+ resume_validate_election()
+}
+
+function resume_validate_election() {
+ resume_validate_promise("validate_election", next_imperial_election)
+}
+
+states.validate_election = {
+ dont_snap: true,
+ inactive: "confirm that promises were kept",
+ prompt() {
+ let other = current_sequence_of_play().power
+ prompt("Did " + power_name[other] + " keep their imperial election promise?")
+ view.actions.keep = 1
+ view.actions.break = 1
+ view.actions.undo = 0
+ },
+ keep() {
+ next_imperial_election()
+ },
+ break() {
+ let other = game.power
+ restore_checkpoint()
+ game.proposal = other
+ game.state = "validate_election_fail"
+ },
+}
+
+states.validate_election_fail = {
+ dont_snap: true,
+ inactive: "vote in the imperial election",
+ prompt() {
+ prompt("Promise to " + power_name[game.proposal] + " was not kept.")
+ view.actions.resume = 1
+ view.actions.undo = 0
+ },
+ resume() {
+ game.state = "imperial_election"
+ delete game.proposal
+ },
+}
+
/* SETUP */
const POWER_FROM_SETUP_STAGE = [