Skip to content

Commit

Permalink
Remove defunct :cost-req
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahTheDuke committed Mar 29, 2024
1 parent 3c6aa12 commit d713104
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 20 deletions.
9 changes: 3 additions & 6 deletions src/clj/game/core/actions.clj
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@
(sort-by #(-> % first :auto-pump-sort))
(apply min-key #(let [costs (second %)]
(reduce (fnil + 0 0) 0 (keep :cost/amount costs)))))
cost-req (or (:cost-req pump-ability) identity)
pump-strength (get-pump-strength state side pump-ability card)
strength-diff (when (and current-ice
(get-strength current-ice)
Expand All @@ -257,7 +256,7 @@
0)
total-pump-cost (when (and pump-ability
times-pump)
(repeat times-pump (cost-req pump-cost)))]
(repeat times-pump pump-cost))]
(when (can-pay? state side eid card (:title card) total-pump-cost)
(wait-for (pay state side (make-eid state eid) card total-pump-cost)
(dotimes [_ times-pump]
Expand Down Expand Up @@ -386,7 +385,6 @@
(sort-by #(-> % first :auto-pump-sort))
(apply min-key #(let [costs (second %)]
(reduce (fnil + 0 0) 0 (mapv :cost/amount costs)))))
pump-cost-req (or (:cost-req pump-ability) identity)
pump-strength (get-pump-strength state side pump-ability card)
strength-diff (when (and current-ice
(get-strength current-ice)
Expand All @@ -399,7 +397,7 @@
0)
total-pump-cost (when (and pump-ability
times-pump)
(repeat times-pump (pump-cost-req [pump-cost])))
(repeat times-pump pump-cost))
;; break all subs
can-break (fn [ability]
(when (and (:break-req ability)
Expand All @@ -413,7 +411,6 @@
(sort-by #(-> % first :auto-break-sort))
(apply min-key #(let [costs (second %)]
(reduce (fnil + 0 0) 0 (mapv :cost/amount costs)))))
break-cost-req (or (:cost-req break-ability) identity)
subs-broken-at-once (when break-ability
(:break break-ability 1))
unbroken-subs (when (:subroutines current-ice)
Expand All @@ -426,7 +423,7 @@
1))
total-break-cost (when (and break-cost
times-break)
(repeat times-break (break-cost-req [break-cost])))
(repeat times-break break-cost))
total-cost (merge-costs (conj total-pump-cost total-break-cost))]
(when (and break-ability
(can-pay? state side eid card (:title card) total-cost))
Expand Down
6 changes: 2 additions & 4 deletions src/clj/game/core/engine.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[game.core.card-defs :refer [card-def]]
[game.core.effects :refer [get-effect-maps unregister-lingering-effects]]
[game.core.eid :refer [complete-with-result effect-completed make-eid]]
[game.core.payment :refer [build-spend-msg can-pay? handler merge-costs]]
[game.core.payment :refer [build-spend-msg can-pay? handler]]
[game.core.prompt-state :refer [add-to-prompt-queue]]
[game.core.prompts :refer [clear-wait-prompt show-prompt show-select show-wait-prompt]]
[game.core.say :refer [system-msg system-say]]
Expand Down Expand Up @@ -73,8 +73,6 @@
; Mark the ability as "async", meaning the :effect function must call effect-completed itself.
; Without this being set to true, resolve-ability will call effect-completed once it's done.
; This part of the engine is really dumb and complicated, so ask someone on slack about it.
; :cost-req -- 1-fn
; A function which will be applied to the cost of an ability immediatly prior to being paid. See all-stealth or min-stealth for examples.

; PROMPT KEYS
; :prompt -- string or 5-fn
Expand Down Expand Up @@ -1140,7 +1138,7 @@
(keep :paid/msg)
(enumerate-str))
:cost-paid (->> payment-result
(keep #(not-empty (select-keys % [:paid/type :paid/targets :paid/value])))
(keep #(not-empty (dissoc % :paid/msg)))
(reduce
(fn [acc paid]
(assoc acc (:paid/type paid) paid))
Expand Down
2 changes: 0 additions & 2 deletions src/clj/game/core/ice.clj
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,6 @@
:breaks subtypes
:break-cost cost
:auto-break-sort (:auto-break-sort args)
:cost-req (:cost-req args)
:break-cost-bonus (:break-cost-bonus args)
:additional-ability (:additional-ability args)
:label (str (or (:label args)
Expand Down Expand Up @@ -672,7 +671,6 @@
(str-req state side eid card targets)
true))
:cost [cost]
:cost-req (:cost-req args)
:pump strength
:pump-bonus (:pump-bonus args)
:auto-pump-sort (:auto-break-sort args)
Expand Down
9 changes: 1 addition & 8 deletions src/clj/game/core/payment.clj
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,7 @@
([state side eid card title & args]
(let [remove-zero-credit-cost (and (= (:source-type eid) :corp-install)
(not (ice? card)))
cost-req (when (and (:abilities (:source eid))
(:ability-idx (:source-info eid)))
(:cost-req (nth (:abilities (:source eid)) (:ability-idx (:source-info eid)) nil)))
cost-filter (if (fn? cost-req) cost-req identity)
costs (->> (merge-costs (filter some? args) remove-zero-credit-cost)
(cost-filter)
(flatten)
(into []))]
costs (merge-costs (filter some? args) remove-zero-credit-cost)]
(if (every? #(and (not (flag-stops-pay? state side %))
(payable? % state side eid card))
costs)
Expand Down

0 comments on commit d713104

Please sign in to comment.