From 227dca6e6e4c2f2d5a16527507810bc373b758ec Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 16 Oct 2024 12:21:33 +0200 Subject: Add special panels for Karl Marx and Jules Ducatel events. --- play.css | 3 +++ play.html | 14 ++++++++++++++ play.js | 22 ++++++++++++++++++++++ rules.js | 8 ++++---- 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/play.css b/play.css index 4d140ff..e2d855e 100644 --- a/play.css +++ b/play.css @@ -52,6 +52,9 @@ body.Versailles header.your_turn { background-color: hsl(199, 45%, 70%); } #red_objective_panel, #blue_objective_panel { min-width: 290px; max-width: 560px; } +#karl_marx_panel { min-width: 830px; } +#jules_ducatel_panel { min-width: 830px; } + #red_objective_header { background-color: hsl(358, 20%, 28%) } #blue_objective_header { background-color: hsl(199, 20%, 26%) } #red_objective { background-color: hsl(358, 10%, 36%) } diff --git a/play.html b/play.html index 190f175..9dd960e 100644 --- a/play.html +++ b/play.html @@ -61,6 +61,20 @@ + +
diff --git a/play.js b/play.js index 3e0300b..df7b04b 100644 --- a/play.js +++ b/play.js @@ -527,6 +527,8 @@ function on_update() { ui.military_vp.className = `piece cylinder purple vp${5+view.military_vp}` ui.political_vp.className = `piece cylinder orange vp${5+view.political_vp}` + document.getElementById("karl_marx").replaceChildren() + document.getElementById("jules_ducatel").replaceChildren() document.getElementById("hand").replaceChildren() document.getElementById("final").replaceChildren() document.getElementById("discard").replaceChildren() @@ -546,6 +548,26 @@ function on_update() { if (view.discard) document.getElementById("discard").appendChild(ui.cards[view.discard]) + if (view.karl_marx || view.jules_ducatel) { + document.getElementById("event_grid").style.display = null + if (view.karl_marx) { + document.getElementById("karl_marx_panel").classList.remove("hide") + for (let c of view.karl_marx) + document.getElementById("karl_marx").appendChild(ui.cards[c]) + } else { + document.getElementById("karl_marx_panel").classList.add("hide") + } + if (view.jules_ducatel) { + document.getElementById("jules_ducatel_panel").classList.remove("hide") + for (let c of view.jules_ducatel) + document.getElementById("jules_ducatel").appendChild(ui.cards[c]) + } else { + document.getElementById("jules_ducatel_panel").classList.add("hide") + } + } else { + document.getElementById("event_grid").style.display = "none" + } + if (view.hand) { document.getElementById("hand_panel").classList.remove("hide") for (let c of view.hand) diff --git a/rules.js b/rules.js index ca48ad6..458584d 100644 --- a/rules.js +++ b/rules.js @@ -3415,7 +3415,7 @@ states.reveal_commune_hand = { inactive: "look at Commune player's hand", prompt() { event_prompt("Revealing Commune player's hand.") - view.hand = game.red_hand + view.jules_ducatel = game.red_hand view.actions.done = 1 }, done() { @@ -3478,7 +3478,7 @@ states.karl_marx_discard = { inactive: "discard a card", prompt() { event_prompt("Discard 2 cards, then play or discard the last card.") - view.hand = game.vm.cards + view.karl_marx = game.vm.cards for (let c of game.vm.cards) gen_action_card(c) }, @@ -3496,7 +3496,7 @@ states.karl_marx_play = { inactive: "play or discard a card", prompt() { event_prompt("Play or discard the last card.") - view.hand = game.vm.cards + view.karl_marx = game.vm.cards if (can_play_event(game.vm.cards[0])) view.actions.event = 1 else @@ -3543,7 +3543,7 @@ states.georges_vaysset = { inactive: "look at Commune player's hand, take a card, then give them a card", prompt() { event_prompt("Take a card from your opponent's hand.") - view.hand = game.red_hand + view.karl_marx = game.red_hand for (let c of game.red_hand) gen_action_card(c) }, -- cgit v1.2.3