diff options
-rw-r--r-- | rules.js | 57 |
1 files changed, 56 insertions, 1 deletions
@@ -2174,6 +2174,12 @@ function goto_supply_hussars() { game.supply.pool = [] game.supply.used = [] game.count = 0 + save_checkpoint() +} + +function end_supply_hussars() { + clear_checkpoint() + resume_supply() } function goto_supply_restore() { @@ -2274,7 +2280,7 @@ states.supply_hussars = { delete game.supply.used game.count = 0 - resume_supply() + goto_validate_supply() }, } @@ -6998,6 +7004,55 @@ states.validate_hussars_fail = { }, } +/* VALIDATE: SUPPLY */ + +function goto_validate_supply() { + game.proposal = 0 + for (let other of all_powers) + if (should_validate_promise(game.power, other, V_SUPPLY)) + game.proposal |= (1 << other) + resume_validate_supply() +} + +function resume_validate_supply() { + resume_validate_promise("validate_supply", end_supply_hussars) +} + +states.validate_supply = { + dont_snap: true, + inactive: "confirm that promises were kept", + prompt() { + let other = current_sequence_of_play().power + prompt("Did " + power_name[other] + " keep their supply promise?") + view.actions.keep = 1 + view.actions.break = 1 + view.actions.undo = 0 + }, + keep() { + resume_validate_supply() + }, + break() { + let other = game.power + restore_checkpoint() + game.proposal = other + game.state = "validate_supply_fail" + }, +} + +states.validate_supply_fail = { + dont_snap: true, + inactive: "supply", + prompt() { + prompt("Promise to " + power_name[game.proposal] + " was not kept.") + view.actions.resume = 1 + view.actions.undo = 0 + }, + resume() { + game.state = "supply_hussars" + delete game.proposal + }, +} + /* VALIDATE: MOVEMENT */ function should_validate_movement(power) { |