From d0048ced018cabeac2e0657abfb288a69e154ebd Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 27 Sep 2023 00:22:26 +0200 Subject: Don't eliminate eliminated units. Fixes "double eliminated" detachments where they are both eliminated as part of the stack, and as the main unit. --- rules.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'rules.js') 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) { -- cgit v1.2.3