From 593a5fb24156af994ab0a37b5bd3dc13a99c8e78 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 5 Jul 2023 15:13:50 +0200 Subject: Don't battle twice with Militia. --- play.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index 3862f75..f240f08 100644 --- a/play.js +++ b/play.js @@ -1273,6 +1273,9 @@ function on_update() { lone_militia = false } } + // militia that already battled is not part of attacker stack + if (view.combat_region === region && view.combat.attacker >= 0 && !view.combat.militia) + lone_militia = true if (lone_militia) { if (is_battle_stack(region, "militia", region)) { if (has_militia_castra(region)) @@ -1343,8 +1346,13 @@ function on_update() { } } - if (has_militia(region) && inside) - stack.push(ui.militia[region]) + if (has_militia(region) && inside) { + // militia that already battled is not part of attacker stack + if (view.combat_region === region && view.combat.attacker >= 0 && !view.combat.militia) + ; + else + stack.push(ui.militia[region]) + } if (is_battle_stack(region, "general", pi * 6 + ai)) layout_battle_stack(pi * 6 + ai === view.combat.attacker, stack, region) -- cgit v1.2.3