From d2ca3789f0144f241d8db28768c43cbcb89c0722 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 14 Jul 2023 00:12:40 +0200 Subject: Show Barbarian Leader front side during battle. --- play.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'play.js') 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) -- cgit v1.2.3