summaryrefslogtreecommitdiff
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
parentd6b263f0401957f690994cd589801f39d9c27ed0 (diff)
downloadtime-of-crisis-d2ca3789f0144f241d8db28768c43cbcb89c0722.tar.gz
Show Barbarian Leader front side during battle.
-rw-r--r--play.css4
-rw-r--r--play.js12
2 files changed, 11 insertions, 5 deletions
diff --git a/play.css b/play.css
index 939711f..8f7c592 100644
--- a/play.css
+++ b/play.css
@@ -452,6 +452,10 @@ body.shift .postumus { background-image: url(images/rival_back.png) }
body.shift .priest_king { background-image: url(images/rival_back.png) }
body.shift .zenobia { background-image: url(images/rival_back.png) }
+body.shift .ardashir.inactive { background-image: url(images/ardashir.png) }
+body.shift .cniva.inactive { background-image: url(images/cniva.png) }
+body.shift .shapur.inactive { background-image: url(images/shapur.png) }
+
.blue.governor { background-image: url(images/blue_governor.png) }
.green.governor { background-image: url(images/green_governor.png) }
.red.governor { background-image: url(images/red_governor.png) }
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)