summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-05-27 12:12:26 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-27 12:12:26 +0200
commit295d6f752b7e76090332f9e2cd0f832f75f92850 (patch)
treebd3817e572df7abc8d1440827e59820d263a87fc
parentc70b19dd4f7959db43b805f82a0cd85b55039b66 (diff)
downloadred-flag-over-paris-295d6f752b7e76090332f9e2cd0f832f75f92850.tar.gz
Must discard card with same or higher ops value to play discarded event.
-rw-r--r--rules.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index 7c7f505..9fc4317 100644
--- a/rules.js
+++ b/rules.js
@@ -1087,6 +1087,14 @@ function top_discard() {
return 0
}
+function can_pay_for_discard(top) {
+ let top_ops = card_ops[top]
+ for (let c of player_hand())
+ if (card_ops[c] >= top_ops)
+ return true
+ return false
+}
+
states.strategy_phase = {
inactive: "play a card",
prompt() {
@@ -1100,9 +1108,10 @@ states.strategy_phase = {
if (final > 0)
gen_action_card(final)
- if (top_discard() > 0 && !is_neutral_card(top_discard()))
- if (can_play_event(top_discard()))
- gen_action_card(top_discard())
+ let top = top_discard()
+ if (top > 0 && !is_neutral_card(top) && can_pay_for_discard(top))
+ if (can_play_event(top))
+ gen_action_card(top)
}
},
@@ -1201,8 +1210,10 @@ states.play_discard = {
inactive: "play a card",
prompt() {
view.prompt = card_names[game.what] + ": Discard a card."
+ let top_ops = card_ops[top_discard()]
for (let c of player_hand())
- gen_action_card(c)
+ if (card_ops[c] >= top_ops)
+ gen_action_card(c)
view.selected_card = game.what
},
card(c) {