diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-05-01 21:43:56 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-17 12:53:17 +0100 |
commit | dfaac7643a383491006c2c72a054336e967f8cd3 (patch) | |
tree | 2c02d3e436f975476236a926b444bf5938c9c007 /rules.js | |
parent | ce31007441aaf7d1bd561d15a0762b60b79b4ffb (diff) | |
download | hammer-of-the-scots-dfaac7643a383491006c2c72a054336e967f8cd3.tar.gz |
hammer: Show 'end retreat' button if no possible retreat paths.
This will automatically eliminate all remaining blocks.
Fixes issue #1.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1780,11 +1780,15 @@ states.retreat = { return view.prompt = "Waiting for " + game.active + " to retreat."; view.prompt = "Retreat: Choose an army to move."; gen_action_undo(view); - if (!is_contested_area(game.where)) - gen_action(view, 'end_retreat'); - for (let b in BLOCKS) - if (game.location[b] == game.where && can_block_retreat(b)) + let can_retreat = false; + for (let b in BLOCKS) { + if (game.location[b] == game.where && can_block_retreat(b)) { gen_action(view, 'block', b); + can_retreat = true; + } + } + if (!is_contested_area(game.where) || !can_retreat) + gen_action(view, 'end_retreat'); }, end_retreat: function () { for (let b in BLOCKS) |