diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -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) |