summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-07-05 15:13:50 +0200
committerTor Andersson <tor@ccxvii.net>2023-07-07 19:05:52 +0200
commit593a5fb24156af994ab0a37b5bd3dc13a99c8e78 (patch)
tree7f23572511ea2916dec2b98a50c98ee22fcb50b3 /play.js
parent01e1c6cea648be6807caf89f19ac56d8278b8d28 (diff)
downloadtime-of-crisis-593a5fb24156af994ab0a37b5bd3dc13a99c8e78.tar.gz
Don't battle twice with Militia.
Diffstat (limited to 'play.js')
-rw-r--r--play.js12
1 files changed, 10 insertions, 2 deletions
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)