Skip to content

Commit 4fcf826

Browse files
authored
Merge pull request #8008 from NBKelly/add-autoresolve-optional-to-you-may-abilities
Add autoresolve optional to you some may abilities
2 parents 9adfaea + 475389a commit 4fcf826

File tree

7 files changed

+75
-71
lines changed

7 files changed

+75
-71
lines changed

src/clj/game/cards/assets.clj

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,16 +2168,25 @@
21682168
:abilities [ability]}))
21692169

21702170
(defcard "Personalized Portal"
2171-
{:events [{:event :corp-turn-begins
2171+
{:special {:auto-fire :always}
2172+
:abilities [(set-autoresolve :auto-fire "Personalized Portal (gain credits)")]
2173+
:events [{:event :corp-turn-begins
21722174
:interactive (req true)
21732175
:async true
2174-
:effect (req (wait-for (draw state :runner 1)
2175-
(let [cnt (count (get-in @state [:runner :hand]))
2176-
credits (quot cnt 2)]
2177-
(system-msg state :corp
2178-
(str "uses " (:title card) " to force the runner to draw "
2179-
"1 card and gain " credits " [Credits]"))
2180-
(gain-credits state :corp eid credits))))}]})
2176+
:msg "force the runner to draw 1 card"
2177+
:effect (req (wait-for
2178+
(draw state :runner 1)
2179+
(let [creds-to-gain (quot (count (get-in @state [:runner :hand])) 2)]
2180+
(continue-ability
2181+
state side
2182+
{:optional {:prompt (str "Gain " creds-to-gain " [Credits]?")
2183+
:autoresolve (get-autoresolve :auto-fire)
2184+
:req (req (pos? creds-to-gain))
2185+
:waiting-prompt true
2186+
:yes-ability {:msg (str "gain " creds-to-gain " [Credits]")
2187+
:async true
2188+
:effect (req (gain-credits state side eid creds-to-gain))}}}
2189+
card nil))))}]})
21812190

21822191
(defcard "Plan B"
21832192
(advance-ambush
@@ -2895,16 +2904,21 @@
28952904
(hardware? card)
28962905
(and (resource? card)
28972906
(has-subtype? card "Virtual"))))]
2898-
{:static-abilities [{:type :install-cost
2907+
{:special {:auto-fire :always}
2908+
:abilities [(set-autoresolve :auto-fire "TechnoCo")]
2909+
:static-abilities [{:type :install-cost
28992910
:req (req (and (is-techno-target target)
29002911
(not (:facedown (second targets)))))
29012912
:value 1}]
29022913
:events [{:event :runner-install
2903-
:req (req (and (is-techno-target (:card context))
2904-
(not (:facedown context))))
2905-
:msg "gain 1 [Credits]"
2906-
:async true
2907-
:effect (effect (gain-credits :corp eid 1))}]}))
2914+
:optional {:req (req (and (is-techno-target (:card context))
2915+
(not (:facedown context))))
2916+
:prompt "Gain 1 [Credit]?"
2917+
:waiting-prompt true
2918+
:autoresolve (get-autoresolve :auto-fire)
2919+
:yes-ability {:msg "gain 1 [Credits]"
2920+
:async true
2921+
:effect (effect (gain-credits :corp eid 1))}}}]}))
29082922

