diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-06-27 18:55:06 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:19:38 +0100 |
commit | daeef6c6473cc6285f75f45f56e074c6acd0525e (patch) | |
tree | 3d0a98bbfd465d3886f74818792f770baa9068e9 /rules.js | |
parent | abffcc1c2282123265784c899ce5c569b34da8e3 (diff) | |
download | crusader-rex-daeef6c6473cc6285f75f45f56e074c6acd0525e.tar.gz |
crusader: Flash 'click next' when out of options in battles.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -2085,16 +2085,20 @@ states.combat_deployment = { view.prompt = "Deploy blocks on the field and in the castle."; let max = castle_limit(game.where); let n = count_blocks_in_castle(game.where); + let have_options = false; if (n < max) { for (let b in BLOCKS) { if (block_owner(b) == game.active && !is_reserve(b)) { if (game.location[b] == game.where && !game.castle.includes(b)) { gen_action(view, 'withdraw', b); gen_action(view, 'block', b); + have_options = true; } } } } + if (!have_options) + view.flash_next = "Click Next when you're done."; gen_action_undo(view); gen_action(view, 'next'); }, @@ -2281,16 +2285,20 @@ states.declare_storm = { if (is_inactive_player(current)) return view.prompt = "Siege Declaration: Waiting for " + game.active + " to declare storm."; view.prompt = "Siege Declaration: Declare which blocks should storm the castle."; + let have_options = false; if (game.storming.length < castle_limit(game.where)) { for (let b in BLOCKS) { if (block_owner(b) == game.active && !is_reserve(b)) { if (game.location[b] == game.where && !game.storming.includes(b)) { gen_action(view, 'storm', b); gen_action(view, 'block', b); + have_options = true; } } } } + if (!have_options) + view.flash_next = "Click Next when you're done."; gen_action_undo(view); gen_action(view, 'next'); }, @@ -2337,14 +2345,18 @@ states.declare_sally = { if (is_inactive_player(current)) return view.prompt = "Siege Declaration: Waiting for " + game.active + " to declare sally."; view.prompt = "Siege Declaration: Declare which blocks should sally onto the field."; + let have_options = false; for (let b in BLOCKS) { if (block_owner(b) == game.active && !is_reserve(b) && is_block_in_castle(b)) { if (game.location[b] == game.where && !game.sallying.includes(b)) { gen_action(view, 'sally', b); gen_action(view, 'block', b); + have_options = true; } } } + if (!have_options) + view.flash_next = "Click Next when you're done."; gen_action_undo(view); gen_action(view, 'next'); }, |