From 295d6f752b7e76090332f9e2cd0f832f75f92850 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 27 May 2023 12:12:26 +0200 Subject: Must discard card with same or higher ops value to play discarded event. --- rules.js | 19 +++++++++++++++---- 1 file 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) { -- cgit v1.2.3