summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-07-14 12:35:54 +0200
committerTor Andersson <tor@ccxvii.net>2023-07-14 13:10:19 +0200
commitf7403f41bfc1a563a15cffb816619f96dd79ef8c (patch)
tree5596f7fc7c9a480c0b7cce68156c4355052e0dd4
parent19c04c7edeebf0d643eefecd3c2e75c3ebb67443 (diff)
downloadtime-of-crisis-f7403f41bfc1a563a15cffb816619f96dd79ef8c.tar.gz
Don't allow trashing to below 4 cards.
Handle Pax Deorum when all cards are in hand.
-rw-r--r--rules.js20
1 files changed, 16 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index c3f021e..33cfa25 100644
--- a/rules.js
+++ b/rules.js
@@ -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]