Skip to content

Commit a9eada2

Browse files
authored
Merge pull request #7951 from NBKelly/corp-can-pay-to-rez
2 parents d4b4482 + 697a3c2 commit a9eada2

File tree

4 files changed

+56
-35
lines changed

4 files changed

+56
-35
lines changed

src/clj/game/cards/assets.clj

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
[game.core.prompts :refer [cancellable]]
4848
[game.core.props :refer [add-counter add-icon add-prop remove-icon set-prop]]
4949
[game.core.revealing :refer [reveal]]
50-
[game.core.rezzing :refer [derez rez]]
50+
[game.core.rezzing :refer [can-pay-to-rez? derez rez]]
5151
[game.core.runs :refer [end-run]]
5252
[game.core.say :refer [system-msg]]
5353
[game.core.servers :refer [is-remote? target-server zone->name]]
@@ -1042,7 +1042,10 @@
10421042
:effect (effect (update! (dissoc card :ebc-rezzed)))}]
10431043
:abilities [{:async true
10441044
:once :per-turn
1045-
:choices {:card (complement rezzed?)}
1045+
:choices {:req (req (and (corp? target)
1046+
(not (rezzed? target))
1047+
(can-pay-to-rez? state side (assoc eid :source card)
1048+
target {:cost-bonus -1})))}
10461049
:label "Rez a card, lowering the cost by 1 [Credits] (start of turn)"
10471050
:msg (msg "rez " (:title target))
10481051
:effect (req (wait-for (rez state side target {:no-warning true :cost-bonus -1})
@@ -2264,23 +2267,30 @@
22642267
:effect (effect (as-agenda card 1))}]})
22652268

22662269
(defcard "Quarantine System"
2267-
(letfn [(rez-ice [cnt] {:prompt "Choose a piece of ice to rez"
2268-
:async true
2269-
:choices {:card #(and (ice? %)
2270-
(not (rezzed? %)))}
2271-
:msg (msg "rez " (:title target))
2272-
:waiting-prompt true
2273-
:effect (req (let [agenda (last (:rfg corp))
2274-
ap (:agendapoints agenda 0)]
2275-
(wait-for (rez state side target {:no-warning true :cost-bonus (* ap -2)})
2276-
(if (< cnt 3)
2277-
(continue-ability state side (rez-ice (inc cnt)) card nil)
2278-
(effect-completed state side eid)))))})]
2270+
(letfn [(rez-ice [cnt discount]
2271+
{:prompt (str "Choose a piece of ice to rez, paying " discount " [Credits] less")
2272+
:async true
2273+
:choices {:req (req (and (ice? target)
2274+
(can-pay-to-rez? state side (assoc eid :source card)
2275+
target {:cost-bonus (- discount)})
2276+
(not (rezzed? target))))}
2277+
:msg (msg "rez " (:title target))
2278+
:waiting-prompt true
2279+
:effect (req (wait-for (rez state side target {:no-warning true :cost-bonus (- discount)})
2280+
(if (< cnt 3)
2281+
(continue-ability
2282+
state side
2283+
(rez-ice (inc cnt) discount)
2284+
card nil)
2285+
(effect-completed state side eid))))})]
22792286
{:abilities [{:label "Forfeit agenda to rez up to 3 pieces of ice with a 2 [Credit] discount per agenda point"
22802287
:req (req (pos? (count (:scored corp))))
22812288
:cost [(->c :forfeit)]
22822289
:async true
2283-
:effect (req (continue-ability state side (rez-ice 1) card nil))}]}))
2290+
:effect (req (continue-ability
2291+
state side
2292+
(rez-ice 1 (* 2 (:agendapoints (last (:rfg corp)) 0)))
2293+
card nil))}]}))
22842294

22852295
(defcard "Raman Rai"
22862296
{:events [{:event :corp-draw

src/clj/game/cards/operations.clj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
[game.core.props :refer [add-counter add-prop]]
4242
[game.core.purging :refer [purge]]
4343
[game.core.revealing :refer [reveal reveal-loud]]
44-
[game.core.rezzing :refer [derez rez]]
44+
[game.core.rezzing :refer [can-pay-to-rez? derez rez]]
4545
[game.core.runs :refer [end-run make-run]]
4646
[game.core.say :refer [system-msg]]
4747
[game.core.servers :refer [is-remote? remote->name zone->name]]
@@ -821,16 +821,16 @@
821821
:async true
822822
:effect (req (doseq [c targets]
823823
(derez state side c {:source-card card}))
824-
(let [discount (* -3 (count targets))]
824+
(let [discount (* 3 (count targets))]
825825
(continue-ability
826826
state side
827827
{:async true
828-
:prompt "Choose a card to rez"
829-
:choices {:card #(and (installed? %)
830-
(corp? %)
831-
(not (rezzed? %))
832-
(not (agenda? %)))}
833-
:effect (req (rez state side eid target {:cost-bonus discount}))}
828+
:prompt (str "Choose a card to rez, paying " discount " [Credits] less")
829+
:choices {:req (req (and (every-pred installed? corp? (complement rezzed?)
830+
installed? (complement agenda?))
831+
(can-pay-to-rez? state side (assoc eid :source card)
832+
target {:cost-bonus (- discount)})))}
833+
:effect (req (rez state side eid target {:cost-bonus (- discount)}))}
834834
card nil)))}})
835835

