summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.css12
-rw-r--r--play.html13
-rw-r--r--play.js19
-rw-r--r--rules.js22
4 files changed, 51 insertions, 15 deletions
diff --git a/play.css b/play.css
index 90a5a57..a0d7094 100644
--- a/play.css
+++ b/play.css
@@ -237,6 +237,18 @@ body.Communist header.your_turn { background-color: hsl(355, 70%, 75%); }
display: none;
}
+#scoring_card_panel {
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+}
+
+#scoring_card_panel .card_row {
+ display: flex;
+ gap: 10px;
+}
+
+
/* CARD IMAGES */
#tooltip {
diff --git a/play.html b/play.html
index 50fb00d..97882fd 100644
--- a/play.html
+++ b/play.html
@@ -85,16 +85,17 @@
<!-- PLAYED CARD - POWERSTRUGGLE -->
<div id="scoring_card_panel" class="panel">
<div id="scoring_card_header" class="panel_header">Power Struggle</div>
- <div id="scoring_card" class="panel_body"></div>
- <div id="power_card_header" class="panel_header">Power Struggle</div>
- <div id="communist_card" class="panel_body"></div>
- <div id="democrat_card" class="panel_body"></div>
-
+ <div class="card_row">
+ <div id="scoring_card" class="panel_body"></div>
+ <div id="power_card_1" class="panel_body"></div>
+ <div id="power_card_2" class="panel_body"></div>
+ </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_header" class="panel_header">Power Struggle</div>
<div id="played_power_card" class="panel_body"></div>
</div>
<div id="ceausescu_panel" class="panel">
diff --git a/play.js b/play.js
index 9e00d94..7446aad 100644
--- a/play.js
+++ b/play.js
@@ -372,6 +372,8 @@ const ui = {
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"),
opp_hand: document.getElementById("opp_hand"),
@@ -642,17 +644,26 @@ function on_update() {
// UPDATE CARD DISPLAYS
ui.played_card.replaceChildren()
-
+ ui.power_card_1.replaceChildren()
+ ui.power_card_2.replaceChildren()
+
+ console.log('view.is_pwr_struggle', view.is_pwr_struggle, 'view.power_card_1', view.power_card_1, 'view.power_card_2', view.power_card_2)
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()
+/* ui.played_power_card.replaceChildren()
if (view.played_power_card > 0)
- ui.played_power_card.appendChild(ui.power_cards[view.played_power_card])
+ ui.played_power_card.appendChild(ui.power_cards[view.played_power_card])*/
ui.samizdat_card.replaceChildren()
if (view.samizdat > 0)
@@ -812,7 +823,7 @@ function on_log(text) {
p.className = "h3"
}
- text = text.replace(/([a-zA-Z])\*/g, "")
+ text = text.replace(/([a-zA-Z])\*/g, "$1")
p.innerHTML = text
return p
}
diff --git a/rules.js b/rules.js
index 48b34af..5654997 100644
--- a/rules.js
+++ b/rules.js
@@ -400,6 +400,9 @@ exports.view = function(state, player) {
if (game.is_pwr_struggle) {
view.power_struggle_discard = game.power_struggle_discard
view.played_power_card = game.played_power_card
+ console.log('game.com_power_card', game.com_power_card, 'game.dem_power_card', game.dem_power_card)
+ view.power_card_1 = game.power_card_1
+ view.power_card_2 = game.power_card_2
}
view.strategy_discard = game.strategy_discard
@@ -1574,6 +1577,13 @@ states.power_struggle = {
power_card(card) {
push_undo()
discard(card)
+ if (game.phase === 0) {
+ game.power_card_1 = card
+ delete game.power_card_2
+ }
+ if (game.phase === 1) {
+ game.power_card_2 = card
+ }
game.valid_cards=[]
game.return_state = 'power_struggle'
if (game.phase === 0) {delete game.proxy_power_card}
@@ -1643,6 +1653,8 @@ states.power_struggle = {
concede () {
push_undo()
game.valid_cards = []
+ delete game.power_card_1
+ delete game.power_card_2
log('Conceded')
log_h2('Aftermath')
log_h3('Support Loss')
@@ -2114,8 +2126,8 @@ states.general_strike = {
prompt() {
if (game.played_card === 0 ) {
view.prompt = 'General Strike: you must discard a card or play a Scoring Card.'
- available_cards = game.communist_hand
- for (let card of available_cards) {
+ game.communist_hand
+ for (let card of game.communist_hand) {
gen_action_card(card)
}
} else if (game.played_card > 0 ) {
@@ -3884,11 +3896,11 @@ function find_country_index(country) {
}
function draw_deck() {
- let hand = []
+ let deck = []
for (let c = first_strategy_card; c <= last_strategy_card; ++c)
if (cards[c].period === 1)
- hand.push(c)
- return c
+ deck.push(c)
+ return deck
}
function draw_cards(deck, democrat_hand, communist_hand, dem_hand_limit, com_hand_limit) {