summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-10-05 14:28:00 +0100
committeriainp5 <iain.pearce.ip@gmail.com>2024-10-05 14:28:00 +0100
commite33f5f76d929d67c1fb2437dced7ea4ed3bd5582 (patch)
tree4bcd67e1e14bdff69cdcfe17b8cb6d0aa954df3d /play.js
parent1b375fddd5d40cd765547f525ef620dbacf26725 (diff)
download1989-dawn-of-freedom-e33f5f76d929d67c1fb2437dced7ea4ed3bd5582.tar.gz
Added Samizdat card to view
Diffstat (limited to 'play.js')
-rw-r--r--play.js36
1 files changed, 28 insertions, 8 deletions
diff --git a/play.js b/play.js
index 5c32a73..5f7dc43 100644
--- a/play.js
+++ b/play.js
@@ -383,8 +383,8 @@ function on_update() {
} else{
ui.dem_hand_count.innerText = `${view.democrat_hand} cards in hand`
ui.com_hand_count.innerText = `${view.communist_hand} cards in hand`
- ui.deck_length.innerText = `${view.strategy_deck} cards`
}
+ ui.deck_length.innerText = `${view.strategy_deck} cards`
// UPDATE HAND
document.getElementById("hand").replaceChildren()
@@ -408,11 +408,21 @@ function on_update() {
// UPDATE DISCARD
document.getElementById("discard").replaceChildren()
-for (let c of view.strategy_discard) {
- let discard_card = ui.cards[c]
- document.getElementById("discard").appendChild(discard_card)
- discard_card.classList.add('discard_card')
-}
+if (!view.is_pwr_struggle) {
+ for (let c of view.strategy_discard) {
+ let discard_card = ui.cards[c]
+ document.getElementById("discard").appendChild(discard_card)
+ discard_card.classList.add('discard_card')
+ discard_card.classList.remove('selected')
+ }
+} else if (view.is_pwr_struggle) {
+ for (let c of view.strategy_discard) {
+ let discard_card = ui.power_cards[c]
+ document.getElementById("discard").appendChild(discard_card)
+ discard_card.classList.add('discard_card')
+ discard_card.classList.remove('selected')
+ }
+}
// DISCARD FOR EVENTS
console.log('view.discard',view.discard)
@@ -466,6 +476,7 @@ if (!view.is_pwr_struggle) {
let card = ui.cards[c]
//console.log('power_card:', power_card)
document.getElementById("opp_hand").appendChild(card);
+ card.classList.remove('discard_card')
}
} else {
document.getElementById("opp_hand_panel").classList.add("hide")
@@ -476,7 +487,8 @@ if (!view.is_pwr_struggle) {
for (let c of view.opp_hand) {
let card = ui.power_cards[c]
//console.log('power_card:', power_card)
- document.getElementById("opp_hand").appendChild(card);
+ document.getElementById("opp_hand").appendChild(card);
+ card.classList.remove('discard_card')
}
} else {
document.getElementById("opp_hand_panel").classList.add("hide")
@@ -511,6 +523,14 @@ if (view.ceausescu_cards.length > 0 && view.is_pwr_struggle === true) {
document.getElementById("ceausescu_panel").classList.add("hide")
}
+// SAMIZDAT CARD
+if (view.samizdat > 0 ) {
+ document.getElementById("samizdat_panel").classList.remove("hide")
+ document.getElementById("samizdat_hand").appendChild(view.samizdat)
+} else {
+ document.getElementById("samizdat_panel").classList.add("hide")
+}
+
// UPDATE BOARD MARKERS
ui.turn.className = `t${view.turn}`
if (view.round_player === 'Democrat') {
@@ -638,7 +658,7 @@ if (view.persistent_events.includes(97)) {
action_button("done", "Done")
action_button("undo", "Undo")
-//console.log('view.revolutions', view.revolutions)
+console.log('view.strategy_deck', view.strategy_deck)
}
// =========================== LOG FUNCTIONS ==============================================