From a0ee653860e471bba2fb1cd8d7611fd633af9878 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 16 Sep 2022 00:00:25 +0200 Subject: Show perma-dead blocks in pools as well. Adjust pool positions to allow for more blocks. --- data.js | 4 ++-- play.css | 1 + play.js | 71 ++++++++++++++++++++++++++++++++++++++-------------------------- 3 files changed, 45 insertions(+), 31 deletions(-) diff --git a/data.js b/data.js index ad35be3..1c6ffe3 100644 --- a/data.js +++ b/data.js @@ -128,8 +128,8 @@ const TOWNS = { "France":{"x":140,"y":573}, "England":{"x":140,"y":873}, "Sea":{"x":320,"y":900}, - "FP":{"x":15,"y":573+21+66}, - "SP":{"x":1275-15,"y":573+21+66}, + "FP":{"x":15,"y":946}, + "SP":{"x":1275-15,"y":946}, "Dead":{"x":50,"y":80}, }; diff --git a/play.css b/play.css index a552eea..3cdf72a 100644 --- a/play.css +++ b/play.css @@ -173,6 +173,7 @@ body.shift .block.known:hover { .block.highlight { cursor: pointer; } .block.moved { filter: brightness(80%) grayscale(40%); } +.block.removed { filter: brightness(60%) grayscale(40%); } .block.highlight.moved { filter: brightness(95%) grayscale(40%); } #map .block.castle.known { filter: grayscale(50%); } diff --git a/play.js b/play.js index 216bbb3..a6b18f6 100644 --- a/play.js +++ b/play.js @@ -504,38 +504,39 @@ function update_map() { let info = BLOCKS[b]; let element = ui.blocks[b]; let town = view.location[b]; - if (town in TOWNS) { - let moved = view.moved[b] ? " moved" : ""; - if (town === DEAD) - moved = " moved"; - if (is_known_block(info, b, town)) { - let image = " block_" + info.image; - let steps = " r" + (info.steps - view.steps[b]); - let known = " known"; - element.classList = info.owner + known + " block" + image + steps + moved; - } else { - let besieging = ""; - if (view.sieges[town] === info.owner) { - if (view.winter_campaign === town) - besieging = " winter_campaign"; - else - besieging = " besieging"; - } - let jihad = ""; - if (view.jihad === town && info.owner === view.p1) - jihad = " jihad"; - element.classList = info.owner + " block" + moved + besieging + jihad; - } - if (town !== DEAD) { - if (info.owner === FRANKS) - layout[town].north.push(element); + let moved = view.moved[b] ? " moved" : ""; + if (town === DEAD) { + moved = " moved"; + } + if (town === null) { + town = DEAD; + moved = " removed"; + } + if (is_known_block(info, b, town)) { + let image = " block_" + info.image; + let steps = " r" + (info.steps - view.steps[b]); + let known = " known"; + element.classList = info.owner + known + " block" + image + steps + moved; + } else { + let besieging = ""; + if (view.sieges[town] === info.owner) { + if (view.winter_campaign === town) + besieging = " winter_campaign"; else - layout[town].south.push(element); + besieging = " besieging"; } - show_block(element); - } else { - hide_block(element); + let jihad = ""; + if (view.jihad === town && info.owner === view.p1) + jihad = " jihad"; + element.classList = info.owner + " block" + moved + besieging + jihad; + } + if (town !== DEAD) { + if (info.owner === FRANKS) + layout[town].north.push(element); + else + layout[town].south.push(element); } + show_block(element); } for (let b in view.location) { @@ -550,6 +551,18 @@ function update_map() { } } + for (let b in view.location) { + let info = BLOCKS[b]; + let element = ui.blocks[b]; + let town = view.location[b]; + if (town === null) { + if (info.owner === FRANKS) + layout[F_POOL].north.unshift(element); + else + layout[S_POOL].south.unshift(element); + } + } + for (let town in TOWNS) layout_blocks(town, layout[town].north, layout[town].south); -- cgit v1.2.3