Skip to content

Commit 83f35be

Browse files
authored
Merge pull request #7935 from NBKelly/external-subroutine-trigger-fix
External subroutine trigger fix
2 parents ee70f98 + b004815 commit 83f35be

File tree

3 files changed

+52
-21
lines changed

3 files changed

+52
-21
lines changed

src/clj/game/cards/upgrades.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@
11351135
{:prompt "Choose a subroutine"
11361136
:choices (req (unbroken-subroutines-choice ice))
11371137
:msg (msg "resolve the subroutine (\"[subroutine] "
1138-
target "\") from " (:title ice))
1138+
target "\") from " (:title ice))
11391139
:async true
11401140
:effect (req (let [sub (first (filter #(= target (make-label (:sub-effect %))) (:subroutines ice)))]
11411141
(resolve-subroutine! state side eid ice (assoc sub :external-trigger true))))})

src/clj/game/core/ice.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
([state side eid ice sub]
267267
(wait-for (trigger-event-simult state side (make-eid state eid) :pre-resolve-subroutine nil sub ice)
268268
;; this is for cards like marcus batty
269-
(when-not (:exernal-trigger sub)
269+
(when-not (:external-trigger sub)
270270
(update! state :corp (resolve-subroutine ice sub)))
271271
;; TODO - need a way to interact with multiple replacement effects.
272272
(let [replacement (:replace-subroutine (get-current-encounter state))

test/clj/game/cards/upgrades_test.clj

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,25 +2467,56 @@
24672467
(deftest marcus-batty
24682468
;; Marcus Batty
24692469
(do-game
2470-
(new-game {:corp {:deck [(qty "Hedge Fund" 5)]
2471-
:hand ["Marcus Batty" "Ice Wall"]
2472-
:credits 10}})
2473-
(play-from-hand state :corp "Ice Wall" "HQ")
2474-
(play-from-hand state :corp "Marcus Batty" "HQ")
2475-
(let [iw (get-ice state :hq 0)
2476-
mb (get-content state :hq 0)]
2477-
(rez state :corp mb)
2478-
(take-credits state :corp)
2479-
(run-on state "HQ")
2480-
(rez state :corp iw)
2481-
(card-ability state :corp mb 0)
2482-
(is (= :psi (prompt-type :corp)))
2483-
(click-prompt state :corp "1 [Credits]")
2484-
(click-prompt state :runner "0 [Credits]")
2485-
(click-card state :corp iw)
2486-
(click-prompt state :corp "End the run")
2487-
(is (not (:run @state)) "Run has ended")
2488-
(is (nil? (refresh mb)) "Marcus Batty is trashed"))))
2470+
(new-game {:corp {:deck [(qty "Hedge Fund" 5)]
2471+
:hand ["Marcus Batty" "Ice Wall"]
2472+
:credits 10}})
2473+
(play-from-hand state :corp "Ice Wall" "HQ")
2474+
(play-from-hand state :corp "Marcus Batty" "HQ")
2475+
(let [iw (get-ice state :hq 0)
2476+
mb (get-content state :hq 0)]
2477+
(rez state :corp mb)
2478+
(take-credits state :corp)
2479+
(run-on state "HQ")
2480+
(rez state :corp iw)
2481+
(card-ability state :corp mb 0)
2482+
(is (= :psi (prompt-type :corp)))
2483+
(click-prompt state :corp "1 [Credits]")
2484+
(click-prompt state :runner "0 [Credits]")
2485+
(click-card state :corp iw)
2486+
(click-prompt state :corp "End the run")
2487+
(is (not (:run @state)) "Run has ended")
2488+
(is (nil? (refresh mb)) "Marcus Batty is trashed"))))
2489+
2490+
(deftest marcus-batty-doesnt-mark-subs-as-fired
2491+
;; Marcus Batty
2492+
(do-game
2493+
(new-game {:corp {:deck [(qty "Hedge Fund" 5)]
2494+
:hand ["Marcus Batty" "Funhouse"]
2495+
:credits 10}})
2496+
(play-from-hand state :corp "Funhouse" "HQ")
2497+
(play-from-hand state :corp "Marcus Batty" "HQ")
2498+
(let [iw (get-ice state :hq 0)
2499+
mb (get-content state :hq 0)]
2500+
(rez state :corp mb)
2501+
(take-credits state :corp)
2502+
(run-on state "HQ")
2503+
(rez state :corp iw)
2504+
(run-continue state :encounter-ice)
2505+
(click-prompt state :runner "Take 1 tag")
2506+
(is (= 1 (count-tags state)))
2507+
(card-ability state :corp mb 0)
2508+
(is (= :psi (prompt-type :corp)))
2509+
(click-prompt state :corp "1 [Credits]")
2510+
(click-prompt state :runner "0 [Credits]")
2511+
(click-card state :corp iw)
2512+
(click-prompt state :corp "Give the Runner 1 tag unless they pay 4 [Credits]")
2513+
(click-prompt state :runner "Take 1 tag")
2514+
(is (= 2 (count-tags state)))
2515+
(is (not (-> iw refresh :subroutines first :fired)) "sub not considered fired (External trigger)")
2516+
(is (nil? (refresh mb)) "Marcus Batty is trashed")
2517+
(fire-subs state (refresh iw))
2518+
(click-prompt state :runner "Take 1 tag")
2519+
(is (-> iw refresh :subroutines first :fired) "sub is now considered fired (regular trigger)"))))
24892520

24902521
(deftest mason-bellamy
24912522
(do-game

0 commit comments

Comments
 (0)