summaryrefslogtreecommitdiff
path: root/ui.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-07-20 20:38:47 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:19:39 +0100
commit783823b98b2df65a1ce55ef43f0fd5dbebdcb8a5 (patch)
tree12644735cbeecc8f87cbe7b80e46886a5e2feeeb /ui.js
parent022e525c09f2d724a55d2a4400d682c61aed1ade (diff)
downloadcrusader-rex-783823b98b2df65a1ce55ef43f0fd5dbebdcb8a5.tar.gz
crusader: Rewrite logic of revealing and hiding blocks in battle.
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/ui.js b/ui.js
index ce316f6..22cbf08 100644
--- a/ui.js
+++ b/ui.js
@@ -671,6 +671,10 @@ function update_battle() {
if (game.battle.jihad === block_owner(block))
class_name += " jihad";
+ if (game.battle.sallying.includes(block))
+ show = true;
+ if (game.battle.storming.includes(block))
+ show = true;
if (show || block_owner(block) === player) {
class_name += " known";
ui.battle_block[block].className = class_name;
@@ -690,21 +694,21 @@ function update_battle() {
}
if (player === FRANKS) {
- fill_cell("FR", game.battle.FR, true);
- fill_cell("FC", game.battle.FC, true);
- fill_cell("FF", game.battle.FF, game.battle.show_castle); // saracens in frank castle
- fill_cell("EF", game.battle.SF, game.battle.show_field); // saracens in field battle
- fill_cell("EC", game.battle.SC, game.battle.show_castle); // saracens in saracen castle
fill_cell("ER", game.battle.SR, false);
+ fill_cell("EC", game.battle.SC, game.battle.show_castle);
+ fill_cell("EF", game.battle.SF, game.battle.show_field);
+ fill_cell("FF", game.battle.FF, game.battle.show_field);
+ fill_cell("FC", game.battle.FC, game.battle.show_castle);
+ fill_cell("FR", game.battle.FR, false);
document.getElementById("FC").className = "c" + game.battle.FCS;
document.getElementById("EC").className = "c" + game.battle.SCS;
} else {
fill_cell("ER", game.battle.FR, false);
fill_cell("EC", game.battle.FC, game.battle.show_castle);
fill_cell("EF", game.battle.FF, game.battle.show_field);
- fill_cell("FF", game.battle.SF, game.battle.show_castle);
- fill_cell("FC", game.battle.SC, true);
- fill_cell("FR", game.battle.SR, true);
+ fill_cell("FF", game.battle.SF, game.battle.show_field);
+ fill_cell("FC", game.battle.SC, game.battle.show_castle);
+ fill_cell("FR", game.battle.SR, false);
document.getElementById("EC").className = "c" + game.battle.FCS;
document.getElementById("FC").className = "c" + game.battle.SCS;
}