Skip to content

Commit 1500d65

Browse files
authored
Merge pull request #6983 from butzopower/undo-click-play-area
Put cards back from play area after undoing a click
2 parents a9e38e7 + bf8e5b8 commit 1500d65

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/clj/game/core/commands.clj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@
179179
(when-let [click-state (:click-state @state)]
180180
(when (= (:active-player @state) side)
181181
(reset! state (assoc click-state :log (:log @state) :click-state click-state :run nil :history (:history @state)))
182+
(doseq [c (filter #(not (has-subtype? % "Lockdown")) (:play-area (side @state)))]
183+
(move state side c (:previous-zone c) {:suppress-event true}))
182184
(system-say state side (str "[!] " (if (= side :corp) "Corp" "Runner") " uses the undo-click command"))
183185
(doseq [s [:runner :corp]]
184186
(toast state s "Game reset to start of click")))))

test/clj/game/core/actions_test.clj

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,30 @@
4646
(is (= 4 (:click (get-runner))) "Runner back to 4 clicks")
4747
(is (= 5 (:credit (get-runner))) "Runner back to 5 credits")))
4848

49+
(deftest undo-click-return-card-from-play-area
50+
(do-game
51+
(new-game {:corp {:deck ["Predictive Planogram"]}
52+
:runner {:deck ["Dirty Laundry"]}})
53+
(play-from-hand state :corp "Predictive Planogram")
54+
(core/command-undo-click state :corp)
55+
(is (= 0 (count (:play-area (get-corp)))) "Corp play area is empty")
56+
(is (= 1 (count (:hand (get-corp)))) "Corp has 1 card in HQ")
57+
(take-credits state :corp)
58+
(play-from-hand state :runner "Dirty Laundry")
59+
(core/command-undo-click state :runner)
60+
(is (= 0 (count (:play-area (get-runner)))) "Runner play area is empty")
61+
(is (= 1 (count (:hand (get-runner)))) "Player has 1 card in grip")))
62+
63+
(deftest undo-click-does-not-return-lockdown-from-play-area
64+
(do-game
65+
(new-game {:corp {:deck ["NAPD Cordon" "Predictive Planogram"]}
66+
:runner {:deck ["Dirty Laundry"]}})
67+
(play-from-hand state :corp "NAPD Cordon")
68+
(play-from-hand state :corp "Predictive Planogram")
69+
(core/command-undo-click state :corp)
70+
(is (= 1 (count (:play-area (get-corp)))) "Corp play area still has NAPD Cordon")
71+
(is (= 1 (count (:hand (get-corp)))) "Corp has 1 card in HQ")))
72+
4973
(deftest undo-click-with-bioroid-cost
5074
(do-game
5175
(new-game {:corp {:deck [(qty "Hedge Fund" 5)]

0 commit comments

Comments
 (0)