diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-03-27 01:37:04 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 11:54:52 +0100 |
commit | a16c416c9f54293cf68921a73f68097e97586084 (patch) | |
tree | 64776353e731e1177f16f869c36a9aae3710c85a | |
parent | db5c24b3468e28faac6a78e98f629b597e178173 (diff) | |
download | wilderness-war-a16c416c9f54293cf68921a73f68097e97586084.tar.gz |
Fix retreat after sortie.
-rw-r--r-- | rules.js | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -961,6 +961,13 @@ function piece_node(p) { return abs(game.location[p]); } +function piece_space_and_inside(p) { + let where = abs(game.location[p]); + if (is_leader_box(where)) + return game.location[leader_from_box[where-first_leader_box]]; + return game.location[p]; +} + function piece_space(p) { let where = abs(game.location[p]); if (is_leader_box(where)) @@ -1686,7 +1693,7 @@ function unstack_force(p) { } function unstack_piece_from_force(p) { - move_piece_to(p, piece_space(p)); + game.location[p] = piece_space_and_inside(p); } function restore_unit(p) { @@ -5212,6 +5219,11 @@ states.retreat_attacker = { } else { eliminate_piece(p, false); } + } else { + if (is_fortress(to)) + push_retreat_summary(p, "into fortress"); + else + push_retreat_summary(p, "into fort"); } }); flush_retreat_summary(); |