From 16dde60a53bff582d7790d27ca327fcced2283c1 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 19 Nov 2022 18:25:39 +0100 Subject: Show events. --- play.html | 17 +++++++++++++++++ play.js | 9 ++++++++- rules.js | 15 ++++++++++----- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/play.html b/play.html index 121d5d6..816a2e2 100644 --- a/play.html +++ b/play.html @@ -264,6 +264,21 @@ body.shift .mat .card:hover { justify-content: end; } +/* EVENTS: THIS LEVY / THIS CAMPAIGN */ + +#events { + display: flex; + max-width: 1275px; + margin: 0 auto; + flex-wrap: wrap; + gap: 12px; + justify-content: center; +} + +#events:empty { + display: none; +} + /* ASSETS */ .asset { @@ -1035,6 +1050,8 @@ body.shift .marker:hover { transform: scale(2); z-index: 200; }
+
+
~ Plan ~
diff --git a/play.js b/play.js index a986c9a..486611b 100644 --- a/play.js +++ b/play.js @@ -174,7 +174,9 @@ function count_vp2() { } function is_card_in_use(c) { - if (view.capabilities.includes(c)) + if (set_has(view.events, c)) + return true + if (set_has(view.capabilities, c)) return true if (view.lords.cards.includes(c)) return true @@ -281,6 +283,7 @@ const ui = { plan_action_cards: [], arts_of_war_dialog: document.getElementById("arts_of_war"), arts_of_war_list: document.getElementById("arts_of_war_list"), + events: document.getElementById("events"), p1_capabilities: document.getElementById("p1_capabilities"), p2_capabilities: document.getElementById("p2_capabilities"), command: document.getElementById("command"), @@ -723,6 +726,10 @@ function update_arts_of_war() { } } + ui.events.replaceChildren() + for (let c of view.events) + ui.events.appendChild(ui.arts_of_war[c]) + ui.p1_capabilities.replaceChildren() for_each_teutonic_arts_of_war(c => { if (view.capabilities.includes(c)) diff --git a/rules.js b/rules.js index 2382103..76d10eb 100644 --- a/rules.js +++ b/rules.js @@ -354,6 +354,8 @@ function is_levy_phase() { } function is_card_in_use(c) { + if (set_has(game.events, c)) + return true if (set_has(game.capabilities, c)) return true if (game.lords.cards.includes(c)) @@ -1515,24 +1517,27 @@ exports.view = function(state, current) { prompt: null, actions: null, log: game.log, + turn: game.turn, lords: game.lords, vassals: game.vassals, - legate: game.legate, - veche_vp: game.veche_vp, - veche_coin: game.veche_coin, + events: game.events, capabilities: game.capabilities, conquered: game.conquered, ravaged: game.ravaged, castles: game.castles, + sieges: game.sieges, + + legate: game.legate, + veche_vp: game.veche_vp, + veche_coin: game.veche_coin, + command: game.command, plan: null, who: game.who, where: game.where, } - view.sieges = { 0: 3, [LOC_NOVGOROD]: 2, [LOC_PSKOV]: 1 } - if (game.state === 'game_over') { view.prompt = game.victory } else if (current === 'Observer' || (game.active !== current && game.active !== BOTH)) { -- cgit v1.2.3