diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-10-05 14:28:00 +0100 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-10-05 14:28:00 +0100 |
commit | e33f5f76d929d67c1fb2437dced7ea4ed3bd5582 (patch) | |
tree | 4bcd67e1e14bdff69cdcfe17b8cb6d0aa954df3d | |
parent | 1b375fddd5d40cd765547f525ef620dbacf26725 (diff) | |
download | 1989-dawn-of-freedom-e33f5f76d929d67c1fb2437dced7ea4ed3bd5582.tar.gz |
Added Samizdat card to view
-rw-r--r-- | play.css | 6 | ||||
-rw-r--r-- | play.html | 28 | ||||
-rw-r--r-- | play.js | 36 | ||||
-rw-r--r-- | rules.js | 2 |
4 files changed, 52 insertions, 20 deletions
@@ -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%); }
@@ -140,6 +140,13 @@ </section>
+<!-- DISCARD -->
+<section id = "sec_discard">
+ <div id="discard_panel" class="panel">
+ <div id="discard_header" class="panel_header">Discard</div>
+ <div id="discard" class="panel_body"></div>
+ </div>
+</section>
<!-- POWERSTRUGGLE -->
<section id = "sec_power">
@@ -153,13 +160,7 @@ </div>
</section>
-<!-- DISCARD -->
-<section id = "sec_discard">
- <div id="discard_panel" class="panel">
- <div id="discard_header" class="panel_header">Discard</div>
- <div id="discard" class="panel_body"></div>
- </div>
- </section>
+
<!-- OPPONENT HAND -->
<section id="sec_opp_hand">
@@ -169,8 +170,17 @@ <div id="opp_hand" class="panel_body"></div>
</div>
- </section>
-
+</section>
+
+<!-- SAMIZDAT CARD -->
+<section id = "sec_samizdat">
+ <div id="samizdat_panel" class="panel">
+ <div id="samizdat_header" class="panel_header">Set aside card</div>
+ <div id="samizdat" class="panel_body"></div>
+ </div>
+</section>
+
+
<!-- HAND -->
<section id="sec_hand">
@@ -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 ==============================================
@@ -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
|