summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-26 00:33:08 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-26 00:33:08 +0200
commitea8755f9fe54ea911cdd864c5cfc01d708bdafb4 (patch)
tree06a0cc78fac3d93fd8bf4fa90294cf2d8f5cbf77
parentf71d3ff7dd4e6b4536049fe034e934182cb36cf4 (diff)
download1989-dawn-of-freedom-ea8755f9fe54ea911cdd864c5cfc01d708bdafb4.tar.gz
add played power card panel
-rw-r--r--play.html24
-rw-r--r--play.js7
-rw-r--r--rules.js3
3 files changed, 22 insertions, 12 deletions
diff --git a/play.html b/play.html
index 473be26..f510ba0 100644
--- a/play.html
+++ b/play.html
@@ -66,6 +66,20 @@
</div>
</div>
+<!-- POWERSTRUGGLE -->
+<div id="played_power_card_panel" class="panel">
+ <div id="played_power_card_header" class="panel_header">Played Power Card</div>
+ <div id="played_power_card" class="panel_body"></div>
+</div>
+<div id="ceausescu_panel" class="panel">
+ <div id="ceausescu_header" class="panel_header">Ceausescu Cards</div>
+ <div id="ceausescu_hand" class="panel_body"></div>
+</div>
+<div id="power_panel" class="panel">
+ <div id="power_header" class="panel_header">Power Struggle Hand</div>
+ <div id="power_hand" class="panel_body"></div>
+</div>
+
<!-- EVENTS ON THE TABLE -->
<div id="table_panel" class="panel">
<div id="table_header" class="panel_header">Cards on the Table</div>
@@ -84,16 +98,6 @@
<div id="hand" class="panel_body"></div>
</div>
-<!-- POWERSTRUGGLE -->
-<div id="ceausescu_panel" class="panel">
- <div id="ceausescu_header" class="panel_header">Ceausescu Cards</div>
- <div id="ceausescu_hand" class="panel_body"></div>
-</div>
-<div id="power_panel" class="panel">
- <div id="power_header" class="panel_header">Power Struggle Hand</div>
- <div id="power_hand" class="panel_body"></div>
-</div>
-
<!-- OPPONENT HAND -->
<div id="opp_hand_panel" class="panel">
<div id="opp_hand_header" class="panel_header">Opponent Hand</div>
diff --git a/play.js b/play.js
index 4658044..770e6d5 100644
--- a/play.js
+++ b/play.js
@@ -40,6 +40,7 @@ const ui = {
event_reminder_list: document.getElementById("event_reminder_list"),
played_card: document.getElementById("played_card"),
+ played_power_card: document.getElementById("played_power_card"),
hand: document.getElementById("hand"),
power_hand: document.getElementById("power_hand"),
opp_hand: document.getElementById("opp_hand"),
@@ -372,6 +373,10 @@ function on_update() {
if (view.played_card > 0)
ui.played_card.appendChild(ui.cards[view.played_card])
+ 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])
@@ -383,7 +388,7 @@ function on_update() {
ui.power_hand.replaceChildren()
if (view.power_hand)
for (let c of view.power_hand)
- ui.hand.appendChild(ui.power_cards[c])
+ ui.power_hand.appendChild(ui.power_cards[c])
ui.opp_hand.replaceChildren()
if (view.opp_hand)
diff --git a/rules.js b/rules.js
index 6ce54dd..64d4396 100644
--- a/rules.js
+++ b/rules.js
@@ -192,7 +192,8 @@ exports.view = function(state, player) {
}
if (game.is_pwr_struggle) {
- view.strategy_discard = game.power_struggle_discard
+ view.power_struggle_discard = game.power_struggle_discard
+ view.played_power_card = game.played_power_card,
} else {
view.strategy_discard = game.strategy_discard
}