summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-03-27 01:37:04 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 11:54:52 +0100
commita16c416c9f54293cf68921a73f68097e97586084 (patch)
tree64776353e731e1177f16f869c36a9aae3710c85a /rules.js
parentdb5c24b3468e28faac6a78e98f629b597e178173 (diff)
downloadwilderness-war-a16c416c9f54293cf68921a73f68097e97586084.tar.gz
Fix retreat after sortie.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index 4eec12b..49e26d1 100644
--- a/rules.js
+++ b/rules.js
@@ -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();