From a1fbe6661a86a81adfcb8a0fb531f03ae3218d3e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 13 Nov 2024 18:23:26 +0100 Subject: don't bother tracking forbidden mixed stack attempts --- rules.js | 44 +++++++++++--------------------------------- 1 file changed, 11 insertions(+), 33 deletions(-) diff --git a/rules.js b/rules.js index 6a877e2..f72fec2 100644 --- a/rules.js +++ b/rules.js @@ -2677,8 +2677,6 @@ function is_illegal_cross_map_move(from, to) { } function can_move_general_to(p, from, to) { - if (to === game.forbidden) - return false if (is_forbidden_neutral_space(piece_power[p], to)) return false if (is_illegal_cross_map_move(from, to)) @@ -2838,10 +2836,7 @@ states.move_general = { if (s_give > 0 && u_take > 0) view.actions.give = 1 - if (here === game.forbidden) - view.actions.stop = 0 - else - view.actions.stop = 1 + view.actions.stop = 1 } else { gen_action_piece(who) view.actions.stop = 1 @@ -3064,7 +3059,6 @@ function end_move_piece() { } delete game.move_path - delete game.forbidden // uniting stacks: flag all as moved let supreme = false @@ -3167,15 +3161,7 @@ states.confirm_flanders_stack_2 = { resume_movement_after_flanders_stacking() }, refuse() { - // remember who moved, then restore back to saved undo point - // select general to move to another city - let p = game.selected - let s = game.pos[game.selected] - game.undo = [ game.proposal ] - delete game.proposal - pop_undo() - game.selected = p - game.forbidden = s + set_active_to_power(piece_power[game.selected]) game.state = "confirm_flanders_stack_3" }, } @@ -3183,25 +3169,17 @@ states.confirm_flanders_stack_2 = { states.confirm_flanders_stack_3 = { inactive: "move", prompt() { - prompt(`${piece_name[game.selected]} is not allowed to stack at ${data.cities.name[game.forbidden]}.`) - gen_action_piece(game.selected) - //view.selected = game.selected - //view.actions.next = 1 - }, - piece(_) { - this.next() + let p = game.selected + let s = game.pos[p] + prompt(`${piece_name[p]} was not allowed to stack at ${data.cities.name[s]}.`) + view.selected = game.selected + view.actions.next = 1 }, next() { - push_undo() - /* - let s = game.forbidden - if (game.power === P_AUSTRIA) - log("Pragmatic Army refused to stack at S" + s + ".") - else - log("Austria refused to stack at S" + s + ".") - */ - states.movement.piece(game.selected) - game.undo.pop() + // restore back to saved undo point + game.undo = [ game.proposal ] + delete game.proposal + pop_undo() }, } -- cgit v1.2.3