Skip to content
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 Security Testing async and replacement effect #4344

Merged
merged 1 commit into from
Aug 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/clj/game/cards/resources.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1950,14 +1950,17 @@
{:req (req (= (zone->name (get-in @state [:run :server]))
(:server-target (get-card state card))))
:once :per-turn
:silent (req true)
:effect (req (let [st card]
(swap! state assoc-in [:run :run-effect :replace-access]
{:mandatory true
:effect (effect (resolve-ability
{:msg "gain 2 [Credits] instead of accessing"
:effect (effect (gain-credits 2)
(update! (dissoc st :server-target)))}
st nil))})))}
(swap! state assoc-in [:run :run-effect]
{:card st
:replace-access
{:mandatory true
:effect (effect (continue-ability
{:msg "gain 2 [Credits] instead of accessing"
:effect (effect (gain-credits 2)
(update! (dissoc st :server-target)))}
st nil))}})))}
:runner-turn-ends {:effect (effect (update! (dissoc card :server-target)))}}
:abilities [ability]})

Expand Down
2 changes: 0 additions & 2 deletions test/clj/game_test/cards/identities.clj
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,12 @@
(do-game
(new-game {:runner {:id "Alice Merchant: Clan Agitator"
:deck ["Security Testing"]}})
; (trash-from-hand state :corp "Hostile Takeover")
(take-credits state :corp)
(play-from-hand state :runner "Security Testing")
(take-credits state :runner)
(take-credits state :corp)
(click-prompt state :runner "Archives")
(run-empty-server state "Archives")
(click-prompt state :runner "Alice Merchant: Clan Agitator")
(click-prompt state :corp (find-card "Hedge Fund" (:hand (get-corp))))
(is (= 1 (-> (get-corp) :discard count)) "Alice ability should trash 1 card from HQ")
(is (-> (get-corp) :discard first :seen not) "Discarded card should be facedown when access is replaced")))
Expand Down
27 changes: 26 additions & 1 deletion test/clj/game_test/cards/resources.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2842,7 +2842,32 @@
(run-empty-server state "Archives")
(is (= 9 (:credit (get-runner))) "Gained 2 credits")
(run-empty-server state "R&D")
(is (= 11 (:credit (get-runner)))))))
(is (= 11 (:credit (get-runner))))))
(testing "with Paragon and other successful-run triggers"
(do-game
(new-game {:corp {:id "AgInfusion: New Miracles for a New World"
:deck [(qty "Hedge Fund" 5)]
:hand ["Ice Wall"]}
:runner {:deck ["Sure Gamble"]
:hand ["Diversion of Funds"
"Paragon"
"Security Testing"]
:credits 20}})
(play-from-hand state :corp "Ice Wall" "HQ")
(take-credits state :corp)
(play-from-hand state :runner "Security Testing")
(play-from-hand state :runner "Paragon")
(take-credits state :runner)
(take-credits state :corp)
(click-prompt state :runner "Archives")
(play-from-hand state :runner "Diversion of Funds")
(card-ability state :corp (:identity (get-corp)) 0)
(click-prompt state :corp "Archives")
(let [credits (:credit (get-runner))]
(run-successful state)
(click-prompt state :runner "Yes")
(click-prompt state :runner "Yes")
(is (= (+ 3 credits) (:credit (get-runner))) "2 from Sec Testing, 1 from Paragon")))))

(deftest spoilers
;; Spoilers - Mill the Corp when it scores an agenda
Expand Down