836836
(defcard "Door to Door"

src/clj/game/cards/upgrades.clj

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
[game.core.props :refer [add-counter add-prop set-prop]]
4242
[game.core.purging :refer [purge]]
4343
[game.core.revealing :refer [reveal]]
44-
[game.core.rezzing :refer [rez derez]]
44+
[game.core.rezzing :refer [can-pay-to-rez? rez derez]]
4545
[game.core.runs :refer [end-run force-ice-encounter jack-out redirect-run
4646
set-next-phase start-next-phase]]
4747
[game.core.say :refer [system-msg]]
@@ -128,9 +128,8 @@
128128
:optional
129129
{:req (req (and (ice? (:card context))
130130
(protecting-same-server? card (:card context))
131-
(can-pay? state side (assoc eid :source card :source-type :rez)
132-
(:card context) nil
133-
[(->c :credit (rez-cost state side (:card context) {:cost-bonus -3}))])))
131+
(can-pay-to-rez? state side (assoc eid :source card)
132+
(:card context) {:cost-bonus -3})))
134133
:prompt "Rez ice with rez cost lowered by 3?"
135134
:yes-ability {:msg (msg "lower the rez cost of " (:title (:card context)) " by 3 [Credits]")
136135
:async true
@@ -214,15 +213,17 @@
214213
:events [{:event :pass-all-ice
215214
:optional
216215
{:req (req (and this-server
217-
(some #(can-pay? state side (assoc eid :source card :source-type :rez) % nil
218-
[(->c :credit (rez-cost state side % {:cost-bonus -7}))])
216+
(some #(can-pay-to-rez? state side (assoc eid :source card)
217+
% {:cost-bonus -7})
219218
(:hosted card))))
220219
:prompt "Rez and force the Runner to encounter a hosted piece of ice?"
221220
:waiting-prompt true
222221
:yes-ability
223222
{:async true
224223
:prompt "Choose a hosted piece of Bioroid ice to rez"
225-
:choices (req (:hosted card))
224+
:choices (req (filter #(can-pay-to-rez? state side (assoc eid :source card)
225+
% {:cost-bonus -7})
226+
(:hosted card)))
226227
:msg (msg "lower the rez cost of " (:title target) " by 7 [Credits] and force the Runner to encounter it")
227228
:effect (req (wait-for (rez state side target {:cost-bonus -7})
228229
(let [ice (:card async-result)]
@@ -1662,16 +1663,13 @@
16621663
(not (same-card? target card))
16631664
(some #(and (not (rezzed? %))
16641665
(not (agenda? %))
1665-
(can-pay? state side (assoc eid :source card :source-type :rez) % nil
1666-
[(->c :credit (install-cost state side % {:cost-bonus -2}))]))
1666+
(can-pay-to-rez? state side (assoc eid :source card) % {:cost-bonus -2}))
16671667
(all-installed state :corp)))))
16681668
:prompt "Rez another card paying 2 [Credits] less?"
16691669
:yes-ability {:prompt "Choose a card to rez"
16701670
:choices {:req (req (and (not (rezzed? target))
16711671
(not (agenda? target))
1672-
(can-pay? state side (assoc eid :source card :source-type :rez)
1673-
target nil
1674-
[(->c :credit (rez-cost state side target {:cost-bonus -2}))])))}
1672+
(can-pay-to-rez? state side (assoc eid :source card) target {:cost-bonus -2})))}
16751673
:msg (msg "rez " (:title target) ", lowering the rez cost by 2 [Credits]")
16761674
:async true
16771675
:effect (effect (rez eid target {:cost-bonus -2}))}}}]})

src/clj/game/core/rezzing.clj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@
9494
(continue state side nil))
9595
(complete-with-result state side eid {:card (get-card state card)})))))))))
9696

97+
(defn can-pay-to-rez?
98+
([state side eid card] (can-pay-to-rez? state side eid card nil))
99+
([state side eid card args]
100+
(let [eid (assoc eid :source-type :rez)
101+
card (get-card state card)
102+
costs (get-rez-cost state side card args)
103+
alternative-cost (when (and card
104+
(not (is-disabled? state side card)))
105+
(:alternative-cost (card-def card)))]
106+
(or (and alternative-cost
107+
(can-pay? state side eid card nil alternative-cost))
108+
(can-pay? state side eid card nil costs)))))
109+
97110
(defn rez
98111
"Rez a corp card."
99112
([state side eid card] (rez state side eid card nil))

0 commit comments

Comments
 (0)