Skip to content

Commit

Permalink
Merge pull request #7840 from NBKelly/rejig-vs-annicam
Browse files Browse the repository at this point in the history
Rejig vs annicam
  • Loading branch information
NoahTheDuke authored Oct 29, 2024
2 parents 1e722a9 + 5500dfe commit 6349c48
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
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

0 comments on commit 6349c48

Please sign in to comment.