From a6776816e5493055ecf16d5ff9c81c4ebe131f0b Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 27 Oct 2024 19:33:59 +0100 Subject: ui tweaks and undo steps --- rules.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 57f0da4..c47801f 100644 --- a/rules.js +++ b/rules.js @@ -1244,7 +1244,7 @@ states.place_hussars = { if (!set_has(game.moved, p)) gen_action_piece(p) if (!has_any_hussar(ELIMINATED)) - view.actions.next = 1 + view.actions.end_place_hussars = 1 }, piece(p) { push_undo() @@ -1252,7 +1252,7 @@ states.place_hussars = { game.selected = p game.state = "place_hussars_where" }, - next() { + end_place_hussars() { end_place_hussars() }, } @@ -2111,6 +2111,7 @@ states.movement = { this.end_movement() }, end_movement() { + push_undo() if (game.flags & F_MOVE_FLANDERS) { for (let p of all_power_pieces[game.power]) if (is_flanders_space(game.pos[p])) @@ -4645,10 +4646,10 @@ states.offer_peace = { inactive: "offer peace", prompt() { prompt("Annex Silesia and offer temporary peace with Austria?") - view.actions.offer = 1 + view.actions.peace = 1 view.actions.pass = 1 }, - offer() { + peace() { set_active_to_power(P_AUSTRIA) game.state = "accept_peace" }, @@ -4894,6 +4895,7 @@ states.france_reduces_military_objectives = { view.actions.pass = 1 }, reduce() { + push_undo() game.flags |= F_FRANCE_REDUCED let n = 0 for (let s of all_core_austria_fortresses) { @@ -4906,13 +4908,24 @@ states.france_reduces_military_objectives = { n = (n + 1) >> 1 log("France set aside " + n + " victory markers.") game.vp[SET_ASIDE_FRANCE] = n - next_sequence_of_play() + game.state = "france_reduces_military_objectives_done" }, pass() { next_sequence_of_play() }, } +states.france_reduces_military_objectives_done = { + inactive: "supply", + prompt() { + prompt("Set aside " + game.vp[SET_ASIDE_FRANCE] + " victory markers.") + view.actions.next = 1 + }, + next() { + next_sequence_of_play() + }, +} + /* IMPERIAL ELECTION */ const POWER_FROM_IMPERIAL_ELECTION_STAGE = [ -- cgit v1.2.3