diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -3,7 +3,7 @@ // TODO: battle dialog popup for rolling and assigning hits! // TODO: show killed leaders taken for bonus purchase -const DICE = { +const ICONS = { B0: '<span class="black d0"></span>', B1: '<span class="black d1"></span>', B2: '<span class="black d2"></span>', @@ -691,6 +691,7 @@ let ui = { amphitheater: [], basilica: [], limes: [], + crisis: document.getElementById("crisis_highlight"), dice: [ document.getElementById("crisis_die_1"), document.getElementById("crisis_die_2"), @@ -734,10 +735,6 @@ function hide(elt) { elt.classList.add("hide") } -function toggle_pieces() { - ui.pieces.classList.toggle("hide") -} - function create(t, p, ...c) { let e = document.createElement(t) Object.assign(e, p) @@ -1377,6 +1374,7 @@ function on_update() { ui.body.classList.toggle("populace", view.color === 2) layout_barbarian_dice(ui.dice[2], ui.dice[3], view.crisis[0]) + ui.crisis.className = "p_" + PLAYER_CLASS[view.current] + " c" + (view.crisis[1] + view.crisis[2]) ui.dice[0].className = "dice black d" + view.crisis[1] ui.dice[1].className = "dice white d" + view.crisis[2] ui.dice[2].className = "dice black d" + view.crisis[3] @@ -1477,8 +1475,16 @@ function sub_event_name(match, p1) { return EVENT_NAME[x] } -function sub_dice_image(match) { - return DICE[match] +function sub_icon(match) { + return ICONS[match] +} + +function sub_card_1(match) { + return match +} + +function sub_card_x(match, p1, p2) { + return p1 + "\xa0" + p2 } function on_log(text) { @@ -1495,7 +1501,9 @@ function on_log(text) { text = text.replace(/%(\d+)/g, sub_region_name) text = text.replace(/\bE(\d+)/g, sub_event_name) - text = text.replace(/\b[BW]\d\b/g, sub_dice_image) + text = text.replace(/\b[BW]\d\b/g, sub_icon) + text = text.replace(/\b[MSP][1]\b/g, sub_card_1) + text = text.replace(/\b([MSP][234])\(([^)]*)\)/g, sub_card_x) if (text.match(/^.turn/)) { text = text.substring(6) |