summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-28 12:24:31 +0100
committerTor Andersson <tor@ccxvii.net>2024-10-28 12:25:29 +0100
commit372d26d9ff82c772a6161465764eeb209f1d2752 (patch)
treed531121449cd1746ab499b0b1358028c5fa55f02 /play.js
parentb595b4be88dd7a2ea291ab08d54c41b895d8663d (diff)
download1989-dawn-of-freedom-372d26d9ff82c772a6161465764eeb209f1d2752.tar.gz
WIP card display order
Diffstat (limited to 'play.js')
-rw-r--r--play.js73
1 files changed, 25 insertions, 48 deletions
diff --git a/play.js b/play.js
index b0c0644..6babd3b 100644
--- a/play.js
+++ b/play.js
@@ -370,17 +370,13 @@ const ui = {
event_reminder_list: document.getElementById("event_reminder_list"),
played_card: document.getElementById("played_card"),
- scoring_card: document.getElementById("scoring_card"),
- played_power_card: document.getElementById("played_power_card"),
- power_card_1: document.getElementById("power_card_1"),
- power_card_2: document.getElementById("power_card_2"),
hand: document.getElementById("hand"),
power_hand: document.getElementById("power_hand"),
+ power_discard: document.getElementById("power_discard"),
opp_hand: document.getElementById("opp_hand"),
- opp_power_hand: document.getElementById("opp_power_hand"),
discard: document.getElementById("discard"),
removed: document.getElementById("removed"),
- table_cards: document.getElementById("table_cards"),
+ persistent: document.getElementById("persistent"),
ceausescu_hand: document.getElementById("ceausescu_hand"),
samizdat_card: document.getElementById("samizdat_card"),
@@ -643,27 +639,6 @@ function on_update() {
// UPDATE CARD DISPLAYS
- ui.played_card.replaceChildren()
- ui.power_card_1.replaceChildren()
- ui.power_card_2.replaceChildren()
-
- if (!view.is_pwr_struggle) {
- if (view.played_card > 0)
- ui.played_card.appendChild(ui.cards[view.played_card])
- document.getElementById("scoring_card_panel").style.display = "none"
- } else {
- document.getElementById("scoring_card_panel").style.display = "flex"
- if (view.played_card > 0)
- ui.scoring_card.appendChild(ui.cards[view.played_card])
- if (view.power_card_1)
- ui.power_card_1.appendChild(ui.power_cards[view.power_card_1])
- if (view.power_card_2)
- ui.power_card_2.appendChild(ui.power_cards[view.power_card_2])
- }
-/* ui.played_power_card.replaceChildren()
- if (view.played_power_card > 0)
- ui.played_power_card.appendChild(ui.power_cards[view.played_power_card])*/
-
ui.samizdat_card.replaceChildren()
if (view.samizdat > 0)
ui.samizdat_card.appendChild(ui.cards[view.samizdat])
@@ -676,14 +651,16 @@ function on_update() {
if (view.power_hand)
for (let c of view.power_hand)
ui.power_hand.appendChild(ui.power_cards[c])
-
+
+ ui.power_discard.replaceChildren()
+ if (view.power_struggle_discard)
+ for (let c of view.power_struggle_discard)
+ ui.power_discard.appendChild(ui.power_cards[c])
+
ui.opp_hand.replaceChildren()
- if (view.show_opp_hand && view.opp_hand)
+ if (view.opp_hand)
for (let c of view.opp_hand)
ui.opp_hand.appendChild(ui.cards[c])
-
- // TODO: fix rules to set view.opp_power_hand
- ui.opp_power_hand.replaceChildren()
if (view.opp_power_hand)
for (let c of view.opp_power_hand)
ui.opp_hand.appendChild(ui.power_cards[c])
@@ -694,24 +671,24 @@ function on_update() {
ui.ceausescu_hand.appendChild(ui.power_cards[c])
ui.discard.replaceChildren()
- for (let c of view.strategy_discard) {
- if (c === view.played_card) continue
- ui.discard.appendChild(ui.cards[c]) }
- if (view.discard)
- document.getElementById("discard_panel").classList.remove("hide")
- else
- document.getElementById("discard_panel").classList.add("hide")
+ for (let c of view.strategy_discard)
+ ui.discard.appendChild(ui.cards[c])
ui.removed.replaceChildren()
- for (let c of view.strategy_removed) {
- if (c === view.played_card) continue
- ui.removed.appendChild(ui.cards[c]) }
-
- ui.table_cards.replaceChildren()
- if (view.table_cards)
- for (let c of view.table_cards) {
- if (c === view.played_card) continue
- ui.table_cards.appendChild(ui.cards[c]) }
+ for (let c of view.strategy_removed)
+ ui.removed.appendChild(ui.cards[c])
+
+ ui.persistent.replaceChildren()
+ for (let c of view.persistent_events)
+ ui.persistent.appendChild(ui.cards[c])
+
+ ui.played_card.replaceChildren()
+ if (view.played_card > 0)
+ ui.played_card.appendChild(ui.cards[view.played_card])
+ if (view.power_card_1 > 0)
+ ui.played_card.appendChild(ui.power_cards[view.power_card_1])
+ if (view.power_card_2 > 0)
+ ui.played_card.appendChild(ui.power_cards[view.power_card_2])
for (let e of action_register)
e.classList.toggle("action", is_action(e.my_action, e.my_id))