From 7a5406a1910d54bc68688f54d7a4dcd48d9765c9 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 15 Sep 2023 12:10:06 +0200 Subject: No treachery attempts when you must retreat. --- rules.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/rules.js b/rules.js index 38ade69..5efce8c 100644 --- a/rules.js +++ b/rules.js @@ -2431,6 +2431,7 @@ states.battle_round = { if (game.battle_round > 1) can_retreat = true can_pass = true } + for (let b of game.battle_list) { if (can_fire) gen_action(view, 'battle_fire', b) if (must_retreat || (can_retreat && can_retreat_with_block(b))) @@ -2439,17 +2440,19 @@ states.battle_round = { gen_action(view, 'block', b) } - let heir = can_heir_charge() - if (heir !== NOBODY && set_has(game.battle_list, heir)) - gen_action(view, 'battle_charge', heir) - if (can_attempt_treachery(game.king)) - gen_action(view, 'battle_treachery', game.king) - if (can_attempt_treachery(game.pretender)) - gen_action(view, 'battle_treachery', game.pretender) - if (can_attempt_treachery(B_WARWICK_L)) - gen_action(view, 'battle_treachery', B_WARWICK_L) - if (can_attempt_treachery(B_WARWICK_Y)) - gen_action(view, 'battle_treachery', B_WARWICK_Y) + if (!must_retreat) { + let heir = can_heir_charge() + if (heir !== NOBODY && set_has(game.battle_list, heir)) + gen_action(view, 'battle_charge', heir) + if (can_attempt_treachery(game.king)) + gen_action(view, 'battle_treachery', game.king) + if (can_attempt_treachery(game.pretender)) + gen_action(view, 'battle_treachery', game.pretender) + if (can_attempt_treachery(B_WARWICK_L)) + gen_action(view, 'battle_treachery', B_WARWICK_L) + if (can_attempt_treachery(B_WARWICK_Y)) + gen_action(view, 'battle_treachery', B_WARWICK_Y) + } }, battle_fire: function (who) { fire_with_block(who) -- cgit v1.2.3