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.ts | |
parent | 9ec057935b3d77cc13f898b2ede63cf180443318 (diff) | |
download | land-and-freedom-7517f0e485f63c6c97ee2871ca64373375c504b8.tar.gz |
resolve fascist test and end of year
Diffstat (limited to 'play.ts')
-rw-r--r-- | play.ts | 59 |
1 files changed, 54 insertions, 5 deletions
@@ -1,6 +1,6 @@ 'use strict'; -import { StaticData, View } from './types'; +import { FactionId, StaticData, View } from './types'; declare function action_button(action: string, text: string): void; // declare function register_action(element: HTMLElement, type: string, s: number): void; @@ -12,28 +12,48 @@ declare const view: View; const BONUSES_COUNT = 2; // const PIECE_COUNT = 32; -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']; +// const ROLES = ['Anarchist', 'Communist', 'Moderate']; + +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: [], @@ -55,6 +75,18 @@ const LAYOUT_CURRENT_EVENTS = [ [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], @@ -210,6 +242,14 @@ function on_init() { 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'; + } + // create track medaillons for (let m = 0; m < MEDAILLONS_COUNT; ++m) { let e = (ui.medaillons[m] = document.createElement('div')); @@ -246,6 +286,12 @@ 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]}` + ); + } + // for (let s = 0; s < SPACE_COUNT; ++s) ui.spaces[s].replaceChildren(); // for (let p = 0; p < PIECE_COUNT; ++p) { @@ -261,7 +307,6 @@ 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]) { @@ -312,6 +357,10 @@ function on_update() { } } + 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)); @@ -322,14 +371,14 @@ function on_update() { action_button('d_collectivization', 'Decrease Collectivization'); action_button('d_foreign_aid', 'Decrease Foreign Aid'); action_button('d_government', 'Decrease Government'); - + action_button('d_soviet_support', 'Decrease Soviet Support'); action_button('draw_card', 'Draw a Card'); action_button('foreign_aid', 'Foreign Aid'); action_button('government', 'Government'); action_button('liberty', 'Liberty'); action_button('government_to_center', 'Government towards center'); - + action_button('teamwork_on', 'Teamwork Bonus On'); action_button('Anarchist', 'Anarchist'); action_button('Communist', 'Communist'); |