diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 71 |
1 files changed, 33 insertions, 38 deletions
@@ -2476,16 +2476,6 @@ function can_piece_move_anywhere(p) { return can_train_move_anywhere(p) } -function may_dispute_flanders_movement() { - if (game.flags & F_MOVE_DISPUTE) - return false - if (game.power === P_PRAGMATIC && has_moved_piece_on_flanders_map(P_AUSTRIA)) - return true - if (game.power === P_AUSTRIA) - return true - return false -} - states.movement_flanders_next = { inactive: "move", prompt() { @@ -2502,11 +2492,16 @@ states.movement_flanders_next = { }, } +function set_all_moved(pow) { + for (let p of all_power_pieces[pow]) + set_add(game.moved, p) +} + states.movement = { inactive: "move", dont_snap() { // don't snapshot during alternating move phase - if (!is_two_player() && !is_intro() && (game.power === P_PRAGMATIC || game.power === P_AUSTRIA)) + if (!is_two_player() && !is_intro() && (game.power === P_PRAGMATIC || game.power === P_AUSTRIA) && game.moved.length > 0) return true return false }, @@ -2538,9 +2533,7 @@ states.movement = { } } - if (game.power === P_AUSTRIA && has_unmoved_piece_on_flanders_map(game.power)) - prompt("Move your pieces on the Flanders map.") - else if (done_trains && done_generals) + if (done_trains && done_generals) prompt("Movement done.") else if (done_generals && !done_trains) prompt("Move your supply trains.") @@ -2551,37 +2544,27 @@ states.movement = { // austria/pragmatic shared movement phase if (!is_two_player() && !is_intro() && (game.power === P_PRAGMATIC || game.power === P_AUSTRIA)) { - if (has_unmoved_piece_on_flanders_map(P_AUSTRIA) || has_unmoved_piece_on_flanders_map(P_PRAGMATIC)) { - // pieces left to move on flanders + if (!(game.flags & F_MOVE_DISPUTE)) + view.actions.dispute = 1 + + if (has_moved_piece_on_flanders_map(P_PRAGMATIC) || has_moved_piece_on_flanders_map(P_AUSTRIA)) + view.actions.restart = 1 + else + view.actions.restart = 0 + + if (done_trains && done_generals) { + view.actions.end_movement = 1 + } else { if (!(game.flags & F_MOVE_DISPUTE)) { if (game.power === P_PRAGMATIC && has_unmoved_piece_on_flanders_map(P_AUSTRIA)) gen_action_power(P_AUSTRIA) if (game.power === P_AUSTRIA && has_unmoved_piece_on_flanders_map(P_PRAGMATIC)) gen_action_power(P_PRAGMATIC) - if (may_dispute_flanders_movement()) - view.actions.dispute = 1 - else - view.actions.dispute = 0 } - if (game.restart) { - if (has_moved_piece_on_flanders_map(P_PRAGMATIC) || has_moved_piece_on_flanders_map(P_AUSTRIA)) - view.actions.restart = 1 - else - view.actions.restart = 0 - } - } else { - // only bohemian pieces left - if (!has_unmoved_piece(P_PRAGMATIC) && !has_unmoved_piece(P_AUSTRIA)) - view.actions.end_movement = 1 - else if (game.power === P_PRAGMATIC && has_unmoved_piece(P_AUSTRIA)) - gen_action_power(P_AUSTRIA) - else if (game.power === P_AUSTRIA && has_unmoved_piece(P_PRAGMATIC)) - gen_action_power(P_PRAGMATIC) - else - view.actions.confirm_end_movement = DEBUG + view.actions.confirm_end_movement = DEBUG } } else { - if (!has_unmoved_piece(game.power)) + if (done_trains && done_generals) view.actions.end_movement = 1 else view.actions.confirm_end_movement = DEBUG @@ -2621,6 +2604,18 @@ states.movement = { this.end_movement() }, end_movement() { + if (!is_two_player() && !is_intro()) { + if (game.power === P_PRAGMATIC && has_unmoved_piece(P_AUSTRIA)) { + set_all_moved(P_PRAGMATIC) + this.power(P_AUSTRIA) + return + } + if (game.power === P_AUSTRIA && has_unmoved_piece(P_PRAGMATIC)) { + set_all_moved(P_AUSTRIA) + this.power(P_PRAGMATIC) + return + } + } push_undo() next_sequence_of_play() }, @@ -2645,7 +2640,7 @@ states.restart_flanders_movement = { dont_snap: true, inactive: "move", prompt() { - prompt("Reset moves on Flanders map due to request.") + prompt("Movement phase restarted.") view.actions.resume = 1 view.actions.undo = 0 }, |