summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-16 22:36:56 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-16 22:38:19 +0200
commit0c8cc28fc48a192d476c5b394256468735861289 (patch)
tree62771581997e46c03d5482d988e04adfff8bd1c0 /rules.js
parenta64246a8df40773167afd6820a3c7ae54acf1a68 (diff)
downloadmaria-0c8cc28fc48a192d476c5b394256468735861289.tar.gz
Log losses from mixed stacks.
Diffstat (limited to 'rules.js')
-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()
}