summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-08-05 01:25:18 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:19:39 +0100
commit8bdcee64dbbfc216a1f66f961a143d488f827f71 (patch)
tree4d99ceec3757ec32433b77acc5c4a66d70ebbff6
parent775a825265f88cc549ea8ebe8cee888b8db56bbc (diff)
downloadcrusader-rex-8bdcee64dbbfc216a1f66f961a143d488f827f71.tar.gz
crusader: Add confirmation step when ending move phase with moves left.
-rw-r--r--rules.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/rules.js b/rules.js
index ae1f7fd..93d6d22 100644
--- a/rules.js
+++ b/rules.js
@@ -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))