diff options
author | Frans Bongers <fransbongers@franss-mbp.home> | 2024-12-02 21:46:43 +0100 |
---|---|---|
committer | Frans Bongers <fransbongers@franss-mbp.home> | 2024-12-02 21:46:43 +0100 |
commit | 48726dd19ad8dde11a6172f30b5071987b7d09b5 (patch) | |
tree | 8b36ebc15d609d1a316ef6f98870d232ab09db6e /play.ts | |
parent | e32cc3efe1c1ef5378cef422555e8c8289449938 (diff) | |
download | land-and-freedom-48726dd19ad8dde11a6172f30b5071987b7d09b5.tar.gz |
add tableaus and icon data
Diffstat (limited to 'play.ts')
-rw-r--r-- | play.ts | 56 |
1 files changed, 40 insertions, 16 deletions
@@ -12,15 +12,25 @@ declare const view: View; const BONUSES_COUNT = 2; // const PIECE_COUNT = 32; -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: {}, @@ -179,20 +189,14 @@ function on_init() { console.log('document', document); - // create space elements - // for (let s = 0; s < SPACE_COUNT; ++s) { - // let e = ui.spaces[s].document.createElement('div'); - // e.className = 'space'; - // register_action(e, 'space', s); - // ui.map.appendChild(e); - // } - - // // create piece elements - // for (let p = 0; p < PIECE_COUNT; ++p) { - // let e = (ui.pieces[p] = document.createElement('div')); - // e.className = 'piece'; - // register_action(e, 'piece', p); - // } + // Create blank_markers + 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); + } + } // create bonus markers for (let b = 0; b < BONUSES_COUNT; ++b) { @@ -257,6 +261,16 @@ function on_update() { 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', @@ -271,7 +285,7 @@ function on_update() { if (c === view.selected_card) { ui.cards[c].classList.add('selected'); } - }; + } for (let i = 0; i < view.tracks.length; ++i) { // ui.tracks.appendChild(ui.standees[i]); @@ -290,12 +304,21 @@ function on_update() { } } + 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'); @@ -304,6 +327,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'); } |