Skip to content

Commit

Permalink
Merge pull request #7058 from francescopellegrini/epiphany-analytica-…
Browse files Browse the repository at this point in the history
…test
  • Loading branch information
NoahTheDuke authored Aug 13, 2023
2 parents 5d00df9 + 4dd10dc commit 84cd4d4
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 20 deletions.
46 changes: 26 additions & 20 deletions src/clj/game/cards/identities.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns game.cards.identities
(:require
[clojure.pprint :as pprint]
[clojure.string :as str]
[game.core.access :refer [access-bonus access-cost-bonus access-non-agenda]]
[game.core.bad-publicity :refer [gain-bad-publicity]]
Expand Down Expand Up @@ -579,28 +580,33 @@
:effect (req (add-counter state side card :power 1))}]
{:events [(assoc ability :event :runner-trash :req (req (valid-trash target)))
(assoc ability :event :agenda-stolen :req (req true))]
:abilities [{:label "look at the top 3 and install 1"
:abilities [{:label "Look at the top 3 cards of R&D"
:cost [:power 1 :click 1]
:effect (req (let [top (take 3 (:deck corp))]
(continue-ability
state :corp
{:prompt (msg (str "The top cards are " (str (str/join ", " (map :title top))) ". Install a card?"))
:not-distinct true
:choices (req (conj
(filter #(not (operation? %)) top)
"No Thanks"))
:msg (msg (if (= "No Thanks" target)
"decline to install a card"
(str "install the "
;; don't look at this spaghetti please
(if (= target (first top)) "first"
(if (= target (second top)) "second" "third"))
" card from R&D")))
:async true
:effect (req (if-not (= target "No Thanks")
(corp-install state side eid target nil)
(effect-completed state side eid)))}
card nil)))}]}))
(wait-for (resolve-ability state side
{:async true
:waiting-prompt true
:prompt (msg "The top cards of R&D are (top->bottom): " (enumerate-str (map :title top)))
:choices ["OK"]}
card nil)
(continue-ability
state :corp
{:prompt "Choose a card to install"
:not-distinct true
:choices (req (conj
(filter #(corp-installable-type? %) top)
"Done"))
:async true
:effect (req (if-not (= target "Done")
(do (system-msg
state side
(str "uses " (get-title card) " to install the "
(pprint/cl-format nil "~:R"
(inc (first (keep-indexed #(when (same-card? target %2) %1) top))))
" card"))
(corp-install state side eid target nil))
(effect-completed state side eid)))}
card nil))))}]}))

(defcard "Esâ Afontov: Eco-Insurrectionist"
(letfn
Expand Down
61 changes: 61 additions & 0 deletions test/clj/game/cards/identities_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[game.core-test :refer :all]
[game.utils-test :refer :all]
[game.macros-test :refer :all]
[clojure.string :as str]
[clojure.test :refer :all]))

(deftest ^{:card-title "419-amoral-scammer"}
Expand Down Expand Up @@ -1338,6 +1339,66 @@
(card-ability state :runner refr 1)
(click-card state :runner smoke)))))

(deftest epiphany-analytica-nations-undivided
(do-game
(new-game {:corp {:id "Epiphany Analytica: Nations Undivided"
:hand ["Project Atlas" "Rashida Jaheem" "Accelerated Beta Test" "Brainstorm" "Chiyashi"]}})
(play-from-hand state :corp "Rashida Jaheem" "New remote")
(play-from-hand state :corp "Project Atlas" "New remote")
(take-credits state :corp)
(let [epiph (get-in @state [:corp :identity])]
(changes-val-macro
1 (get-counters (refresh epiph) :power)
"Got 1 power counter"
(run-empty-server state "Server 1")
(click-prompt state :runner "Pay 1 [Credits] to trash"))
(changes-val-macro
0 (get-counters (refresh epiph) :power)
"Got no additional power counters"
(run-empty-server state "Server 2")
(click-prompt state :runner "Steal"))
(take-credits state :runner)
(core/move state :corp (find-card "Accelerated Beta Test" (:hand (get-corp))) :deck)
(core/move state :corp (find-card "Brainstorm" (:hand (get-corp))) :deck)
(core/move state :corp (find-card "Chiyashi" (:hand (get-corp))) :deck)
(is (= (:title (nth (-> @state :corp :deck) 0)) "Accelerated Beta Test"))
(is (= (:title (nth (-> @state :corp :deck) 1)) "Brainstorm"))
(is (= (:title (nth (-> @state :corp :deck) 2)) "Chiyashi"))
;; R&D is now from top to bottom: A B C D
(changes-val-macro
-1 (get-counters (refresh epiph) :power)
"Spend hosted power counters"
(card-ability state :corp (:identity (get-corp)) 0)
(is (str/includes? (:msg (prompt-map :corp)) "Accelerated Beta Test, Brainstorm, and Chiyashi"))
(click-prompt state :corp "OK")
(click-prompt state :corp "Brainstorm")
(click-prompt state :corp "HQ"))
(is (= "Brainstorm" (:title (get-ice state :hq 0))) "Brainstorm is installed")
(is (= (:title (nth (-> @state :corp :deck) 0)) "Accelerated Beta Test"))
(is (= (:title (nth (-> @state :corp :deck) 1)) "Chiyashi")))))

(deftest epiphany-analytica-nations-undivided-declines
(do-game
(new-game {:corp {:id "Epiphany Analytica: Nations Undivided"
:hand ["Rashida Jaheem" "Ad Blitz" "Biased Reporting" "Celebrity Gift"]}})
(play-from-hand state :corp "Rashida Jaheem" "New remote")
(take-credits state :corp)
(let [epiph (get-in @state [:corp :identity])]
(run-empty-server state "Server 1")
(click-prompt state :runner "Pay 1 [Credits] to trash")
(take-credits state :runner)
(core/move state :corp (find-card "Ad Blitz" (:hand (get-corp))) :deck)
(core/move state :corp (find-card "Biased Reporting" (:hand (get-corp))) :deck)
(core/move state :corp (find-card "Celebrity Gift" (:hand (get-corp))) :deck)
(card-ability state :corp (:identity (get-corp)) 0)
(is (str/includes? (:msg (prompt-map :corp)) "Ad Blitz, Biased Reporting, and Celebrity Gift"))
(click-prompt state :corp "OK")
(click-prompt state :corp "Done")
(is (no-prompt? state :corp))
(is (= (:title (nth (-> @state :corp :deck) 0)) "Ad Blitz"))
(is (= (:title (nth (-> @state :corp :deck) 1)) "Biased Reporting"))
(is (= (:title (nth (-> @state :corp :deck) 2)) "Celebrity Gift")))))

(deftest exile-streethawk-simultaneous-resolution-prompt-shown-for-interaction-with-customized-secretary
;; Simultaneous-resolution prompt shown for interaction with Customized Secretary
(do-game
Expand Down

0 comments on commit 84cd4d4

Please sign in to comment.