summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
Diffstat (limited to 'play.js')
-rw-r--r--play.js36
1 files changed, 29 insertions, 7 deletions
diff --git a/play.js b/play.js
index 069daac..0c8c5fc 100644
--- a/play.js
+++ b/play.js
@@ -236,6 +236,11 @@ function build_user_interface() {
document.getElementById("red_momentum").addEventListener("mousedown", on_click_red_momentum)
document.getElementById("blue_momentum").addEventListener("mousedown", on_click_blue_momentum)
+ ui.red_objective_back = document.createElement("div")
+ ui.red_objective_back.className = "card card_objective_back"
+ ui.blue_objective_back = document.createElement("div")
+ ui.blue_objective_back.className = "card card_objective_back"
+
for (let c = 1; c <= 41 + 12; ++c) {
elt = ui.cards[c] = document.createElement("div")
elt.className = `card card_${c}`
@@ -398,12 +403,32 @@ function on_update() {
ui.political_vp.className = `piece cylinder orange vp${5+view.political_vp}`
document.getElementById("hand").replaceChildren()
- document.getElementById("final").replaceChildren()
document.getElementById("discard").replaceChildren()
document.getElementById("set_aside").replaceChildren()
- document.getElementById("objective").replaceChildren()
- if (view.final)
- document.getElementById("final").appendChild(ui.cards[view.final])
+
+ // document.getElementById("final").replaceChildren()
+ // document.getElementById("objective").replaceChildren()
+
+ document.getElementById("commune_cards").replaceChildren()
+ document.getElementById("versailles_cards").replaceChildren()
+
+ if (view.red_final)
+ document.getElementById("commune_cards").appendChild(ui.cards[view.red_final])
+ if (view.blue_final)
+ document.getElementById("versailles_cards").appendChild(ui.cards[view.blue_final])
+
+ if (view.red_objective === 0)
+ document.getElementById("commune_cards").appendChild(ui.red_objective_back)
+ else
+ for (let c of view.red_objective)
+ document.getElementById("commune_cards").appendChild(ui.cards[c])
+
+ if (view.blue_objective === 0)
+ document.getElementById("versailles_cards").appendChild(ui.blue_objective_back)
+ else
+ for (let c of view.blue_objective)
+ document.getElementById("versailles_cards").appendChild(ui.cards[c])
+
if (view.discard)
document.getElementById("discard").appendChild(ui.cards[view.discard])
if (view.hand)
@@ -412,9 +437,6 @@ function on_update() {
if (view.set_aside)
for (let c of view.set_aside)
document.getElementById("set_aside").appendChild(ui.cards[c])
- if (view.objective)
- for (let c of view.objective)
- document.getElementById("objective").appendChild(ui.cards[c])
for (let i = 0; i < space_names.length; ++i)
layout[i] = []