summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/rules.js b/rules.js
index 28415a6..718f593 100644
--- a/rules.js
+++ b/rules.js
@@ -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()
}