Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rejig vs annicam #7840

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/clj/game/cards/events.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3201,7 +3201,7 @@
:choices {:card #(and (valid-target? %)
(installed? %))}
:effect (req (move state side target :hand)
(effect-completed state side (make-result eid (:cost target))))}
(complete-with-result state side eid (:cost target)))}
put-down (fn [bonus]
{:async true
:prompt "Choose a program or piece of hardware to install"
Expand All @@ -3216,6 +3216,7 @@
:display-origin true}}))})]
{:on-play
{:req (req (some valid-target? (all-installed state :runner)))
:async true
:effect (req (wait-for (resolve-ability state side pick-up card nil)
(continue-ability state side
(put-down async-result)
Expand Down
13 changes: 13 additions & 0 deletions test/clj/game/cards/events_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6002,6 +6002,19 @@
(run-continue state)
(click-prompt state :runner "Hedge Fund"))))

(deftest rejig-vs-aniccam
;; Rejig
(do-game
(new-game {:options {:start-as :runner}
:runner {:hand ["Rejig" "Aniccam"]
:deck ["Ika"]}})
(play-from-hand state :runner "Aniccam")
(play-from-hand state :runner "Rejig")
(click-card state :runner "Aniccam")
(is-hand? state :runner ["Aniccam"])
(click-card state :runner "Aniccam")
(is-hand? state :runner ["Ika"])))

(deftest reprise
;; Reprise
(do-game
Expand Down
29 changes: 15 additions & 14 deletions test/clj/game/test_framework.clj
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,27 @@
'[game.cards.upgrades])))
(load-all-cards)

(defn is-hand?
(defn is-zone-impl
"Is the hand exactly equal to a given set of cards?"
[state side zone expected]
(let [expected (seq (sort (flatten expected)))
contents (seq (sort (map :title (get-in @state [side zone]))))]
(is' (= expected contents) (str (name zone) " is not " expected))))

(defmacro is-hand?
"Is the hand exactly equal to a given set of cards?"
[state side expected-hand]
(let [expected-hand (seq (sort (flatten expected-hand)))
hand (seq (sort (map :title (get-in @state [side :hand]))))]
(is (= expected-hand hand) (str "hand is not " expected-hand))))
`(error-wrapper (is-zone-impl ~state ~side :hand ~expected-hand)))

(defn is-deck?
"Is the discard exactly equal to a given set of cards?"
(defmacro is-deck?
"Is the hand exactly equal to a given set of cards?"
[state side expected-deck]
(let [expected-deck (seq (sort (flatten expected-deck)))
deck (seq (sort (map :title (get-in @state [side :deck]))))]
(is (= expected-deck deck) (str "deck is not " expected-deck))))
`(error-wrapper (is-zone-impl ~state ~side :deck ~expected-deck)))

(defn is-discard?
"Is the set of cards in the deck exactly equal to a given set of cards? (this is order agnostic)"
(defmacro is-discard?
"Is the hand exactly equal to a given set of cards?"
[state side expected-discard]
(let [expected-discard (seq (sort (flatten expected-discard)))
discard (seq (sort (map :title (get-in @state [side :discard]))))]
(is (= expected-discard discard) (str "discard is not " expected-discard))))
`(error-wrapper (is-zone-impl ~state ~side :discard ~expected-discard)))

;;; helper functions for prompt interaction
(defn get-prompt
Expand Down
Loading