diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-08-05 01:25:18 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:19:39 +0100 |
commit | 8bdcee64dbbfc216a1f66f961a143d488f827f71 (patch) | |
tree | 4d99ceec3757ec32433b77acc5c4a66d70ebbff6 | |
parent | 775a825265f88cc549ea8ebe8cee888b8db56bbc (diff) | |
download | crusader-rex-8bdcee64dbbfc216a1f66f961a143d488f827f71.tar.gz |
crusader: Add confirmation step when ending move phase with moves left.
-rw-r--r-- | rules.js | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -1554,6 +1554,12 @@ function goto_move_phase(moves) { } function end_move_phase() { + if (game.moves > 0) { + push_undo(); + game.state = 'confirm_end_move_phase'; + return; + } + clear_undo(); game.who = null; game.where = null; @@ -1569,6 +1575,25 @@ function end_move_phase() { end_player_turn(); } +states.confirm_end_move_phase = { + prompt: function (view, current) { + if (is_inactive_player(current)) + return view.prompt = "Move Phase: Waiting for " + game.active + "."; + if (game.moves > 1) + view.prompt = "Move Phase: You have " + game.moves + " moves left"; + else + view.prompt = "Move Phase: You have 1 move left"; + view.prompt += " \u2014 are you sure you want to end the move phase?"; + gen_action_undo(view); + gen_action(view, 'end_move_phase'); + }, + end_move_phase: function () { + game.moves = 0; + end_move_phase(); + }, + undo: pop_undo +} + states.move_phase = { prompt: function (view, current) { if (is_inactive_player(current)) |