diff options
-rw-r--r-- | data.js | 4 | ||||
-rw-r--r-- | play.css | 1 | ||||
-rw-r--r-- | play.js | 71 |
3 files changed, 45 insertions, 31 deletions
@@ -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}, }; @@ -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%); } @@ -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); |