From 92bac20c44b3f04435f65f7acd0e60b1571b2094 Mon Sep 17 00:00:00 2001 From: iainp5 Date: Sun, 9 Feb 2025 18:32:36 +0000 Subject: Show Prudence as both persistent event and in discard --- play.js | 11 ++++++++++- rules.js | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/play.js b/play.js index 60c80fa..b5f9855 100644 --- a/play.js +++ b/play.js @@ -196,6 +196,8 @@ const C_ARMY_BACKS_REVOLUTION = 108 const C_KREMLIN_COUP = 109 const C_MALTA_SUMMIT = 110 +const EXTRA_PRUDENCE = 800 + // END CONST }}} const scoring_cards = [22, 23, 42, 43, 55, 95] @@ -848,9 +850,16 @@ function on_update() { ui.removed.appendChild(ui.cards[c]) ui.persistent.replaceChildren() - for (let c of view.persistent_events) + console.log('view.persistent_events', view.persistent_events) + for (let c of view.persistent_events) { if (c < 111) ui.persistent.appendChild(ui.cards[c]) + if (c === EXTRA_PRUDENCE) { + const card_e = document.createElement("div") + card_e.className = "card event_" + c + ui.persistent.appendChild(card_e) + } + } ui.played_card.replaceChildren() if (!view.scoring_card) { diff --git a/rules.js b/rules.js index 3a2a03c..eed3611 100644 --- a/rules.js +++ b/rules.js @@ -206,6 +206,7 @@ const C_MALTA_SUMMIT = 110 // END CONSTANTS }}} const MAGIC_NEW_YEARS_EVE_PARTY = 111 +const EXTRA_PRUDENCE = 800 const dem_tst_req = [5, 5, 6, 6, 7, 8, 9, 10] const com_tst_req = [6, 6, 7, 7, 8, 7, 6, 5] @@ -3880,6 +3881,7 @@ function new_turn() { } if (game.prudence) { delete game.prudence + game.persistent_events = game.persistent_events.filter( c => c !== EXTRA_PRUDENCE) no_longer_in_effect.push(C_PRUDENCE) } if (no_longer_in_effect.length > 0) { @@ -5654,6 +5656,8 @@ function vm_prudence() { game.prudence.DEM-- log(`${game.prudence.DEM} to Democrat Ops for the rest of the turn.`) } + if (!game.persistent_events.includes(EXTRA_PRUDENCE)) + game.persistent_events.push(EXTRA_PRUDENCE) vm_next() } -- cgit v1.2.3