Skip to content

Commit

Permalink
Fix Security Testing async and replacement effect
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahTheDuke committed Aug 2, 2019
1 parent cfb1d8e commit dc09b97
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
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

0 comments on commit dc09b97

Please sign in to comment.