summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js25
1 files changed, 20 insertions, 5 deletions
diff --git a/rules.js b/rules.js
index d476ba6..9c07479 100644
--- a/rules.js
+++ b/rules.js
@@ -2953,6 +2953,19 @@ function flush_move_summary() {
game.summary = null
}
+function flush_withdraw_summary() {
+ log("Withdrew\n")
+ for (let to in game.summary) {
+ let n = game.summary[to]
+ to = to | 0
+ if (to === 0)
+ log(`>${n} eliminated`)
+ else
+ log(`>${n} to #${to}`)
+ }
+ game.summary = null
+}
+
function goto_move_phase() {
set_clear(game.fired)
game.forced = []
@@ -4271,7 +4284,7 @@ function goto_refuse_battle_move() {
set_passive_player()
if (has_undisrupted_friendly_unit(game.refuse)) {
game.state = 'refuse_battle_move'
- log(`Withdrew`)
+ game.summary = {}
} else {
end_refuse_battle_move()
}
@@ -4304,11 +4317,12 @@ states.refuse_battle_move = {
hex(to) {
let who = pop_selected()
push_undo()
- log(`>to #${to}`)
+ game.summary[to] = (game.summary[to]|0) + 1
set_unit_hex(who, to)
set_unit_disrupted(who)
},
end_retreat() {
+ flush_withdraw_summary()
end_refuse_battle_move()
}
}
@@ -4409,7 +4423,7 @@ function goto_rout_move() {
hide_friendly_units_in_hex(game.rout.from)
// TODO: auto-eliminate if no withdraw path available
game.state = 'rout_move'
- log(`Withdrew`)
+ game.summary = {}
} else {
end_rout()
}
@@ -4448,17 +4462,18 @@ states.rout_move = {
eliminate() {
let who = pop_selected()
push_undo()
- log(`>eliminated`)
+ game.summary[0] = (game.summary[0]|0) + 1
eliminate_unit(who)
},
hex(to) {
let who = pop_selected()
push_undo()
- log(`>to #${to}`)
+ game.summary[to] = (game.summary[to]|0) + 1
set_unit_hex(who, to)
set_unit_disrupted(who)
},
end_rout() {
+ flush_withdraw_summary()
end_rout()
}
}