Skip to content

Commit

Permalink
Merge pull request #5614 from jwarwick/spoilers
Browse files Browse the repository at this point in the history
Spoilers
  • Loading branch information
jwarwick authored Mar 8, 2021
2 parents e136deb + 0f1ca2b commit 48671f5
Show file tree
Hide file tree
Showing 7 changed files with 294 additions and 5 deletions.
18 changes: 18 additions & 0 deletions src/clj/game/cards/events.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,24 @@
{:msg "reduce the Corp's maximum hand size by 1 for each bad publicity"
:constant-effects [(corp-hand-size+ (req (- (count-bad-pub state))))]})

(defcard "Jailbreak"
{:req (req (or rd-runnable hq-runnable))
:prompt "Choose a server"
:choices ["HQ" "R&D"]
:makes-run true
:async true
:effect (req (make-run state side eid target card))
:events [{:event :successful-run
:silent (req true)
:async true
:req (req (and (or (= :hq (target-server context))
(= :rd (target-server context)))
this-card-run))
:effect (req (if (= :hq (target-server context))
(access-bonus state :runner :hq 1)
(access-bonus state :runner :rd 1))
(draw state side eid 1 nil))}]})

(defcard "Khusyuk"
(let [access-revealed (fn [revealed]
{:async true
Expand Down
38 changes: 38 additions & 0 deletions src/clj/game/cards/hardware.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,44 @@
(same-card? card (:host target))))
:type :recurring}}})

(defcard "Pantograph"
(let [install-ability
{:optional
{:waiting-prompt "Runner to decide if they will use Pantograph"
:prompt "Install card with Pantograph ability?"
:player :runner
:yes-ability
{:async true
:prompt "Select a card to install with Pantograph"
:choices
{:req (req (and (runner? target)
(in-hand? target)
(not (event? target))
(can-pay? state side (assoc eid :source card :source-type :runner-install)
target nil
[:credit (install-cost state side target nil)])))}
:msg (msg "install " (:title target))
:effect (effect (runner-install
(assoc eid :source card :source-type :runner-install)
target nil))
:cancel-effect (effect (effect-completed eid))}}}
gain-credit-ability
{:interactive (req true)
:async true
:effect (req (wait-for (resolve-ability
state side
{:optional
{:prompt "Gain 1 [Credits] with Pantograph ability?"
:yes-ability
{:async true
:msg "gain 1 [Credits]"
:effect (req (gain-credits state :runner eid 1))}}}
card nil)
(continue-ability state side install-ability card nil)))}]
{:constant-effects [(mu+ 1)]
:events [(assoc gain-credit-ability :event :agenda-scored)
(assoc gain-credit-ability :event :agenda-stolen)]}))

(defcard "Paragon"
{:constant-effects [(mu+ 1)]
:events [{:event :successful-run
Expand Down
71 changes: 71 additions & 0 deletions src/clj/game/cards/identities.clj
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,17 @@
:async true
:effect (effect (gain-credits eid 1))}]})

(defcard "Haas-Bioroid: Precision Design"
{:constant-effects [(corp-hand-size+ 1)]
:events [{:event :agenda-scored
:label "add card from Archives to HQ"
:prompt "Select a card to add to HQ"
:show-discard true
:choices {:card #(and (corp? %)
(in-discard? %))}
:msg (msg "add " (card-str state target) " to HQ")
:effect (effect (move :corp target :hand))}]})

(defcard "Haas-Bioroid: Stronger Together"
{:constant-effects [{:type :ice-strength
:req (req (has-subtype? target "Bioroid"))
Expand Down Expand Up @@ -714,6 +725,22 @@
:async true
:effect (effect (draw eid 1 nil))}]})

