From 3e36074596d23d78b48c0a999b57d5a6f3808030 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Sun, 27 Oct 2024 20:41:10 +0000 Subject: New power struggle card layout --- rules.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'rules.js') 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) { -- cgit v1.2.3