diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 31 |
1 files changed, 19 insertions, 12 deletions
@@ -2922,6 +2922,25 @@ function max_movement_cost(type) { } function resume_move() { + let who = moving_piece() + let where = moving_piece_space() + + let enemy_units = has_unbesieged_enemy_units(where) + let enemy_leader = has_unbesieged_enemy_leader(where) + let friendly_units = has_unbesieged_friendly_units(where) + let friendly_leader = has_unbesieged_friendly_leader(where) + + if (enemy_leader && !enemy_units && friendly_units) { + return goto_retreat_lone_leader(where, 'move') + } + + // Can happen if enemy intercepted into moving piece and lone friendly leaders remain after battle. + if (friendly_leader && !friendly_units && enemy_units) { + game.state = 'retreat_lone_leader' + game.retreat = { from: where, reason: 'friendly_move' } + return + } + // Interrupt for Foul Weather response at first opportunity to move. if (game.move.used < 0) { if (is_enemy_card_available(FOUL_WEATHER) && !enemy_player.pass_fw) { @@ -3640,18 +3659,6 @@ function end_move_step(final=false, overrun=false) { logbr() } - if (!is_lone_leader(who) && is_piece_on_map(who) - && has_unbesieged_enemy_leader(where) - && !has_unbesieged_enemy_units(where)) - return goto_retreat_lone_leader(where, 'move') - - // If enemy intercepted into moving piece and lone friendly leaders remain after battle. - if (has_unbesieged_friendly_leader(where) && !has_unbesieged_friendly_units(where) && has_unbesieged_enemy_units(where)) { - game.state = 'retreat_lone_leader' - game.retreat = { from: where, reason: 'friendly_move' } - return - } - resume_move() } |