summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-09-27 00:22:26 +0200
committerTor Andersson <tor@ccxvii.net>2023-10-01 16:11:22 +0200
commitd0048ced018cabeac2e0657abfb288a69e154ebd (patch)
tree10215a77215a953b4692beebf12e6610ce193b88 /rules.js
parent34c933a59144b7e21021fc78b96d86a5d7c91890 (diff)
downloadwaterloo-campaign-1815-d0048ced018cabeac2e0657abfb288a69e154ebd.tar.gz
Don't eliminate eliminated units.
Fixes "double eliminated" detachments where they are both eliminated as part of the stack, and as the main unit.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/rules.js b/rules.js
index b43daef..204575c 100644
--- a/rules.js
+++ b/rules.js
@@ -344,19 +344,23 @@ function set_next_player() {
}
function blow_unit(p, n) {
- if (game.turn + n > 8) {
- log("P" + p + " eliminated.")
- set_piece_hex(p, ELIMINATED)
- } else {
- log("P" + p + " blown.")
- set_piece_hex(p, BLOWN + game.turn + n)
- set_piece_mode(p, 0)
+ if (piece_is_on_map(p)) {
+ if (game.turn + n > 8) {
+ log("P" + p + " eliminated.")
+ set_piece_hex(p, ELIMINATED)
+ } else {
+ log("P" + p + " blown.")
+ set_piece_hex(p, BLOWN + game.turn + n)
+ set_piece_mode(p, 0)
+ }
}
}
function eliminate_unit(p) {
- log("P" + p + " eliminated.")
- set_piece_hex(p, ELIMINATED)
+ if (piece_is_on_map(p)) {
+ log("P" + p + " eliminated.")
+ set_piece_hex(p, ELIMINATED)
+ }
}
function eliminate_detachments_stacked_with_corps(c) {