summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-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) {