From 4861c41e8c8cfad2779f8773947856b58fe0c876 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 12 Jan 2022 15:43:07 +0100 Subject: Only reveal all blocks in replay. --- play.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/play.js b/play.js index 75f5554..35b015a 100644 --- a/play.js +++ b/play.js @@ -469,14 +469,15 @@ function hide_block(element) { ui.offmap_element.appendChild(element); } -function is_known_block(info, who) { - if (view.game_over) +function is_known_block(info, who, town) { + if (view.game_over && player === 'Observer') return true; - if (info.owner === player || info.owner === ASSASSINS || who === view.assassinate) - return true; - let town = view.location[who]; if (town === DEAD) return true; + if ((town === S_POOL || town === F_POOL) && who !== view.who) + return false; + if (info.owner === player || info.owner === ASSASSINS || who === view.assassinate) + return true; return false; } @@ -507,12 +508,10 @@ function update_map() { let moved = view.moved[b] ? " moved" : ""; if (town === DEAD) moved = " moved"; - if (is_known_block(info, b)) { + if (is_known_block(info, b, town)) { let image = " block_" + info.image; let steps = " r" + (info.steps - view.steps[b]); let known = " known"; - if ((town === S_POOL || town === F_POOL) && b !== view.who && !view.game_over) - known = ""; element.classList = info.owner + known + " block" + image + steps + moved; } else { let besieging = ""; -- cgit v1.2.3