diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-09-07 23:56:11 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-17 13:11:27 +0100 |
commit | 6c9834e241b38fb9780510039eb87a11054a53ed (patch) | |
tree | 432ff13a4af662049cfccb04781dd67ed42efc0f | |
parent | d085d2deddc30593bc7e9972d38b0215a1914f71 (diff) | |
download | rommel-in-the-desert-6c9834e241b38fb9780510039eb87a11054a53ed.tar.gz |
Summarize withdrawal destinations.
-rw-r--r-- | rules.js | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -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() } } |