summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
Diffstat (limited to 'play.js')
-rw-r--r--play.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/play.js b/play.js
index fe3d55c..3a91056 100644
--- a/play.js
+++ b/play.js
@@ -427,14 +427,14 @@ function on_log(text) {
return p
}
-function on_update_objective(panel, parent, objective) {
+function on_update_objective(panel, parent, objective, i) {
if (typeof objective === "object") {
for (let c of objective)
parent.appendChild(ui.cards[c])
} else if (objective === 1) {
- parent.appendChild(ui.objective_back[0])
+ parent.appendChild(ui.objective_back[i])
} else if (objective === 2) {
- parent.appendChild(ui.objective_back[0])
+ parent.appendChild(ui.objective_back[i])
} else if (objective > 2) {
parent.appendChild(ui.cards[objective])
}
@@ -476,16 +476,20 @@ function on_update() {
if (view.red_final)
document.getElementById("final").appendChild(ui.cards[view.red_final])
- on_update_objective(document.getElementById("blue_objective_panel"), document.getElementById("blue_objective"), view.blue_objective)
+ on_update_objective(document.getElementById("blue_objective_panel"), document.getElementById("blue_objective"), view.blue_objective, 0)
- on_update_objective(document.getElementById("red_objective_panel"), document.getElementById("red_objective"), view.red_objective)
+ on_update_objective(document.getElementById("red_objective_panel"), document.getElementById("red_objective"), view.red_objective, 1)
if (view.discard)
document.getElementById("discard").appendChild(ui.cards[view.discard])
- if (view.hand)
+ if (view.hand) {
+ document.getElementById("hand_panel").classList.remove("hide")
for (let c of view.hand)
document.getElementById("hand").appendChild(ui.cards[c])
+ } else {
+ document.getElementById("hand_panel").classList.add("hide")
+ }
if (view.set_aside) {
document.getElementById("set_aside_panel").classList.remove("hide")
for (let c of view.set_aside)