From b5a56ff5ea536512ed9e34c3d9399327ad511698 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 29 Dec 2022 21:56:25 +0100 Subject: End taking hits when garrison routs and no lord remains. --- play.js | 2 +- rules.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/play.js b/play.js index 10185a2..6595975 100644 --- a/play.js +++ b/play.js @@ -1312,7 +1312,7 @@ function update_cards() { ui.events_panel.classList.add("hide") } - if (view.hand.length > 0) { + if (view.hand && view.hand.length > 0) { ui.hand_panel.classList.remove("hide") ui.hand.replaceChildren() if (view.hand) { diff --git a/rules.js b/rules.js index 1789811..8febf9f 100644 --- a/rules.js +++ b/rules.js @@ -6169,7 +6169,11 @@ function rout_lord(lord) { } function resume_hit_lord() { - if ((game.battle.h1 === 0 && game.battle.h2 === 0) || !has_unrouted_units(game.who)) + if ( + (game.battle.h1 === 0 && game.battle.h2 === 0) || + (game.who === -1 && game.battle.garrison.knights + game.battle.garrison.men_at_arms === 0) || + !has_unrouted_units(game.who) + ) end_hit_lord() } -- cgit v1.2.3