Skip to content

Commit

Permalink
messy commit DONT MERGE
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahTheDuke committed Jun 15, 2019
1 parent aa60776 commit 4b7357c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 46 deletions.
18 changes: 8 additions & 10 deletions src/clj/game/cards/agendas.clj
Original file line number Diff line number Diff line change
Expand Up @@ -777,11 +777,8 @@
:effect (effect (add-counter card :power 2))
:abilities [{:req (req (:run @state))
:counter-cost [:power 1]
:effect (req (let [ls (filter #(= "Labyrinthine Servers" (:title %)) (:scored corp))]
(jack-out-prevent state side)
(when (zero? (reduce + (for [c ls] (get-counters c :power))))
(swap! state update-in [:prevent] dissoc :jack-out))))
:msg "prevent the Runner from jacking out"}]}
:msg "prevent the Runner from jacking out"
:effect (effect (jack-out-prevent))}]}

"License Acquisition"
{:interactive (req true)
Expand Down Expand Up @@ -1033,16 +1030,17 @@
(when-let [ice (get-card state i)]
(remove-sub! state side ice #(= cid (:from-cid %))))))
(update! state side (dissoc-in card [:special :kusanagi])))}}
:abilities [{:req (req (and (ice? current-ice)
(rezzed? current-ice)
(has-subtype? current-ice "Bioroid")))
:abilities [{:label "Give a piece of ICE \"[Subroutine] Do 1 net damage\""
:prompt "Choose a piece of ICE"
:choices {:req #(and (ice? %)
(rezzed? %))}
:counter-cost [:agenda 1]
:msg (str "make a piece of ICE gain \"[Subroutine] Do 1 net damage\" "
"after all its other subroutines for the remainder of the run")
:effect (effect (add-extra-sub! (get-card state current-ice)
:effect (effect (add-extra-sub! (get-card state target)
(do-net-damage 1)
(:cid card) {:back true})
(update! (update-in card [:special :kusanagi] #(conj % current-ice))))}]}
(update! (update-in card [:special :kusanagi] #(conj % target))))}]}

"Project Vitruvius"
{:silent (req true)
Expand Down
41 changes: 23 additions & 18 deletions src/clj/game/core/runs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -909,32 +909,37 @@
(prevent-jack-out state side))

(defn- resolve-jack-out
[state side eid]
(end-run state side)
(system-msg state side "jacks out")
(trigger-event-sync state side (make-result eid true) :jack-out))
[state side eid prevented?]
(if prevented?
(effect-completed state side eid)
(do (end-run state side)
(system-msg state side "jacks out")
(trigger-event-sync state side eid :jack-out))))

(defn jack-out
"The runner decides to jack out."
([state side] (jack-out state side (make-eid state)))
([state side eid]
([state side] (jack-out state side (make-eid state) nil))
([state side eid] (jack-out state side eid nil))
([state side eid {:keys [unpreventable]}]
(swap! state update-in [:jack-out] dissoc :jack-out-prevent)
(wait-for (trigger-event-sync state side :pre-jack-out nil)
(let [prevent (get-prevent-list state :corp :jack-out)]
(if (cards-can-prevent? state :corp prevent :jack-out)
(if (and (not unpreventable)
(cards-can-prevent? state :corp prevent :jack-out))
(do (system-msg state :corp "has the option to prevent the Runner from jacking out")
(show-wait-prompt state :runner "Corp to prevent the jack out" {:priority 10})
(show-prompt state :corp nil
(str "Prevent the Runner from jacking out?") ["Done"]
(fn [_]
(clear-wait-prompt state :runner)
(if-let [_ (get-in @state [:jack-out :jack-out-prevent])]
(effect-completed state side (make-result eid false))
(do (system-msg state :corp "will not prevent the Runner from jacking out")
(resolve-jack-out state side eid))))
{:priority 10}))
(do (resolve-jack-out state side eid)
(effect-completed state side (make-result eid false))))))))
(show-prompt
state :corp nil
(str "Prevent the Runner from jacking out?") ["Done"]
(fn [_]
(let [prevented? (pos? (get-in @state [:jack-out :jack-out-prevent]))]
(clear-wait-prompt state :runner)
(system-msg state :corp
(str (if prevented? "will" "will not")
" prevent the Runner from jacking out"))
(resolve-jack-out state side eid prevented?)))
{:priority 10}))
(resolve-jack-out state side eid false))))))

(defn- trigger-run-end-events
[state side eid run]
Expand Down
36 changes: 18 additions & 18 deletions test/clj/game_test/cards/agendas.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@
(card-ability state :corp ls1 0)
(click-prompt state :corp "Done")
(is (:run @state) "Jack out prevented, run is still ongoing")
(is (true? (get-in @state [:run :cannot-jack-out])) "Cannot jack out flag is in effect")
(is (get-in @state [:run :cannot-jack-out]) "Cannot jack out flag is in effect")
(run-successful state)
(is (not (:run @state))))
(testing "one Labyrinthine is empty but the other still has one token, ensure prompt still occurs"
Expand All @@ -1382,7 +1382,7 @@
(is (:run @state))
(card-ability state :corp ls2 0)
(click-prompt state :corp "Done")
(is (true? (get-in @state [:run :cannot-jack-out])))
(is (get-in @state [:run :cannot-jack-out]))
(run-successful state)
(is (not (:run @state))))
(testing "No more tokens"
Expand Down Expand Up @@ -1973,23 +1973,23 @@
(do-game
(new-game {:corp {:deck [(qty "Project Kusanagi" 2) "Ice Wall"]}})
(play-from-hand state :corp "Ice Wall" "HQ")
(core/rez state :corp (get-ice state :hq 0))
(core/gain state :corp :click 10 :credit 10)
(testing "Should gain 0 counters"
(play-and-score state "Project Kusanagi")
(let [pk-scored (get-scored state :corp 0)]
(is (zero? (get-counters (refresh pk-scored) :agenda)) "Kusanagi should start with 0 agenda counters")))
(testing "Should gain 1 counter"
(play-from-hand state :corp "Project Kusanagi" "New remote")
(let [pk (get-content state :remote2 0)]
(advance state pk 3)
(is (= 3 (get-counters (refresh pk) :advancement)) "Kusanagi should have 3 advancement tokens")
(core/score state :corp {:card (refresh pk)}))
(let [pk-scored (get-scored state :corp 1)]
(is (= 1 (get-counters (refresh pk-scored) :agenda)) "Kusanagi should have 1 agenda counter")
(run-empty-server state :hq)
(card-ability state :corp pk-scored 0)
(is (last-log-contains? state "Do 1 net damage"))
(is (zero? (get-counters (refresh pk-scored) :agenda)) "Kusanagi should have 0 agenda counters")))))
(play-and-score state "Project Kusanagi")
(let [pk-scored (get-scored state :corp 0)]
(is (zero? (get-counters (refresh pk-scored) :agenda)) "Kusanagi should start with 0 agenda counters"))
(play-from-hand state :corp "Project Kusanagi" "New remote")
(let [pk (get-content state :remote2 0)]
(advance state pk 3)
(is (= 3 (get-counters (refresh pk) :advancement)) "Kusanagi should have 3 advancement tokens")
(core/score state :corp {:card (refresh pk)}))
(let [pk-scored (get-scored state :corp 1)]
(is (= 1 (get-counters (refresh pk-scored) :agenda)) "Kusanagi should have 1 agenda counter")
(run-empty-server state :hq)
(card-ability state :corp pk-scored 0)
(click-card state :corp (get-ice state :hq 0))
(is (last-log-contains? state "Do 1 net damage"))
(is (zero? (get-counters (refresh pk-scored) :agenda)) "Kusanagi should have 0 agenda counters"))))

(deftest project-vitruvius
;; Project Vitruvius
Expand Down

0 comments on commit 4b7357c

Please sign in to comment.