From 7517f0e485f63c6c97ee2871ca64373375c504b8 Mon Sep 17 00:00:00 2001 From: Frans Bongers Date: Wed, 11 Dec 2024 22:38:27 +0100 Subject: resolve fascist test and end of year --- play.js | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'play.js') diff --git a/play.js b/play.js index c4e15ac..3711a13 100644 --- a/play.js +++ b/play.js @@ -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'); -- cgit v1.2.3