diff options
author | Frans Bongers <fransbongers@franss-mbp.home> | 2024-12-11 22:38:27 +0100 |
---|---|---|
committer | Frans Bongers <fransbongers@franss-mbp.home> | 2024-12-11 22:38:27 +0100 |
commit | 7517f0e485f63c6c97ee2871ca64373375c504b8 (patch) | |
tree | ea0dd0fce5234fc5f81ef1c10b8a451208a502cc /play.js | |
parent | 9ec057935b3d77cc13f898b2ede63cf180443318 (diff) | |
download | land-and-freedom-7517f0e485f63c6c97ee2871ca64373375c504b8.tar.gz |
resolve fascist test and end of year
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 44 |
1 files changed, 43 insertions, 1 deletions
@@ -1,27 +1,45 @@ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); const BONUSES_COUNT = 2; -const CARD_COUNT = 63; +const CARD_COUNT = 109; +const GLORY_COUNT = 9; const MEDAILLONS_COUNT = 5; const STANDEES_COUNT = 5; const TRACK_COUNT = 5; const TRACK_LENGTH = 11; const FACTIONS = ['a', 'c', 'm']; +console.log('roles', document.getElementById('roles')); let ui = { map: document.getElementById('map'), markers: document.getElementById('markers'), hand: document.getElementById('hand'), current_events: document.getElementById('current_events'), + stats: { + a: { + hero_points: document.querySelector('#role_Anarchist .role_stat'), + }, + c: { + hero_points: document.querySelector('#role_Communist .role_stat'), + }, + m: { + hero_points: document.querySelector('#role_Moderate .role_stat'), + }, + pool: { + hero_points: document.getElementById('pool_hero_points'), + }, + }, tableaus: { a: document.getElementById('tableau_a'), c: document.getElementById('tableau_c'), m: document.getElementById('tableau_m'), }, tracks: document.getElementById('tracks'), + hero_points: document.querySelector('#role_Anarchist .role_stat'), blank_markers: [[], [], [], [], []], bonuses: [], fronts: {}, frontValues: {}, + glory: [], medaillons: [], spaces: [], standees: [], @@ -39,6 +57,17 @@ const LAYOUT_CURRENT_EVENTS = [ [445, 648], [584, 648], ]; +const LAYOUT_GLORY = [ + [801, 647], + [860, 647], + [897, 647], + [848, 718], + [775, 771], + [812, 771], + [849, 771], + [885, 771], + [922, 771], +]; const LAYOUT_MEDAILLONS = [ [364, 556], [415, 556], @@ -174,6 +203,13 @@ function on_init() { register_action(e, 'bonus', b); ui.map.appendChild(ui.bonuses[b]); } + for (let g = 0; g < GLORY_COUNT; ++g) { + let e = (ui.glory[g] = document.createElement('div')); + e.className = 'glory'; + ui.map.appendChild(ui.glory[g]); + e.style.left = LAYOUT_GLORY[g][0] + 'px'; + e.style.top = LAYOUT_GLORY[g][1] + 'px'; + } for (let m = 0; m < MEDAILLONS_COUNT; ++m) { let e = (ui.medaillons[m] = document.createElement('div')); e.className = 'medaillon'; @@ -200,6 +236,9 @@ function on_init() { function on_update() { console.log('on_update', view); on_init(); + for (let key of Object.keys(view.hero_points)) { + ui.stats[key].hero_points.replaceChildren(`Hero Points: ${view.hero_points[key]}`); + } ui.current_events.replaceChildren(); for (let i = 0; i < view.current_events.length; i++) { const cardId = view.current_events[i]; @@ -247,6 +286,9 @@ function on_update() { ui.tableaus[faction_id].appendChild(ui.cards[c]); } } + for (let g = 0; g < view.glory.length; ++g) { + ui.glory[g].setAttribute('data-faction-id', view.glory[g]); + } for (let e of action_register) e.classList.toggle('action', is_action(e.my_action, e.my_id)); action_button('add_to_front', '+1 to a Front'); |