From daeef6c6473cc6285f75f45f56e074c6acd0525e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 27 Jun 2021 18:55:06 +0200 Subject: crusader: Flash 'click next' when out of options in battles. --- rules.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 7c7bd54..12b1174 100644 --- a/rules.js +++ b/rules.js @@ -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'); }, -- cgit v1.2.3