diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-07-13 13:14:42 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 11:54:52 +0100 |
commit | 6a29729abc39ba5e2c9e333d3fcfe7ed0c9bc833 (patch) | |
tree | a1de9810af10136b54208338d110a6d0e67b21a8 | |
parent | 1885656ef66700c4ad50cc71450ddf41fcde0b5d (diff) | |
download | wilderness-war-6a29729abc39ba5e2c9e333d3fcfe7ed0c9bc833.tar.gz |
Retreat lone leaders who are left behind at a siege when moving out.
-rw-r--r-- | rules.js | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -3691,6 +3691,16 @@ function gen_intercept() { } function goto_intercept() { + // Abandoned lone leader at formerly besieged fortification with enemy units... + let from = moving_piece_came_from() + if (has_unbesieged_friendly_leader(from) && !has_unbesieged_friendly_units(from)) { + if (has_unbesieged_enemy_units(from)) { + game.state = 'retreat_lone_leader' + game.retreat = { from: from, reason: 'abandon' } + return + } + } + if (can_be_intercepted()) { game.move.intercepting = 0 set_active_enemy() @@ -5343,7 +5353,7 @@ function can_defender_retreat_from_to(p, from, to) { if (has_unbesieged_enemy_fortifications(to)) return false if (game.move && moving_piece_came_from() === to) - if (!game.retreat || game.retreat.reason !== 'friendly_move') + if (!game.retreat || game.retreat.reason !== 'friendly_move' || game.retreat.reason !== 'abandon') return false if (force_has_drilled_troops(p)) { if (is_cultivated(to) || has_friendly_fortifications(to)) @@ -5637,6 +5647,10 @@ function resume_retreat_lone_leader(from) { delete game.retreat resume_move() break + case 'abandon': + delete game.retreat + goto_intercept() + break } } } |