From e33f5f76d929d67c1fb2437dced7ea4ed3bd5582 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Sat, 5 Oct 2024 14:28:00 +0100 Subject: Added Samizdat card to view --- play.css | 6 +++--- play.html | 28 +++++++++++++++++++--------- play.js | 36 ++++++++++++++++++++++++++++-------- rules.js | 2 ++ 4 files changed, 52 insertions(+), 20 deletions(-) diff --git a/play.css b/play.css index fde9cfd..373904d 100644 --- a/play.css +++ b/play.css @@ -16,7 +16,7 @@ header.your_turn { background-color: orange; } font-size: 16px; line-height: 1.5; } -#deck_stat {padding-left: 5px;} +#deck_stat {padding-left: 5px; padding-bottom: 5px;} #log { background-color: whitesmoke; } #log .h1 { font-weight: bold; padding-top:2px; padding-bottom:2px; text-align: center; } @@ -27,8 +27,8 @@ header.your_turn { background-color: orange; } #log .h2 { background-color: hsl(0,0%,80%);} #log .h1 { background-color: hsl(0,0%,80%); } -#log .h2.dem { background-color: hsl(200,90%,50%); } -#log .h2.com { background-color: hsl(360, 80%, 75%); } +#log .h2.dem { background-color: hsl(200, 80%, 80%); } +#log .h2.com { background-color: hsl(0, 80%, 80%); } #log .h3.democrat { background-color: hsl(210,30%,90%); } #log .h3.h2.communist { background-color: hsl(35,40%,90%); } diff --git a/play.html b/play.html index f2956f0..742ccc5 100644 --- a/play.html +++ b/play.html @@ -140,6 +140,13 @@ + +
+
+
Discard
+
+
+
@@ -153,13 +160,7 @@
- -
-
-
Discard
-
-
-
+
@@ -169,8 +170,17 @@
-
- + + + +
+
+
Set aside card
+
+
+
+ +
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 ============================================== diff --git a/rules.js b/rules.js index 3d03d97..a550f04 100644 --- a/rules.js +++ b/rules.js @@ -166,6 +166,7 @@ exports.view = function(state, player) { dem_tst: game.dem_tst_position, com_tst: game.com_tst_position, persistent_events: game.persistent_events, + samizdat: game.samizdat_card, systematization: game.systematization, the_tyrant_is_gone: game.the_tyrant_is_gone, @@ -3840,6 +3841,7 @@ function add_lateyear() { function reset_power() { game.power_struggle_deck = [] + game.power_struggle_discard = [] game.dem_pwr_hand = [] game.com_pwr_hand = [] game.phase = 1 -- cgit v1.2.3