(defcard "René \"Loup\" Arcemont: Party Animal"
{:events [{:event :runner-trash
:optional
{:req (req (and (:accessed context)
(first-event? state side :runner-trash
(fn [targets]
(some #(:accessed %) targets)))))
:prompt "Gain 1 [Credits] and draw 1 card?"
:autoresolve (get-autoresolve :auto-rene)
:yes-ability
{:async true
:msg "gain 1 [Credits] and draw 1 card"
:effect (req (wait-for (draw state :runner 1 nil)
(gain-credits state :runner eid 1)))}}}]
:abilities [(set-autoresolve :auto-rene "René")]})

(defcard "Jemison Astronautics: Sacrifice. Audacity. Success."
{:events [{:event :corp-forfeit-agenda
:async true
Expand Down Expand Up @@ -818,6 +845,20 @@
:effect (req (apply prevent-run-on-server state card (map first (get-remotes state))))
:leave-play (req (apply enable-run-on-server state card (map first (get-remotes state))))})

(defcard "Jinteki: Restoring Humanity"
{:events [{:event :corp-turn-ends
:interactive (get-autoresolve :auto-restoring (complement never?))
:silent (get-autoresolve :auto-restoring never?)
:optional
{:req (req (pos? (count (remove :seen (:discard corp)))))
:autoresolve (get-autoresolve :auto-restoring)
:prompt "Gain 1 [Credits]?"
:yes-ability
{:msg "gain 1 [Credits]"
:async true
:effect (effect (gain-credits :corp eid 1))}}}]
:abilities [(set-autoresolve :auto-restoring "Restoring Humanity")]})

(defcard "Kabonesa Wu: Netspace Thrillseeker"
{:abilities [{:label "Install a non-virus program from your stack, lowering the cost by 1 [Credit]"
:cost [:click 1]
Expand Down Expand Up @@ -1479,6 +1520,24 @@
:msg (msg "swap the positions of " (card-str state (first targets))
" and " (card-str state (second targets)))}]})

(defcard "Tāo Salonga: Telepresence Magician"
(let [swap-ability
{:interactive (req true)
:optional
{:req (req (<= 2 (count (filter ice? (all-installed state :corp)))))
:prompt "Swap ice with Tāo Salonga ability?"
:yes-ability
{:prompt "Select 2 ice"
:choices {:req (req (and (installed? target)
(ice? target)))
:max 2
:all true}
:msg (msg "swap the positions of " (card-str state (first targets))
" and " (card-str state (second targets)))
:effect (req (swap-ice state side (first targets) (second targets)))}}}]
{:events [(assoc swap-ability :event :agenda-scored)
(assoc swap-ability :event :agenda-stolen)]}))

(defcard "Tennin Institute: The Secrets Within"
{:flags {:corp-phase-12 (req (and (not (:disabled (get-card state card)))
(not-last-turn? state :runner :successful-run)))}
Expand Down Expand Up @@ -1561,6 +1620,18 @@
:async true
:effect (effect (gain-credits eid 1))}]})

(defcard "Weyland Consortium: Built to Last"
{:events [{:event :advance
:optional
{:req (req (not (pos? (- (get-counters target :advancement) (:amount (second targets) 0)))))
:prompt "Gain 2 [Credits]?"
:autoresolve (get-autoresolve :auto-build-to-last)
:yes-ability
{:async true
:msg "gain 2 [Credits]"
:effect (req (gain-credits state :corp eid 2))}}}]
:abilities [(set-autoresolve :auto-build-to-last "Built to Last")]})

(defcard "Whizzard: Master Gamer"
{:recurring 3
:interactions {:pay-credits {:req (req (and (= :runner-trash-corp-cards (:source-type eid))
Expand Down
10 changes: 5 additions & 5 deletions src/clj/game/core/props.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
(rezzed? updated-card))
(update-ice-strength state side updated-card))
(if-not placed
(trigger-event-sync state side eid :advance (get-card state updated-card))
(trigger-event-sync state side eid :advancement-placed (get-card state updated-card))))
(trigger-event-sync state side eid :counter-added (get-card state updated-card))))))
(trigger-event-sync state side eid :advance (get-card state updated-card) {:counter-type key :amount n :placed placed})
(trigger-event-sync state side eid :advancement-placed (get-card state updated-card) {:counter-type key :amount n :placed placed})))
(trigger-event-sync state side eid :counter-added (get-card state updated-card) {:counter-type key :amount n :placed placed})))))

