diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-07-14 12:35:54 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-07-14 13:10:19 +0200 |
commit | f7403f41bfc1a563a15cffb816619f96dd79ef8c (patch) | |
tree | 5596f7fc7c9a480c0b7cce68156c4355052e0dd4 /rules.js | |
parent | 19c04c7edeebf0d643eefecd3c2e75c3ebb67443 (diff) | |
download | time-of-crisis-f7403f41bfc1a563a15cffb816619f96dd79ef8c.tar.gz |
Don't allow trashing to below 4 cards.
Handle Pax Deorum when all cards are in hand.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -1378,11 +1378,14 @@ function goto_pax_deorum() { } function resume_pax_deorum() { - game.state = "pax_deorum" - if (game.draw[game.current].length === 0) { + if (game.draw[game.current].length === 0 && game.discard[game.current].length > 0) { log(PLAYER_NAME[game.current] + " put discard in available.") flip_discard_to_available() } + if (game.draw[game.current].length > 0) + game.state = "pax_deorum" + else + game.state = "pax_deorum_done" } states.pax_deorum = { @@ -5026,6 +5029,10 @@ function spend_senate_credit(cost) { return cost - credit } +function count_owned_cards() { + return game.draw[game.current].length + game.discard[game.current].length + game.hand[game.current].length +} + states.buy_trash = { inactive: "Buy/Trash Cards", prompt() { @@ -5036,10 +5043,15 @@ states.buy_trash = { view.prompt += " " + game.sip + " senate credits." let nprov = count_own_provinces() + if (game.pp >= 3) { - for (let c of current_discard()) - gen_action_card(c) + // Don't trash if it would leave you with fewer than 4 cards. + // Worst case: 3x Demagogue + Ludi Saeculares + if (count_owned_cards() > 4) + for (let c of current_discard()) + gen_action_card(c) } + for (let m of game.market) { if (m.length > 0) { let c = m[0] |