diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-09-27 00:22:26 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-10-01 16:11:22 +0200 |
commit | d0048ced018cabeac2e0657abfb288a69e154ebd (patch) | |
tree | 10215a77215a953b4692beebf12e6610ce193b88 /rules.js | |
parent | 34c933a59144b7e21021fc78b96d86a5d7c91890 (diff) | |
download | waterloo-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.js | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -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) { |