From 48726dd19ad8dde11a6172f30b5071987b7d09b5 Mon Sep 17 00:00:00 2001 From: Frans Bongers Date: Mon, 2 Dec 2024 21:46:43 +0100 Subject: add tableaus and icon data --- play.js | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index c654730..7607bc4 100644 --- a/play.js +++ b/play.js @@ -1,14 +1,24 @@ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); const BONUSES_COUNT = 2; -const CARD_COUNT = 62; +const CARD_COUNT = 63; const MEDAILLONS_COUNT = 5; const STANDEES_COUNT = 5; +const TRACK_COUNT = 5; +const TRACK_LENGTH = 11; +const FACTIONS = ['a', 'c', 'm']; let ui = { map: document.getElementById('map'), + markers: document.getElementById('markers'), hand: document.getElementById('hand'), current_events: document.getElementById('current_events'), + tableaus: { + a: document.getElementById('tableau_a'), + c: document.getElementById('tableau_c'), + m: document.getElementById('tableau_m'), + }, tracks: document.getElementById('tracks'), + blank_markers: [[], [], [], [], []], bonuses: [], fronts: {}, frontValues: {}, @@ -147,6 +157,13 @@ function on_init() { on_init_once = true; console.log('ui', ui); console.log('document', document); + for (let t = 0; t < 5; ++t) { + for (let bm = 0; bm < TRACK_LENGTH; ++bm) { + let e = (ui.blank_markers[t][bm] = document.createElement('div')); + e.className = 'blank_marker'; + register_action(e, 'blank_marker', bm); + } + } for (let b = 0; b < BONUSES_COUNT; ++b) { let e = (ui.bonuses[b] = document.createElement('div')); e.className = 'bonus'; @@ -191,6 +208,14 @@ function on_update() { ui.cards[cardId].style.left = LAYOUT_CURRENT_EVENTS[i][0] + 'px'; ui.cards[cardId].style.top = LAYOUT_CURRENT_EVENTS[i][1] + 'px'; } + ui.markers.replaceChildren(); + for (let t = 0; t < TRACK_COUNT; ++t) { + for (let bm of view.triggered_track_effects[t]) { + ui.markers.appendChild(ui.blank_markers[t][bm]); + ui.blank_markers[t][bm].style.left = LAYOUT_TRACKS[t][bm][0] + 'px'; + ui.blank_markers[t][bm].style.top = LAYOUT_TRACKS[t][bm][1] + 'px'; + } + } for (let bonus_id of Object.keys(view.bonuses)) { ui.bonuses[bonus_id].setAttribute('data-bonus-on', view.bonuses[bonus_id] + 0); } @@ -202,7 +227,6 @@ function on_update() { ui.cards[c].classList.add('selected'); } } - ; for (let i = 0; i < view.tracks.length; ++i) { ui.standees[i].style.left = LAYOUT_TRACKS[i][view.tracks[i]][0] + 'px'; ui.standees[i].style.top = LAYOUT_TRACKS[i][view.tracks[i]][1] + 'px'; @@ -216,11 +240,19 @@ function on_update() { ui.medaillons[i].style.top = LAYOUT_MEDAILLONS[i][1] + 'px'; } } + for (let faction_id of FACTIONS) { + ui.tableaus[faction_id].replaceChildren(); + for (let c of view.tableaus[faction_id]) { + ui.cards[c].classList.remove('selected'); + ui.tableaus[faction_id].appendChild(ui.cards[c]); + } + } for (let e of action_register) e.classList.toggle('action', is_action(e.my_action, e.my_id)); action_button('Anarchist', 'Anarchist'); action_button('Communist', 'Communist'); action_button('Moderate', 'Moderate'); + action_button('gain_hp', 'Gain Hero Points'); action_button('draw_card', 'Draw card'); action_button('play_for_ap', 'Play card for Action Points'); action_button('play_for_event', 'Play card for Event'); @@ -229,6 +261,7 @@ function on_update() { action_button('up', 'Up'); action_button('down', 'Down'); action_button('next', 'Next'); + action_button('skip', 'Skip'); action_button('done', 'Done'); action_button('undo', 'Undo'); } -- cgit v1.2.3