29092923
(defcard "Tenma Line"
29102924
{:abilities [{:action true

src/clj/game/cards/operations.clj

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
[game.core.memory :refer [mu+ update-mu]]
3737
[game.core.moving :refer [as-agenda mill move swap-agendas swap-ice trash
3838
trash-cards]]
39+
[game.core.optional :refer [get-autoresolve set-autoresolve]]
3940
[game.core.payment :refer [can-pay? cost-target ->c]]
4041
[game.core.play-instants :refer [play-instant]]
4142
[game.core.prevention :refer [damage-boost]]
@@ -687,16 +688,16 @@
687688
:effect (effect (purge eid))}})
688689

689690
(defcard "Death and Taxes"
690-
{:implementation "Credit gain mandatory to save on wait-prompts, adjust credits manually if credit not wanted."
691-
:events [{:event :runner-install
692-
:msg "gain 1 [Credits]"
693-
:async true
694-
:effect (effect (gain-credits :corp eid 1))}
695-
{:event :runner-trash
696-
:req (req (installed? (:card target)))
697-
:msg "gain 1 [Credits]"
698-
:async true
699-
:effect (effect (gain-credits :corp eid 1))}]})
691+
(let [maybe-gain-credit {:prompt "Gain 1 [Credits]?"
692+
:waiting-prompt true
693+
:autoresolve (get-autoresolve :auto-fire)
694+
:yes-ability {:msg "gain 1 [Credits]"
695+
:async true
696+
:effect (effect (gain-credits :corp eid 1))}}]
697+
{:special {:auto-fire :always}
698+
:abilities [(set-autoresolve :auto-fire "Death and Taxes")]
699+
:events [{:event :runner-install :optional maybe-gain-credit}
700+
{:event :runner-trash :optional (assoc maybe-gain-credit :req (req (installed? (:card target))))}]}))
700701

701702
(defcard "Dedication Ceremony"
702703
{:on-play

src/clj/game/cards/programs.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3236,7 +3236,8 @@
32363236
(strength-pump (->c :credit 1 {:stealth 1}) 7 :end-of-encounter)]}))
32373237

32383238
(defcard "Takobi"
3239-
{:events [{:event :subroutines-broken
3239+
{:special {:auto-place-counter :always}
3240+
:events [{:event :subroutines-broken
32403241
:optional {:req (req (:all-subs-broken target))
32413242
:prompt (msg "Place 1 power counter on " (:title card) "?")
32423243
:autoresolve (get-autoresolve :auto-place-counter)

src/clj/game/cards/resources.clj

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,7 @@
860860
:interactive (req true)
861861
:optional {:prompt "Place 1 virus counter?"
862862
:req (req (has-subtype? (:card context) "Virus"))
863+
:waiting-prompt true
863864
:autoresolve (get-autoresolve :auto-fire)
864865
:yes-ability {:msg (msg "place 1 virus counter on " (card-str state (:card context)))
865866
:async true
@@ -1536,23 +1537,12 @@
15361537
(effect-completed state side eid)))}]}))
15371538

15381539
(defcard "Find the Truth"
1539-
{:implementation "Corporation can click Find the Truth for explicit card reveals"
1540-
:events [{:event :post-runner-draw
1540+
{:events [{:event :post-runner-draw
15411541
:msg (msg "reveal that they drew "
15421542
(enumerate-str (map :title runner-currently-drawing)))
15431543
:async true
15441544
:effect (req (let [current-draws runner-currently-drawing]
1545-
(reveal state side eid current-draws)
1546-
;; If the corp wants explicit reveals from FTT, then show a prompt with
1547-
;; the card names in it
1548-
(when (= (get-in (get-card state card) [:special :explicit-reveal])
1549-
:yes)
1550-
(continue-ability
1551-
state :corp
1552-
{:prompt (msg "The runner reveals that they drew "
1553-
(enumerate-str (map :title current-draws)))
1554-
:choices ["OK"]}
1555-
card nil))))}
1545+
(reveal state side eid current-draws)))}
15561546
{:event :successful-run
15571547
:interactive (get-autoresolve :auto-peek (complement never?))
15581548
:silent (get-autoresolve :auto-peek never?)
@@ -1563,15 +1553,7 @@
15631553
:yes-ability {:prompt (req (->> corp :deck first :title (str "The top card of R&D is ")))
15641554
:msg "look at the top card of R&D"
15651555
:choices ["OK"]}}}]
1566-
:abilities [(set-autoresolve :auto-peek "Find the Truth looking at the top card of R&D")]
1567-
:corp-abilities [{:label "Explicitly reveal drawn cards"
1568-
:prompt "Explicitly reveal cards the Runner draws?"
1569-
:choices ["Yes" "No"]
1570-
:effect (effect (update! (assoc-in card [:special :explicit-reveal](keyword (str/lower-case target))))
1571-
(toast (str "From now on, " (:title card) " will "
1572-
(when (= target "No") "Not")
1573-
"explicitly reveal cards the Runner draws")
1574-
"info"))}]})
1556+
:abilities [(set-autoresolve :auto-peek "Find the Truth looking at the top card of R&D")]})
15751557

