Skip to content

Commit 6949669

Browse files
authored
Merge pull request #8502 from NBKelly/trashing-logs
Trashing logs
2 parents e09a01d + 167372c commit 6949669

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

src/clj/game/core/actions.clj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@
217217
;; default
218218
nil)))))
219219
220+
(defn trash-button
221+
[state side eid card]
222+
(system-msg state side (str "trashes " (card-str state card)))
223+
(trash state side eid card {:unpreventable true}))
224+
220225
(defn- finish-prompt [state side prompt card]
221226
(when-let [end-effect (:end-effect prompt)]
222227
(end-effect state side (make-eid state) card nil))

src/clj/game/core/process_actions.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
generate-runnable-zones move-card expend-ability
77
play play-ability play-corp-ability
88
play-dynamic-ability play-runner-ability play-subroutine play-unbroken-subroutines remove-tag
9-
resolve-prompt score select trash-resource view-deck]]
9+
resolve-prompt score select trash-button trash-resource view-deck]]
1010
[game.core.card :refer [get-card]]
1111
[game.core.change-vals :refer [change]]
1212
[game.core.checkpoint :refer [fake-checkpoint]]
@@ -107,7 +107,7 @@
107107
"system-msg" #(system-msg %1 %2 (:msg %3))
108108
"toast" #'ack-toast
109109
"toggle-auto-no-action" #'toggle-auto-no-action
110-
"trash" #(trash %1 %2 (make-eid %1) (get-card %1 (:card %3)) (dissoc %3 :card))
110+
"trash" #(trash-button %1 %2 (make-eid %1) (get-card %1 (:card %3)))
111111
"trash-resource" #'trash-resource
112112
"unbroken-subroutines" #'play-unbroken-subroutines
113113
"view-deck" #'view-deck})

test/clj/game/cards/resources_test.clj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,7 +2243,7 @@
22432243
(play-from-hand state :runner "Dummy Box")
22442244
(play-from-hand state :runner "Cache")
22452245
(take-credits state :runner)
2246-
(trash state :corp (get-program state 0))
2246+
(core/trash state :corp (core/make-eid state) (get-program state 0))
22472247
(is (not (no-prompt? state :runner)) "Dummy Box prompting to prevent program trash")
22482248
(click-prompt state :runner "Dummy Box (Program)")
22492249
(click-card state :runner (find-card "Clot" (:hand (get-runner))))
@@ -5769,13 +5769,13 @@
57695769
(play-from-hand state :runner "Motivation")
57705770
(play-from-hand state :runner "Astrolabe")
57715771
(take-credits state :runner)
5772-
(trash state :runner (get-resource state 2))
5772+
(core/trash state :runner (core/make-eid state) (get-resource state 2))
57735773
(is (no-prompt? state :runner) "Sac Con not prompting to prevent resource trash")
5774-
(trash state :runner (get-program state 0))
5774+
(core/trash state :runner (core/make-eid state) (get-program state 0))
57755775
(click-prompt state :runner "Sacrificial Construct")
57765776
(is (= 2 (count (:discard (get-runner)))) "Sac Con trashed")
57775777
(is (= 1 (count (get-program state))) "Cache still installed")
5778-
(trash state :runner (get-hardware state 0))
5778+
(core/trash state :runner (core/make-eid state) (get-hardware state 0))
57795779
(click-prompt state :runner "Sacrificial Construct")
57805780
(is (= 3 (count (:discard (get-runner)))) "Sac Con trashed")
57815781
(is (= 1 (count (get-hardware state))) "Astrolabe still installed")))

test/clj/game/core/say_test.clj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
[game.test-framework :refer :all]
1010
[jinteki.utils :refer [command-info]]))
1111

12+
(deftest trash-button-logs-in-chat
13+
(do-game
14+
(new-game {:corp {:hand ["Ice Wall"]}})
15+
(play-from-hand state :corp "Ice Wall" "HQ")
16+
(core/process-action "trash" state :corp {:card (get-ice state :hq 0)})
17+
(is (= 1 (count (:discard (get-corp)))) "trashed")
18+
(is (last-log-contains? state "trashes "))))
19+
1220
(deftest commands-are-documented-test
1321
(let [cmd-source (with-out-str (repl/source game.core.commands/parse-command))
1422
implemented-cmds (map str (re-seq #"(?<=\")\/[^ \"]*(?=\")" cmd-source))

0 commit comments

Comments
 (0)