(defn set-prop
"Like add-prop, but sets multiple keys to corresponding values without triggering events.
Expand All @@ -36,15 +36,15 @@
"Adds n counters of the specified type to a card"
([state side card type n] (add-counter state side (make-eid state) card type n nil))
([state side card type n args] (add-counter state side (make-eid state) card type n args))
([state side eid card type n args]
([state side eid card type n {:keys [placed] :as args}]
(let [updated-card (if (= type :virus)
(assoc card :added-virus-counter true)
card)]
(update! state side (update-in updated-card [:counter type] #(+ (or % 0) n)))
(if (= type :advancement)
;; if advancement counter use existing system
(add-prop state side eid card :advance-counter n args)
(trigger-event-sync state side eid :counter-added (get-card state updated-card))))))
(trigger-event-sync state side eid :counter-added (get-card state updated-card) {:counter-type key :amount n :placed placed})))))

(defn add-icon
"Adds an icon to a card. E.g. a Femme Fatale token.
Expand Down
23 changes: 23 additions & 0 deletions test/clj/game/cards/events_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3010,6 +3010,29 @@
(change state :corp :bad-publicity 3)
(is (= 1 (hand-size :corp)))))

(deftest jailbreak
;; Jailbreak
(do-game
(new-game {:corp {:deck [(qty "Hedge Fund" 5)]
:hand [(qty "Vanilla" 2)]}
:runner {:deck [(qty "Sure Gamble" 2)]
:hand [(qty "Jailbreak" 2)]}})
(take-credits state :corp)
(play-from-hand state :runner "Jailbreak")
(click-prompt state :runner "R&D")
(run-continue state)
(click-prompt state :runner "No action")
(click-prompt state :runner "No action")
(is (not (:run @state)) "Run ended")
(is (= 2 (count (:hand (get-runner)))) "One played, one drawn")
(play-from-hand state :runner "Jailbreak")
(click-prompt state :runner "HQ")
(run-continue state)
(click-prompt state :runner "No action")
(click-prompt state :runner "No action")
(is (not (:run @state)) "Run ended")
(is (= 2 (count (:hand (get-runner)))) "One played, one drawn")))

(deftest khusyuk
;; Khusyuk
(testing "Basic functionality"
Expand Down
42 changes: 42 additions & 0 deletions test/clj/game/cards/hardware_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2662,6 +2662,48 @@
(card-ability state :runner inti 1)
(click-card state :runner omni)))))))

(deftest pantograph
;; Pantograph - Gain 1 credit and may look at and move top card of Stack to bottom
(testing "Basic test - triggered on steal"
(do-game
(new-game {:corp {:hand ["House of Knives"]}
:runner {:hand ["Pantograph" "Bankroll"]}})
(take-credits state :corp)
(play-from-hand state :runner "Pantograph")
(is (= 5 (core/available-mu state)) "Gain 1 memory")
(run-empty-server state :hq)
(click-prompt state :runner "Steal")
(changes-val-macro
1 (:credit (get-runner))
"Gain 1 credit from Pantograph"
(click-prompt state :runner "Yes"))
(changes-val-macro
-1 (:credit (get-runner))
"Gain 1 credit from Pantograph"
(click-prompt state :runner "Yes")
(click-card state :runner (find-card "Bankroll" (:hand (get-runner)))))
(is (get-program state 0) "Bankroll is installed")))
(testing "Basic test - trigger on score"
(do-game
(new-game {:corp {:deck [(qty "Hedge Fund" 10)]
:hand ["House of Knives"]}
:runner {:hand ["Pantograph" "Bankroll"]}})
(play-from-hand state :corp "House of Knives" "New remote")
(take-credits state :corp)
(play-from-hand state :runner "Pantograph")
(take-credits state :runner)
(score-agenda state :corp (get-content state :remote1 0))
(changes-val-macro
1 (:credit (get-runner))
"Gain 1 credit from Pantograph"
(click-prompt state :runner "Yes"))
(changes-val-macro
-1 (:credit (get-runner))
"Gain 1 credit from Pantograph"
(click-prompt state :runner "Yes")
(click-card state :runner (find-card "Bankroll" (:hand (get-runner)))))
(is (get-program state 0) "Bankroll is installed"))))

(deftest paragon
;; Paragon - Gain 1 credit and may look at and move top card of Stack to bottom
(testing "Vanilla test"
Expand Down
Loading

0 comments on commit 48671f5

Please sign in to comment.