diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 82 |
1 files changed, 49 insertions, 33 deletions
@@ -77,7 +77,7 @@ const CARD_S3X = [ 122, 129 ] const CARD_P3X = [ 130, 137 ] const CARD_M4 = [ 138, 143 ] const CARD_S4 = [ 144, 149 ] -const CARD_S4B = [ 150, 155 ] +const CARD_S4_V2 = [ 150, 155 ] // updated damnatio const CARD_P4 = [ 156, 161 ] const CARD_M4X = [ 162, 167 ] const CARD_S4X = [ 168, 173 ] @@ -110,7 +110,7 @@ const CARD_CLASS = [ "influence_p3x", "influence_m4", "influence_s4", - "influence_s4b", + "influence_s4_v2", "influence_p4", "influence_m4x", "influence_s4x", @@ -760,9 +760,9 @@ let ui = { document.getElementById("capital_hispania"), ], quaestor: [], - amphitheater: [], - basilica: [], - limes: [], + imp_amphitheater: [], + imp_basilica: [], + imp_limes: [], crisis: document.getElementById("crisis_highlight"), dice: [ document.getElementById("crisis_die_1"), @@ -799,6 +799,27 @@ function is_neutral_province(where) { return get_province_governor_player(where) < 0 } +function show_improvement(elt, off) { + let x = 0, y = 0 + switch (off) { + case 1: + x = -48 - 3 + y = 6 + break + case 2: + x = 48 + 3 + y = 6 + break + case 3: + x = 0 + y = 6 + 25 + break + } + elt.style.left = elt.my_x + x + "px" + elt.style.top = elt.my_y + y + "px" + elt.classList.remove("hide") +} + function show(elt) { elt.classList.remove("hide") } @@ -848,8 +869,8 @@ function create_building(region, className, xoff, yoff) { if (region === ITALIA) y += 52 let e = create_thing({ className }) - e.style.left = x + (w >> 1) + xoff - 46 + "px" - e.style.top = y + h + yoff + "px" + e.my_x = x + (w >> 1) - 46 + e.my_y = y + h return e } @@ -925,15 +946,9 @@ function on_init() { ui.mobs[region * 3 + 1] = create_piece(region, "mob", "mob") ui.mobs[region * 3 + 2] = create_piece(region, "mob", "mob") - if (true) { - ui.amphitheater[region] = create_building(region, "amphitheater hide", -48 - 3, 6) - ui.basilica[region] = create_building(region, "basilica hide", 48 + 3, 6) - ui.limes[region] = create_building(region, "limes hide", 0, 6 + 25) - } else { - ui.amphitheater[region] = create_building(region, "amphitheater hide", -96 - 5, 6) - ui.basilica[region] = create_building(region, "basilica hide", 0, 6) - ui.limes[region] = create_building(region, "limes hide", 96 + 5, 6) - } + ui.imp_amphitheater[region] = create_building(region, "improvement amphitheater hide") + ui.imp_basilica[region] = create_building(region, "improvement basilica hide") + ui.imp_limes[region] = create_building(region, "improvement limes hide") register_action(ui.capital[region], "capital", region) register_action(ui.regions[region], "region", region) @@ -1203,27 +1218,30 @@ function on_update() { ui.quaestor[region].classList.remove("pretender") } + if (has_militia(region)) + show(ui.militia[region]) + else + hide(ui.militia[region]) + + ui.militia[region].classList.toggle("selected", view.selected_militia === region) + + let imp_off = 0 + if (has_amphitheater(region)) - show(ui.amphitheater[region]) + show_improvement(ui.imp_amphitheater[region], ++imp_off) else - hide(ui.amphitheater[region]) + hide(ui.imp_amphitheater[region]) if (has_basilica(region)) - show(ui.basilica[region]) + show_improvement(ui.imp_basilica[region], ++imp_off) else - hide(ui.basilica[region]) + hide(ui.imp_basilica[region]) if (has_limes(region)) - show(ui.limes[region]) + show_improvement(ui.imp_limes[region], ++imp_off) else - hide(ui.limes[region]) + hide(ui.imp_limes[region]) - if (has_militia(region)) - show(ui.militia[region]) - else - hide(ui.militia[region]) - - ui.militia[region].classList.toggle("selected", view.selected_militia === region) } for (let i = 0; i < LEGION_COUNT; ++i) { @@ -1556,6 +1574,9 @@ function on_update() { action_button("reroll", "Re-roll") action_button("roll", "Roll") + action_button("amphitheater", "Amphitheater") + action_button("basilica", "Basilica") + action_button("limes", "Limes") action_button("disperse_mob", "Disperse Mob") action_button("train_legions", "Train Legions") action_button("add_legion_to_army", "Add Legion to Army") @@ -1565,14 +1586,9 @@ function on_update() { action_button("place_militia", "Place Militia") action_button("build_improvement", "Build Improvement") - action_button("amphitheater", "Amphitheater") - action_button("basilica", "Basilica") - action_button("limes", "Limes") - action_button("end_actions", "End Actions") action_button("end_turn", "End Turn") - action_button("pass", "Pass") action_button("done", "Done") action_button("undo", "Undo") |