15761558
(defcard "First Responders"
15771559
{:abilities [{:cost [(->c :credit 2)]
@@ -1961,7 +1943,8 @@
19611943
(effect-completed state side eid))))}]})
19621944

19631945
(defcard "Kasi String"
1964-
{:events [{:event :run-ends
1946+
{:special {:auto-place-counter :always}
1947+
:events [{:event :run-ends
19651948
:optional
19661949
{:req (req (and (first-event? state :runner :run-ends #(is-remote? (:server (first %))))
19671950
(not (:did-steal target))
@@ -2254,7 +2237,8 @@
22542237
{:prompt (req (->> runner :deck first :title (str "The top card of the stack is ")))
22552238
:msg "look at the top card of the stack"
22562239
:choices ["OK"]}}}]
2257-
{:flags {:runner-turn-draw true
2240+
{:special {:auto-fire :always}
2241+
:flags {:runner-turn-draw true
22582242
:runner-phase-12 (req (some #(card-flag? % :runner-turn-draw true) (all-active-installed state :runner)))}
22592243
:events [(assoc ability :event :runner-turn-begins)]
22602244
:abilities [ability (set-autoresolve :auto-fire "Motivation")]}))
@@ -2522,15 +2506,20 @@
25222506
(assoc ability :event :runner-spent-credits)]}))
25232507

25242508
(defcard "PAD Tap"
2525-
{:events [{:event :corp-credit-gain
2526-
:req (req (and (not= (:action context) :corp-click-credit)
2527-
(= 1 (->> (turn-events state :corp :corp-credit-gain)
2528-
(remove (fn [[context]]
2529-
(= (:action context) :corp-click-credit)))
2530-
count))))
2531-
:msg "gain 1 [Credits]"
2532-
:async true
2533-
:effect (effect (gain-credits :runner eid 1))}]
2509+
{:special {:auto-fire :always}
2510+
:events [{:event :corp-credit-gain
2511+
:optional {:prompt "Gain 1 [Credit]?"
2512+
:req (req (and (not= (:action context) :corp-click-credit)
2513+
(= 1 (->> (turn-events state :corp :corp-credit-gain)
2514+
(remove (fn [[context]]
2515+
(= (:action context) :corp-click-credit)))
2516+
count))))
2517+
:waiting-prompt true
2518+
:autoresolve (get-autoresolve :auto-fire)
2519+
:yes-ability {:msg "gain 1 [Credits]"
2520+
:async true
2521+
:effect (effect (gain-credits :runner eid 1))}}}]
2522+
:abilities [(set-autoresolve :auto-fire "PAD Tap")]
25342523
:corp-abilities [{:action true
25352524
:label "Trash PAD Tap"
25362525
:async true
@@ -2785,7 +2774,8 @@
27852774
(draw state side eid 1)))}]})
27862775

27872776
(defcard "Psych Mike"
2788-
{:events [{:event :run-ends
2777+
{:special {:auto-fire :always}
2778+
:events [{:event :run-ends
27892779
:optional {:req (req (and (= :rd (target-server context))
27902780
(first-successful-run-on-server? state :rd)
27912781
(pos? (total-cards-accessed target :deck))))

src/clj/game/core/play_instants.clj

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,21 @@
145145
cost-paid (merge-costs-paid (:cost-paid eid) (:cost-paid async-result))
146146
eid (assoc eid :cost-paid cost-paid :source-type :ability)]
147147
(if payment-str
148-
(complete-play-instant state side eid moved-card payment-str ignore-cost)
148+
(do
149+
(update! state side (assoc moved-card :special (:special (card-def moved-card))))
150+
(complete-play-instant state side eid moved-card payment-str ignore-cost))
149151
;; could not pay the card's price; put it back and mark the effect as being over.
150152
(let [returned-card (move state side moved-card original-zone)]
151153
(continue-ability
152154
state side
153155
{:msg (msg "reveal that they are unable to play " (:title card))
154156
:cost (when (:base-cost args) [(:base-cost args)])
155157
:async true
156-
:effect (req (update! state :runner (-> returned-card
157-
(dissoc :seen)
158-
(assoc
159-
:cid (:cid card)
160-
:previous-zone (:previous-zone card))))
158+
:effect (req (update! state side (-> returned-card
159+
(dissoc :seen)
160+
(assoc
161+
:cid (:cid card)
162+
:previous-zone (:previous-zone card))))
161163
(reveal state side eid card))}
162164
card nil)))))))
163165

test/clj/game/cards/programs_test.clj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8373,7 +8373,6 @@
83738373
(run-continue state)
83748374
(card-ability state :runner corr 0)
83758375
(click-prompt state :runner "End the run")
8376-
(click-prompt state :runner "Yes")
83778376
(run-continue state)
83788377
(is (= 1 (get-counters (refresh tako) :power)) "Counter gained from breaking all subs"))))
83798378

test/clj/game/cards/resources_test.clj

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3732,7 +3732,6 @@
37323732
(dotimes [_ 3]
37333733
(run-empty-server state "Server 1")
37343734
(click-prompt state :runner "No action")
3735-
(click-prompt state :runner "Yes")
37363735
(take-credits state :runner)
37373736
(take-credits state :corp))
37383737
(take-credits state :runner)
@@ -3769,7 +3768,6 @@
37693768
(take-credits state :corp)
37703769
(run-empty-server state "Server 1")
37713770
(click-prompt state :runner "No action")
3772-
(click-prompt state :runner "Yes")
37733771
(is (= 1 (get-counters (get-resource state 0) :power)) "Kasi String should have 1 power counter on itself")))
37743772

37753773
(deftest kati-jones
@@ -5353,7 +5351,6 @@
53535351
(let [credits (:credit (get-runner))]
53545352
(run-empty-server state "R&D")
53555353
(click-prompt state :runner "No action")
5356-
(click-prompt state :runner "Yes")
53575354
(is (= (inc credits) (:credit (get-runner))) "Psych Mike should give 1 credit for accessing 1 card"))
53585355
(let [credits (:credit (get-runner))]
53595356
(run-empty-server state "R&D")
@@ -5366,13 +5363,14 @@
53665363
(run-continue state)
53675364
(dotimes [_ 5]
53685365
(click-prompt state :runner "No action"))
5369-
(click-prompt state :runner "Yes")
53705366
(is (= (+ credits 5) (:credit (get-runner))) "Psych Mike should give 5 credits for DDM accesses"))
53715367
(run-empty-server state "HQ")
53725368
(click-prompt state :runner "No action")
53735369
(is (not (last-log-contains? state "Psych Mike to gain 0")) "No log should be printed")
53745370
(take-credits state :runner)
53755371
(take-credits state :corp)
5372+
(card-ability state :runner (get-resource state 0) 0)
5373+
(click-prompt state :runner "Ask")
53765374
(let [credits (:credit (get-runner))]
53775375
(run-empty-server state "R&D")
53785376
(click-prompt state :runner "No action")
@@ -5406,7 +5404,6 @@
54065404
(click-prompt state :runner "Unrezzed upgrade")
54075405
(click-prompt state :runner "No action")
54085406
(click-prompt state :runner "No action")
5409-
(click-prompt state :runner "Yes")
54105407
(is (= (inc credits) (:credit (get-runner))) "Psych Mike should give 1 credit for accessing 1 card"))))
54115408

54125409
(deftest reclaim-basic-behavior

0 commit comments

Comments
 (0)