-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix additional credit costs not being ignored by :ignore-costs :rez-costs #7216
Fix additional credit costs not being ignored by :ignore-costs :rez-costs #7216
Conversation
Not sure if this is better with the refactor or was better with the |
src/clj/game/core/cost_fns.clj
Outdated
(get-effects state side :rez-additional-cost card)))) | ||
([state side card] (rez-additional-cost-bonus state side card (constantly true))) | ||
([state side card pred] | ||
(filter pred (merge-costs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer (let [costs (merge-costs ...)] (if pred (filterv pred costs) costs))
. No need to do extra work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
happy with either, kinda took the first one to be more functional / less having to declare extra state but also think the if
does read more straightforward
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel you. Applying a single function to everything is nice. Conditionals make logic harder to follow.
I don't think of items in let bindings as state because they don't persist. Immutable data means we can let bind all we want for free.
src/clj/game/core/rezzing.clj
Outdated
@@ -26,7 +26,8 @@ | |||
(= :all-costs ignore-cost) [:credit 0] | |||
alternative-cost alternative-cost | |||
:else (let [cost (rez-cost state side card {:cost-bonus cost-bonus}) | |||
additional-costs (rez-additional-cost-bonus state side card)] | |||
additional-costs (rez-additional-cost-bonus state side card #(or (nil? ignore-cost) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this here. Instead, (when ignore-cost #(= :credit ...))
. Along with the change above, no need to check every step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ya this is much better and makes sense then for the above to use nil
instead of a true function
5c5ada4
to
e002551
Compare
Fixes #7214
Fixes #6824