diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-10-16 22:36:56 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-10-16 22:38:19 +0200 |
commit | 0c8cc28fc48a192d476c5b394256468735861289 (patch) | |
tree | 62771581997e46c03d5482d988e04adfff8bd1c0 | |
parent | a64246a8df40773167afd6820a3c7ae54acf1a68 (diff) | |
download | maria-0c8cc28fc48a192d476c5b394256468735861289.tar.gz |
Log losses from mixed stacks.
-rw-r--r-- | rules.js | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -2085,8 +2085,8 @@ function remove_stack_from_combat(s) { } function goto_retreat() { - let lost = Math.abs(game.count) - let hits = lost + let hits = Math.abs(game.count) + let lost = [ 0, 0, 0, 0, 0, 0 ] // per power! let loser = get_loser() let loser_power = get_stack_power(loser) @@ -2099,6 +2099,7 @@ function goto_retreat() { for (let i = game.selected.length - 1; i >= 0 && hits > 0; --i) { let p = game.selected[i] while (game.troops[p] > 1 && hits > 0) { + lost[piece_power[p]]++ --game.troops[p] --hits } @@ -2107,12 +2108,15 @@ function goto_retreat() { for (let i = game.selected.length - 1; i >= 0 && hits > 0; --i) { let p = game.selected[i] while (game.troops[p] > 0 && hits > 0) { + lost[piece_power[p]]++ --game.troops[p] --hits } } - log(POWER_NAME[loser_power] + " lost " + (lost-hits) + " troops.") + for (let pow of all_powers) + if (lost[pow] > 0) + log(POWER_NAME[pow] + " lost " + (lost[pow]) + " troops.") resume_retreat() } |