summaryrefslogtreecommitdiff
path: root/ui.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-06-27 17:53:24 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:19:38 +0100
commit1a893cd45c1816a090c497b222f868c2d12a7cdb (patch)
treeb02493088f7bfe438aed5384b1e008dfac82eb36 /ui.js
parent963df1c404871f765a75e09e03e7274c03a4d556 (diff)
downloadcrusader-rex-1a893cd45c1816a090c497b222f868c2d12a7cdb.tar.gz
crusader: First playtest bug fixes.
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js25
1 files changed, 20 insertions, 5 deletions
diff --git a/ui.js b/ui.js
index 4930ce7..3ced0b1 100644
--- a/ui.js
+++ b/ui.js
@@ -553,14 +553,27 @@ function hide_block(element) {
ui.offmap_element.appendChild(element);
}
+function is_known_block(info, who) {
+ if (info.owner == player || info.owner == ASSASSINS || who == game.assassinate)
+ return true;
+ let town = game.location[who];
+ if (town == ENGLAND || town == FRANCE || town == GERMANIA)
+ return true;
+ return false;
+}
+
function update_map() {
let layout = {};
document.getElementById("frank_vp").textContent = game.f_vp + " VP";
document.getElementById("saracen_vp").textContent = game.s_vp + " VP";
document.getElementById("timeline").className = "year_" + game.year;
- document.getElementById("turn").textContent =
- "Turn " + game.turn + " of Year " + game.year;
+ if (game.turn < 6)
+ document.getElementById("turn").textContent =
+ "Turn " + game.turn + " of Year " + game.year;
+ else
+ document.getElementById("turn").textContent =
+ "Winter Turn of Year " + game.year;
for (let town in TOWNS)
layout[town] = { north: [], south: [] };
@@ -583,7 +596,7 @@ function update_map() {
let moved = game.moved[b] ? " moved" : "";
if (town == DEAD)
moved = " moved";
- if (info.owner == player || info.owner == ASSASSINS || b == game.assassinate) {
+ if (is_known_block(info, b)) {
let image = " block_" + info.image;
let steps = " r" + (info.steps - game.steps[b]);
let known = " known"
@@ -632,9 +645,11 @@ function update_map() {
if (game.actions && game.actions.block)
for (let b of game.actions.block)
ui.blocks[b].classList.add('highlight');
- if (game.who)
- ui.blocks[game.who].classList.add('selected');
}
+ if (game.who && !game.battle)
+ ui.blocks[game.who].classList.add('selected');
+ if (game.assassinate)
+ ui.blocks[game.assassinate].classList.add('selected');
for (let b of game.castle)
ui.blocks[b].classList.add('castle');
}