From 7d85527f1c0d8f786463708ee5474d208e8a8004 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 21 Jan 2025 01:06:11 +0100 Subject: validate reduced military objectives --- rules.js | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/rules.js b/rules.js index 5c4018a..6de4394 100644 --- a/rules.js +++ b/rules.js @@ -6103,10 +6103,12 @@ function goto_france_reduces_military_objectives() { !(game.flags & F_FRANCE_REDUCED) && count_french_victory_markers_in_core_austria() > 0 && france_has_no_generals_in_core_austria() - ) + ) { game.state = "france_reduces_military_objectives" - else + save_checkpoint() + } else { next_sequence_of_play() + } } function count_french_victory_markers_in_core_austria() { @@ -6155,7 +6157,7 @@ states.france_reduces_military_objectives = { game.state = "france_reduces_military_objectives_done" }, pass() { - next_sequence_of_play() + goto_validate_military() }, } @@ -6166,7 +6168,7 @@ states.france_reduces_military_objectives_done = { view.actions.next = 1 }, next() { - next_sequence_of_play() + goto_validate_military() }, } @@ -7282,6 +7284,55 @@ states.validate_winter_fail = { }, } +/* VALIDATE: REDUCE MILITARY OBJECTIVES */ + +function goto_validate_military() { + game.proposal = 0 + for (let other of all_powers) + if (should_validate_promise(game.power, other, V_MILITARY)) + game.proposal |= (1 << other) + resume_validate_military() +} + +function resume_validate_military() { + resume_validate_promise("validate_military", next_sequence_of_play) +} + +states.validate_military = { + dont_snap: true, + inactive: "confirm that promises were kept", + prompt() { + let other = current_sequence_of_play().power + prompt("Did " + power_name[other] + " keep their military objective promise?") + view.actions.keep = 1 + view.actions.break = 1 + view.actions.undo = 0 + }, + keep() { + next_sequence_of_play() + }, + break() { + let other = game.power + restore_checkpoint() + game.proposal = other + game.state = "validate_military_fail" + }, +} + +states.validate_military_fail = { + dont_snap: true, + inactive: "reduce military objectives", + prompt() { + prompt("Promise to " + power_name[game.proposal] + " was not kept.") + view.actions.resume = 1 + view.actions.undo = 0 + }, + resume() { + game.state = "france_reduces_military_objectives" + delete game.proposal + }, +} + /* VALIDATE: IMPERIAL ELECTION */ function goto_validate_election() { -- cgit v1.2.3