summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-07-14 00:12:40 +0200
committerTor Andersson <tor@ccxvii.net>2023-07-14 00:12:40 +0200
commitd2ca3789f0144f241d8db28768c43cbcb89c0722 (patch)
tree7f1596f8153236e997c41aa564c3b0db238bceca /play.js
parentd6b263f0401957f690994cd589801f39d9c27ed0 (diff)
downloadtime-of-crisis-d2ca3789f0144f241d8db28768c43cbcb89c0722.tar.gz
Show Barbarian Leader front side during battle.
Diffstat (limited to 'play.js')
-rw-r--r--play.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/play.js b/play.js
index 8248ede..25ca516 100644
--- a/play.js
+++ b/play.js
@@ -1209,10 +1209,6 @@ function on_update() {
hide(ui.barbarians[id])
else
show(ui.barbarians[id])
- if (is_barbarian_inactive(id))
- ui.barbarians[id].classList.toggle("inactive", true)
- else
- ui.barbarians[id].classList.toggle("inactive", false)
}
for (let id = BARBARIAN_COUNT[player_count-2]; id < 56; ++id)
hide(ui.barbarians[id])
@@ -1228,12 +1224,18 @@ function on_update() {
let loc = get_barbarian_location(id)
let inactive = is_barbarian_inactive(id)
if (loc === region) {
- if (is_battle_stack(region, "barbarians", tribe) && (region < 12 || !inactive))
+ let bb = is_battle_stack(region, "barbarians", tribe) && (region < 12 || !inactive)
+ if (bb)
battle.push(ui.barbarians[id])
else if (inactive)
inactive_barbarians.push(ui.barbarians[id])
else
active_barbarians.push(ui.barbarians[id])
+ // always show leaders as active during battle
+ if (!inactive || (bb && (id === CNIVA || id == ARDASHIR || id === SHAPUR)))
+ ui.barbarians[id].classList.toggle("inactive", false)
+ else
+ ui.barbarians[id].classList.toggle("inactive", true)
}
}
if (inactive_barbarians.length > 0)