diff --git a/project.clj b/project.clj index fcc22fc0c0..ca54e290ae 100644 --- a/project.clj +++ b/project.clj @@ -23,7 +23,7 @@ [crypto-password "0.2.0"] [binaryage/devtools "0.9.7"] [digest "1.4.6"] - [http-kit "2.2.0"] + [http-kit "2.3.0"] [org.slf4j/slf4j-nop "1.7.12"] [jwarwick/trello "0.3.3"] [clj-time "0.14.2"] @@ -31,6 +31,7 @@ [throttler "1.0.0"] [clj-http "3.7.0"] [reagent "0.8.1"] + [eftest "0.1.4"] [cljsjs/react "16.4.1-0"] [cljsjs/react-dom "16.4.1-0"] [org.clojars.frozenlock/reagent-modals "0.2.8"] @@ -40,6 +41,7 @@ [lein-figwheel "0.5.16"] [com.gfredericks/lein-sha-version "0.1.1-p1"] [lein-ring "0.9.7"] + [lein-eftest "0.5.2"] [lein-exec "0.3.7"]] :profiles {:dev {:dependencies [[figwheel-sidecar "0.5.16"] @@ -49,6 +51,7 @@ :source-paths ["src/clj" "src/cljs" "src/dev" "src/cljc"]}} :aliases {"fetch" ["run" "-m" "tasks.fetch/fetch"] + "dumbrepl" ["trampoline" "run" "-m" "clojure.main/main"] "add-art" ["run" "-m" "tasks.altart/add-art"] "delete-duplicate-users" ["run" "-m" "tasks.db/delete-duplicate-users"] "card-coverage" ["run" "-m" "tasks.cards/test-coverage"]} @@ -67,6 +70,7 @@ ;; Misc :test-paths ["test/clj"] + :eftest {:report eftest.report.pretty/report} :ring {:handler web.api/app} @@ -103,6 +107,6 @@ :css-dirs ["resources/public/css"]} ;; Set timeout to 2 min to allow for full compilation after a clean. - :repl-options {:timeout 120000 + :repl-options {:timeout 180000 :init-ns web.core :init (do (use 'web.lobby) (-main "dev"))}) diff --git a/src/clj/tasks/nrdb.clj b/src/clj/tasks/nrdb.clj index 39f067b07f..c6e58440dc 100644 --- a/src/clj/tasks/nrdb.clj +++ b/src/clj/tasks/nrdb.clj @@ -9,7 +9,8 @@ [clojure.data :as data] [clojure.java.io :as io] [clojure.pprint :refer [pprint] :as pprint] - [cheshire.core :as json])) + [cheshire.core :as json] + [tasks.utils :refer [slugify]])) (declare faction-map) @@ -171,13 +172,6 @@ :cycle_position (:position c) :cycle (:name c)))) -(defn deaccent - "Remove diacritical marks from a string, from http://www.matt-reid.co.uk/blog_post.php?id=69" - [s] - (if (nil? s) "" - (let [normalized (java.text.Normalizer/normalize s java.text.Normalizer$Form/NFD)] - (string/replace normalized #"\p{InCombiningDiacriticalMarks}+" "")))) - (defn- prune-null-fields "Remove specified fields if the value is nil" [c fields] @@ -211,7 +205,7 @@ :cycle_code (:cycle_code s) :rotated (:rotated s) :image_url (get-uri c s) - :normalizedtitle (string/lower-case (deaccent (:title c))))))) + :normalizedtitle (slugify (:title c)))))) (defn fetch-data "Read NRDB json data. Modify function is mapped to all elements in the data collection." @@ -266,7 +260,7 @@ ; wait for all the GETs to complete (:status @resp))) (println "Finished downloading card art"))))) - + (defn fetch-cards "Find the NRDB card json files and import them." [download-fn {:keys [collection path] :as card-table} sets download-images] @@ -275,15 +269,22 @@ (partial add-card-fields sets) (fn [c d] true)) cards-replaced (->> cards - vals - (group-by :title) - (filter (fn [[k v]] (>= (count v) 2))) - vals - (map (fn [[c1 c2]] [(:title c1) - (if (:rotated c1) (:code c1) (:code c2)) - (if (:rotated c1) (:code c2) (:code c1))])) - (reduce rotate-cards cards))] - (spit "data/cards.json" (str cards)) + vals + (group-by :title) + (filter (fn [[k v]] (>= (count v) 2))) + vals + (map (fn [[c1 c2]] [(:title c1) + (if (:rotated c1) (:code c1) (:code c2)) + (if (:rotated c1) (:code c2) (:code c1))])) + (reduce rotate-cards cards))] + (doseq [card (vals cards-replaced)] + (let [file-name (str "data/cards/" (:normalizedtitle card) ".edn")] + (io/make-parents file-name) + ;; Below taken from https://coderwall.com/p/mxbxdq/clojure-fast-pretty-print-writes-to-file + (with-open [w (clojure.java.io/writer file-name)] + (binding [*out* w + clojure.pprint/*print-right-margin* 350] + (clojure.pprint/write (into (sorted-map) card)))))) (mc/remove db collection) (mc/insert-batch db collection (vals cards-replaced)) (when download-images diff --git a/src/clj/tasks/utils.clj b/src/clj/tasks/utils.clj new file mode 100644 index 0000000000..8a042c130a --- /dev/null +++ b/src/clj/tasks/utils.clj @@ -0,0 +1,45 @@ +(ns tasks.utils + "utilities for the tasks" + (:require [clojure.string :as string])) + +(defn type->dir + [card] + (case (:type card) + "Agenda" "agendas" + "Asset" "assets" + "Event" "events" + "Fake-Identity" "identities" + "Hardware" "hardware" + "ICE" "ice" + "Identity" "identities" + "Operation" "operations" + "Program" (if (and (:subtype card) + (> (.indexOf (:subtype card) "Icebreaker") -1)) + "icebreakers" + "programs") + "Resource" "resources" + "Upgrade" "upgrades")) + +(defn deep-merge [v & vs] + ;; Pulled from https://gist.github.com/danielpcox/c70a8aa2c36766200a95#gistcomment-2313926 + (letfn [(rec-merge [v1 v2] + (if (and (map? v1) (map? v2)) + (merge-with deep-merge v1 v2) + v2))] + (if (some identity vs) + (reduce #(rec-merge %1 %2) v vs) + v))) + +(defn slugify + "As defined here: https://you.tools/slugify/" + ([s] (slugify s "-")) + ([s sep] + (if (nil? s) "" + (as-> s s + (java.text.Normalizer/normalize s java.text.Normalizer$Form/NFD) + (string/replace s #"[\P{ASCII}]+" "") + (string/lower-case s) + (string/trim s) + (string/split s #"[\p{Space}\p{Punct}]+") + (filter seq s) + (string/join sep s))))) diff --git a/test/clj/game_test/cards/agendas.clj b/test/clj/game_test/cards/agendas.clj index 849e25b2cb..a28e1cb7e8 100644 --- a/test/clj/game_test/cards/agendas.clj +++ b/test/clj/game_test/cards/agendas.clj @@ -1,19 +1,17 @@ (ns game-test.cards.agendas (:require [game.core :as core] + [game.utils :as utils] [game-test.core :refer :all] [game-test.utils :refer :all] [game-test.macros :refer :all] [jinteki.utils :refer [count-tags]] [clojure.test :refer :all])) -(use-fixtures :once load-all-cards (partial reset-card-defs "agendas")) - (deftest ^{:card-title "15-minutes"} fifteen-minutes ;; 15 Minutes - check if it works correctly from both sides (do-game - (new-game (default-corp ["15 Minutes"]) - (default-runner)) + (new-game {:corp {:hand ["15 Minutes"]}}) (play-from-hand state :corp "15 Minutes" "New remote") (take-credits state :corp) ;; use 15 minutes to take it away from runner @@ -28,14 +26,10 @@ (card-ability state :corp (refresh fifm) 0) (is (zero? (:agenda-point (get-runner)))) (is (zero? (count (:scored (get-runner)))))) - (is (= "15 Minutes" (:title (first (:deck (get-corp)))))) - ;; TODO: could also check for deck shuffle - (is (= 2 (:click (get-corp)))) - ;; use 15 minutes to take it away from corp (hey, maybe some obscure case happens where corp would want that) - (core/click-draw state :corp 1) - (play-from-hand state :corp "15 Minutes" "New remote") - (take-credits state :runner) - (score-agenda state :corp (get-content state :remote2 0)) + (is (find-card "15 Minutes" (:deck (get-corp))))) + (do-game + (new-game {:corp {:hand ["15 Minutes"]}}) + (play-and-score state "15 Minutes") (is (= 1 (:agenda-point (get-corp)))) (is (= 1 (count (:scored (get-corp))))) (let [fifm (first (:scored (get-corp)))] @@ -43,13 +37,12 @@ (card-ability state :corp (refresh fifm) 0) (is (zero? (:agenda-point (get-corp)))) (is (zero? (count (:scored (get-corp)))))) - (is (= "15 Minutes" (:title (first (:deck (get-corp)))))))) + (is (find-card "15 Minutes" (:deck (get-corp)))))) (deftest accelerated-beta-test ;; Accelerated Beta Test (do-game - (new-game (default-corp ["Accelerated Beta Test" "Enigma" (qty "Hedge Fund" 2)]) - (default-runner)) + (new-game {:corp {:deck ["Accelerated Beta Test" "Enigma" (qty "Hedge Fund" 2)]}}) ;; Set up (starting-hand state :corp ["Accelerated Beta Test"]) (play-and-score state "Accelerated Beta Test") @@ -69,8 +62,7 @@ (deftest advanced-concept-hopper ;; Advanced Concept Hopper (do-game - (new-game (default-corp ["Advanced Concept Hopper" (qty "Hedge Fund" 4)]) - (default-runner)) + (new-game {:corp {:deck ["Advanced Concept Hopper" (qty "Hedge Fund" 4)]}}) (starting-hand state :corp ["Advanced Concept Hopper"]) (play-and-score state "Advanced Concept Hopper") (take-credits state :corp) @@ -98,8 +90,7 @@ (deftest ancestral-imager ;; Ancestral Imager (do-game - (new-game (default-corp [(qty "Ancestral Imager" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Ancestral Imager" 3)]}}) (play-and-score state "Ancestral Imager") (take-credits state :corp) (let [grip (count (:hand (get-runner)))] @@ -111,8 +102,7 @@ (deftest ar-enhanced-security ;; AR-Enhanced Security (do-game - (new-game (default-corp ["AR-Enhanced Security" (qty "NGO Front" 3)]) - (default-runner)) + (new-game {:corp {:deck ["AR-Enhanced Security" (qty "NGO Front" 3)]}}) (testing "set up" (core/gain state :corp :click 10 :credit 10) (core/gain state :runner :credit 10) @@ -144,8 +134,8 @@ (deftest armed-intimidation ;; Armed Intimidation (do-game - (new-game (default-corp [(qty "Armed Intimidation" 2)]) - (default-runner [(qty "Sure Gamble" 3) (qty "Diesel" 2)])) + (new-game {:corp {:deck [(qty "Armed Intimidation" 2)]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Diesel" 2)]}}) (play-and-score state "Armed Intimidation") (click-prompt state :runner "Take 2 tags") (is (= 2 (count-tags state)) "Runner took 2 tags from Armed Intimidation tag choice") @@ -157,8 +147,7 @@ (deftest armored-servers ;; Armored Servers (do-game - (new-game (default-corp ["Armored Servers"]) - (default-runner)) + (new-game {:corp {:deck ["Armored Servers"]}}) (play-and-score state "Armored Servers") (let [as-scored (get-scored state :corp 0)] (is (= 1 (get-counters (refresh as-scored) :agenda)) "Should start with 1 agenda counters") @@ -170,8 +159,7 @@ (deftest astroscript-pilot-program ;; AstroScript token placement (do-game - (new-game (default-corp [(qty "AstroScript Pilot Program" 3) (qty "Ice Wall" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "AstroScript Pilot Program" 3) (qty "Ice Wall" 2)]}}) (core/gain state :corp :click 3) (letfn [(try-place [from to] (card-ability state :corp (refresh from) 0) @@ -210,8 +198,7 @@ (deftest award-bait ;; Award Bait (do-game - (new-game (default-corp [(qty "Award Bait" 2) "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Award Bait" 2) "Ice Wall"]}}) (core/move state :corp (find-card "Award Bait" (:hand (get-corp))) :deck) (play-from-hand state :corp "Ice Wall" "HQ") (let [iw (get-ice state :hq 0)] @@ -235,8 +222,7 @@ ;; Bacterial Programming (testing "Scoring should not cause a run to exist for runner." (do-game - (new-game (default-corp ["Bacterial Programming" "Hedge Fund"]) - (default-runner)) + (new-game {:corp {:deck ["Bacterial Programming" "Hedge Fund"]}}) (starting-hand state :corp ["Bacterial Programming"]) (play-and-score state "Bacterial Programming") (click-prompt state :corp "Yes") @@ -248,9 +234,8 @@ (is (not (:run @state)) "No run is active"))) (testing "Removing all cards from R&D should not freeze for runner, nor give an extra access." (do-game - (new-game (default-corp [(qty "Bacterial Programming" 8)]) - (default-runner) - {:start-as :runner}) + (new-game {:corp {:deck [(qty "Bacterial Programming" 8)]} + :options {:start-as :runner}}) (starting-hand state :corp []) (run-empty-server state :rd) (click-prompt state :runner "Steal") @@ -275,9 +260,9 @@ ;; Better Citizen Program (testing "Basic test" (do-game - (new-game (default-corp ["Better Citizen Program"]) - (default-runner [(qty "The Maker's Eye" 2) - (qty "Wyrm" 2)])) + (new-game {:corp {:deck ["Better Citizen Program"]} + :runner {:deck [(qty "The Maker's Eye" 2) + (qty "Wyrm" 2)]}}) (play-and-score state "Better Citizen Program") (take-credits state :corp) (core/gain state :runner :credit 10) @@ -300,8 +285,8 @@ (run-successful state))) (testing "Should only trigger on Run events. #3619" (do-game - (new-game (default-corp ["Better Citizen Program"]) - (default-runner ["Mining Accident"])) + (new-game {:corp {:deck ["Better Citizen Program"]} + :runner {:deck ["Mining Accident"]}}) (play-and-score state "Better Citizen Program") (take-credits state :corp) (run-empty-server state "HQ") @@ -313,8 +298,7 @@ (deftest bifrost-array ;; Bifrost Array (do-game - (new-game (default-corp ["Bifrost Array" "Hostile Takeover"]) - (default-runner)) + (new-game {:corp {:deck ["Bifrost Array" "Hostile Takeover"]}}) (play-and-score state "Hostile Takeover") (is (= 12 (:credit (get-corp))) "Should gain 7 credits from 5 to 12") (is (= 1 (:bad-publicity (get-corp))) "Should gain 1 bad publicity") @@ -328,8 +312,7 @@ (deftest brain-rewiring ;; Brain Rewiring (do-game - (new-game (default-corp ["Brain Rewiring"]) - (default-runner)) + (new-game {:corp {:deck ["Brain Rewiring"]}}) (starting-hand state :runner ["Sure Gamble" "Sure Gamble"]) (play-and-score state "Brain Rewiring") (click-prompt state :corp "Yes") @@ -339,8 +322,7 @@ (deftest braintrust ;; Braintrust (do-game - (new-game (default-corp ["Braintrust" "Ichi 1.0"]) - (default-runner)) + (new-game {:corp {:deck ["Braintrust" "Ichi 1.0"]}}) (play-from-hand state :corp "Braintrust" "New remote") (let [bt (get-content state :remote1 0)] (core/add-prop state :corp bt :advance-counter 7) @@ -355,8 +337,7 @@ (deftest breaking-news ;; Breaking News (do-game - (new-game (default-corp [(qty "Breaking News" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Breaking News" 3)]}}) (play-and-score state "Breaking News") (is (= 2 (count-tags state)) "Runner receives 2 tags from Breaking News") (take-credits state :corp) @@ -366,8 +347,7 @@ ;; Broad Daylight (testing "take bad pub" (do-game - (new-game (default-corp [(qty "Broad Daylight" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Broad Daylight" 3)]}}) (is (zero? (:bad-publicity (get-corp))) "Corp start with no bad pub") (play-and-score state "Broad Daylight") (click-prompt state :corp "Yes") @@ -383,8 +363,7 @@ (is (= 2 (get-counters (get-scored state :corp 2) :agenda)) "Should gain 2 agenda counters"))) (testing "deal damage" (do-game - (new-game (default-corp ["Broad Daylight"]) - (default-runner)) + (new-game {:corp {:deck ["Broad Daylight"]}}) (core/gain state :corp :bad-publicity 3) (play-and-score state "Broad Daylight") (click-prompt state :corp "Yes") @@ -397,8 +376,7 @@ (is (= 2 (count (:discard (get-runner)))) "Runner didn't take additional damage"))) (testing "bad pub triggers" (do-game - (new-game (default-corp ["Broad Daylight" "Broadcast Square"]) - (default-runner)) + (new-game {:corp {:deck ["Broad Daylight" "Broadcast Square"]}}) (core/gain state :corp :bad-publicity 1) (play-from-hand state :corp "Broadcast Square" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -412,8 +390,7 @@ (is (= 1 (get-counters (get-scored state :corp 0) :agenda)) "Should gain 1 agenda counter"))) (testing "bad pub triggers - more cases" (do-game - (new-game (default-corp ["Broad Daylight" "Broadcast Square"]) - (default-runner)) + (new-game {:corp {:deck ["Broad Daylight" "Broadcast Square"]}}) (core/gain state :corp :bad-publicity 1) (play-from-hand state :corp "Broadcast Square" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -430,8 +407,7 @@ ;; CFC Excavation Contract (dotimes [n 5] (do-game - (new-game (default-corp ["CFC Excavation Contract" (qty "Eli 1.0" n)]) - (default-runner)) + (new-game {:corp {:deck ["CFC Excavation Contract" (qty "Eli 1.0" n)]}}) (core/gain state :corp :click 10 :credit 10) (is (= 15 (:credit (get-corp))) "Should start with 5 credits") (dotimes [_ n] @@ -445,8 +421,8 @@ (deftest character-assassination ;; Character Assassination (do-game - (new-game (default-corp ["Character Assassination"]) - (default-runner ["Fall Guy" "Kati Jones"])) + (new-game {:corp {:deck ["Character Assassination"]} + :runner {:deck ["Fall Guy" "Kati Jones"]}}) (take-credits state :corp) (play-from-hand state :runner "Kati Jones") (play-from-hand state :runner "Fall Guy") @@ -460,8 +436,7 @@ (deftest chronos-project ;; Chronos Project (do-game - (new-game (default-corp ["Chronos Project"]) - (default-runner)) + (new-game {:corp {:deck ["Chronos Project"]}}) (dotimes [_ 3] (core/move state :runner (find-card "Sure Gamble" (:hand (get-runner))) :discard)) (is (= 3 (count (:discard (get-runner)))) "Runner should have 3 cards in heap") @@ -471,8 +446,8 @@ (deftest city-works-project ;; City Works Project (do-game - (new-game (default-corp ["City Works Project"]) - (default-runner [(qty "Sure Gamble" 4)])) + (new-game {:corp {:deck ["City Works Project"]} + :runner {:deck [(qty "Sure Gamble" 4)]}}) (play-from-hand state :corp "City Works Project" "New remote") (let [cwp (get-content state :remote1 0)] (core/advance state :corp {:card (refresh cwp)}) @@ -485,8 +460,7 @@ (deftest clone-retirement ;; Clone Retirement (do-game - (new-game (default-corp [(qty "Clone Retirement" 2) "Hostile Takeover"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Clone Retirement" 2) "Hostile Takeover"]}}) (play-and-score state "Hostile Takeover") (is (= 12 (:credit (get-corp)))) (is (= 1 (:bad-publicity (get-corp)))) @@ -502,8 +476,7 @@ (deftest corporate-sales-team ;; Corporate Sales Team (do-game - (new-game (default-corp [(qty "Corporate Sales Team" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Corporate Sales Team" 2)]}}) (is (= 5 (:credit (get-corp)))) (play-and-score state "Corporate Sales Team") (let [scored-cst (get-scored state :corp 0)] @@ -519,8 +492,7 @@ (deftest corporate-war ;; Corporate War (do-game - (new-game (default-corp [(qty "Corporate War" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Corporate War" 2)]}}) (is (= 5 (:credit (get-corp)))) (play-and-score state "Corporate War") (is (zero? (:credit (get-corp))) "Lost all credits") @@ -531,8 +503,7 @@ (deftest crisis-management ;; Crisis Management (do-game - (new-game (default-corp ["Crisis Management"]) - (default-runner)) + (new-game {:corp {:deck ["Crisis Management"]}}) (play-and-score state "Crisis Management") (take-credits state :corp) (take-credits state :runner) @@ -545,9 +516,9 @@ (deftest dedicated-neural-net ;; Dedicated Neural Net (do-game - (new-game (default-corp ["Dedicated Neural Net" (qty "Scorched Earth" 2) - "Hedge Fund" "Caprice Nisei"]) - (default-runner ["HQ Interface"])) + (new-game {:corp {:deck ["Dedicated Neural Net" (qty "Scorched Earth" 2) + "Hedge Fund" "Caprice Nisei"]} + :runner {:deck ["HQ Interface"]}}) (play-from-hand state :corp "Caprice Nisei" "HQ") (play-and-score state "Dedicated Neural Net") (take-credits state :corp) @@ -579,8 +550,8 @@ ;; Degree Mill (testing "Basic behavior" (do-game - (new-game (default-corp [(qty "Degree Mill" 2)]) - (default-runner ["Ice Analyzer" "All-nighter" "Hunting Grounds"])) + (new-game {:corp {:deck [(qty "Degree Mill" 2)]} + :runner {:deck ["Ice Analyzer" "All-nighter" "Hunting Grounds"]}}) (play-from-hand state :corp "Degree Mill" "New remote") (take-credits state :corp) (is (= 0 (count (:deck (get-runner)))) "Runner starts with empty deck") @@ -625,8 +596,8 @@ (is (= 2 (count (:deck (get-runner)))) "Degree Mill didn't put cards back in deck"))))) (testing "Multiple steal costs" (do-game - (new-game (default-corp [(qty "Degree Mill" 1) (qty "Strongbox" 1)]) - (default-runner [(qty "Ice Analyzer" 3) (qty "All-nighter" 3)])) + (new-game {:corp {:deck [(qty "Degree Mill" 1) (qty "Strongbox" 1)]} + :runner {:deck [(qty "Ice Analyzer" 3) (qty "All-nighter" 3)]}}) (play-from-hand state :corp "Degree Mill" "New remote") (play-from-hand state :corp "Strongbox" "Server 1") (let [dm (get-content state :remote1 0) @@ -648,15 +619,14 @@ (is (empty? (get-resource state)) "Degree Mill removed installed cards") (is (not-empty (get-scored state :runner)) "Runner stole an agenda"))))) -(deftest director-haas'-pet-project +(deftest director-haas-pet-project ;; Director Haas' Pet Project (do-game - (new-game (default-corp ["Director Haas' Pet Project" + (new-game {:corp {:deck ["Director Haas' Pet Project" "Adonis Campaign" "Strongbox" "Eli 1.0" - (qty "Hedge Fund" 5)]) - (default-runner)) + (qty "Hedge Fund" 5)]}}) (starting-hand state :corp ["Director Haas' Pet Project" "Adonis Campaign" "Strongbox"]) (core/move state :corp (find-card "Eli 1.0" (:deck (get-corp))) :discard) (play-and-score state "Director Haas' Pet Project") @@ -668,8 +638,7 @@ (deftest domestic-sleepers ;; Domestic Sleepers (do-game - (new-game (default-corp ["Domestic Sleepers"]) - (default-runner)) + (new-game {:corp {:deck ["Domestic Sleepers"]}}) (play-and-score state "Domestic Sleepers") (core/gain state :corp :click 3) (let [ds_scored (get-scored state :corp 0)] @@ -682,8 +651,7 @@ (deftest eden-fragment ;; Test that Eden Fragment ignores the install cost of the first ice (do-game - (new-game (default-corp [(qty "Eden Fragment" 3) (qty "Ice Wall" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Eden Fragment" 3) (qty "Ice Wall" 3)]}}) (play-from-hand state :corp "Ice Wall" "HQ") (play-and-score state "Eden Fragment") (take-credits state :corp) @@ -698,9 +666,8 @@ (deftest efficiency-committee ;; Efficiency Committee (do-game - (new-game (default-corp [(qty "Efficiency Committee" 3) (qty "Shipment from SanSan" 2) - "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Efficiency Committee" 3) (qty "Shipment from SanSan" 2) + "Ice Wall"]}}) (core/gain state :corp :click 4) (play-from-hand state :corp "Efficiency Committee" "New remote") (play-from-hand state :corp "Efficiency Committee" "New remote") @@ -748,8 +715,7 @@ (deftest elective-upgrade ;; Elective Upgrade (do-game - (new-game (default-corp ["Elective Upgrade"]) - (default-runner)) + (new-game {:corp {:deck ["Elective Upgrade"]}}) (play-and-score state "Elective Upgrade") (let [eu-scored (get-scored state :corp 0)] (is (= 2 (get-counters (refresh eu-scored) :agenda)) "Should start with 2 agenda counters") @@ -764,8 +730,7 @@ (deftest encrypted-portals ;; Encrypted Portals (do-game - (new-game (default-corp ["Encrypted Portals" "Lotus Field"]) - (default-runner)) + (new-game {:corp {:deck ["Encrypted Portals" "Lotus Field"]}}) (play-from-hand state :corp "Lotus Field" "HQ") (let [lf (get-ice state :hq 0)] (core/rez state :corp lf) @@ -778,8 +743,7 @@ (deftest escalate-vitriol ;; Escalate Vitriol (do-game - (new-game (default-corp ["Escalate Vitriol"]) - (default-runner)) + (new-game {:corp {:deck ["Escalate Vitriol"]}}) (core/lose state :corp :credit 5) (play-and-score state "Escalate Vitriol") (let [ev-scored (get-scored state :corp 0)] @@ -797,8 +761,7 @@ (deftest executive-retreat ;; Executive Retreat (do-game - (new-game (default-corp ["Executive Retreat" (qty "Hedge Fund" 5)]) - (default-runner)) + (new-game {:corp {:deck ["Executive Retreat" (qty "Hedge Fund" 5)]}}) (starting-hand state :corp ["Executive Retreat" "Hedge Fund"]) (is (= 2 (count (:hand (get-corp)))) "Corp should start with 1 card in HQ") (play-and-score state "Executive Retreat") @@ -809,8 +772,7 @@ (is (zero? (get-counters (refresh er-scored) :agenda)) "Executive Retreat should have 0 agenda counters"))) (testing "Overdraw" (do-game - (new-game (default-corp ["Executive Retreat" (qty "Hedge Fund" 4)]) - (default-runner)) + (new-game {:corp {:deck ["Executive Retreat" (qty "Hedge Fund" 4)]}}) (starting-hand state :corp ["Executive Retreat" "Hedge Fund"]) (is (= 2 (count (:hand (get-corp)))) "Corp should start with 1 card in HQ") (play-and-score state "Executive Retreat") @@ -826,8 +788,7 @@ ;; Explode-a-palooza (testing "Basic test" (do-game - (new-game (default-corp ["Explode-a-palooza"]) - (default-runner)) + (new-game {:corp {:deck ["Explode-a-palooza"]}}) (play-from-hand state :corp "Explode-a-palooza" "New remote") (take-credits state :corp) (run-empty-server state :remote1) @@ -836,8 +797,8 @@ (is (= 12 (:credit (get-corp))) "Gained 5 credits"))) (testing "Interaction with The Turning Wheel. Issue #1717." (do-game - (new-game (default-corp [(qty "Explode-a-palooza" 3)]) - (default-runner ["The Turning Wheel"])) + (new-game {:corp {:deck [(qty "Explode-a-palooza" 3)]} + :runner {:deck ["The Turning Wheel"]}}) (starting-hand state :corp ["Explode-a-palooza" "Explode-a-palooza"]) (play-from-hand state :corp "Explode-a-palooza" "New remote") (take-credits state :corp) @@ -859,8 +820,7 @@ (deftest false-lead ;; False Lead (do-game - (new-game (default-corp ["False Lead"]) - (default-runner)) + (new-game {:corp {:deck ["False Lead"]}}) (play-and-score state "False Lead") (is (= 1 (count (:scored (get-corp)))) "Corp should have 1 agenda point") (take-credits state :corp) @@ -872,8 +832,8 @@ ;; Fetal AI (testing "basic test" (do-game - (new-game (default-corp [(qty "Fetal AI" 3)]) - (default-runner [(qty "Sure Gamble" 3) (qty "Diesel" 3) (qty "Quality Time" 3)])) + (new-game {:corp {:deck [(qty "Fetal AI" 3)]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Diesel" 3) (qty "Quality Time" 3)]}}) (play-from-hand state :corp "Fetal AI" "New remote") (take-credits state :corp 2) (run-empty-server state "Server 1") @@ -883,8 +843,8 @@ (is (= 1 (count (:scored (get-runner)))) "Runner stole Fetal AI")) (testing "can't afford to steal" (do-game - (new-game (default-corp [(qty "Fetal AI" 3)]) - (default-runner [(qty "Sure Gamble" 3) (qty "Diesel" 3) (qty "Quality Time" 3)])) + (new-game {:corp {:deck [(qty "Fetal AI" 3)]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Diesel" 3) (qty "Quality Time" 3)]}}) (play-from-hand state :corp "Fetal AI" "New remote") (take-credits state :corp 2) (core/lose state :runner :credit 5) @@ -896,8 +856,7 @@ (deftest fly-on-the-wall ;; Fly on the Wall - give the runner 1 tag (do-game - (new-game (default-corp ["Fly on the Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Fly on the Wall"]}}) (is (zero? (count-tags state)) "Runner starts with no tags") (play-and-score state "Fly on the Wall") (is (= 1 (count-tags state)) "Runner is tagged"))) @@ -905,9 +864,7 @@ (deftest firmware-updates ;; Firmware Updates (do-game - (new-game (default-corp ["Firmware Updates" - "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Firmware Updates" "Ice Wall"]}}) (play-and-score state "Firmware Updates") (play-from-hand state :corp "Ice Wall" "HQ") (let [fu (get-scored state :corp 0) @@ -920,12 +877,40 @@ (is (= 2 (get-counters (refresh fu) :agenda)) "Firmware Updates should now have 2 agenda counters") (is (= 1 (get-counters (refresh iw) :advancement)) "Ice Wall should have 1 advancement token")))) +(deftest fly-on-the-wall + ;; Fly on the Wall - give the runner 1 tag + (do-game + (new-game {:corp {:deck ["Fly on the Wall"]}}) + (is (zero? (:tag (get-runner))) "Runner starts with no tags") + (play-and-score state "Fly on the Wall") + (is (= 1 (:tag (get-runner))) "Runner is tagged"))) + +(deftest genetic-resequencing + ;; Genetic Resequencing + (do-game + (new-game {:corp {:deck ["Genetic Resequencing" (qty "Braintrust" 2)]}}) + (play-from-hand state :corp "Braintrust" "New remote") + (play-from-hand state :corp "Braintrust" "New remote") + (play-from-hand state :corp "Genetic Resequencing" "New remote") + (let [bt1 (get-content state :remote1 0) + bt2 (get-content state :remote2 0) + gr (get-content state :remote3 0)] + (score-agenda state :corp bt1) + (let [btscored (get-scored state :corp 0)] + (is (zero? (get-counters (refresh btscored) :agenda)) "No agenda counters on scored Braintrust") + (score-agenda state :corp gr) + (click-card state :corp bt2) + (is (zero? (get-counters (refresh bt2) :agenda)) + "No agenda counters on installed Braintrust; not a valid target") + (click-card state :corp btscored) + (is (= 1 (get-counters (refresh btscored) :agenda)) + "1 agenda counter placed on scored Braintrust"))))) + (deftest geothermal-fracking ;; Geothermal Fracking (testing "basic test" (do-game - (new-game (default-corp ["Geothermal Fracking"]) - (default-runner)) + (new-game {:corp {:deck ["Geothermal Fracking"]}}) (play-and-score state "Geothermal Fracking") (is (= 2 (:click (get-corp))) "Should have 2 clicks left") (is (= 5 (:credit (get-corp))) "Should start with 5 credits") @@ -938,8 +923,7 @@ (is (= 1 (:bad-publicity (get-corp))) "Should gain 1 bad publicity")))) (testing "prevented bad publicity shouldn't block credit gain" (do-game - (new-game (default-corp ["Geothermal Fracking" "Broadcast Square"]) - (default-runner)) + (new-game {:corp {:deck ["Geothermal Fracking" "Broadcast Square"]}}) (play-and-score state "Geothermal Fracking") (is (= 2 (:click (get-corp))) "Should have 2 clicks left") (is (= 5 (:credit (get-corp))) "Should start with 5 credits") @@ -956,33 +940,10 @@ (is (= 10 (:credit (get-corp))) "Should gain 7 credits from 3 to 10") (is (zero? (:bad-publicity (get-corp))) "Should gain 0 bad publicity from prevention"))))) -(deftest genetic-resequencing - ;; Genetic Resequencing - (do-game - (new-game (default-corp ["Genetic Resequencing" (qty "Braintrust" 2)]) - (default-runner)) - (play-from-hand state :corp "Braintrust" "New remote") - (play-from-hand state :corp "Braintrust" "New remote") - (play-from-hand state :corp "Genetic Resequencing" "New remote") - (let [bt1 (get-content state :remote1 0) - bt2 (get-content state :remote2 0) - gr (get-content state :remote3 0)] - (score-agenda state :corp bt1) - (let [btscored (get-scored state :corp 0)] - (is (zero? (get-counters (refresh btscored) :agenda)) "No agenda counters on scored Braintrust") - (score-agenda state :corp gr) - (click-card state :corp bt2) - (is (zero? (get-counters (refresh bt2) :agenda)) - "No agenda counters on installed Braintrust; not a valid target") - (click-card state :corp btscored) - (is (= 1 (get-counters (refresh btscored) :agenda)) - "1 agenda counter placed on scored Braintrust"))))) - (deftest gila-hands-arcology ;; Gila Hands Arcology (do-game - (new-game (default-corp ["Gila Hands Arcology"]) - (default-runner)) + (new-game {:corp {:deck ["Gila Hands Arcology"]}}) (play-and-score state "Gila Hands Arcology") (is (= 2 (:click (get-corp))) "Should have 2 clicks left") (is (= 5 (:credit (get-corp))) "Should start with 5 credits") @@ -998,8 +959,7 @@ (deftest glenn-station ;; Glenn Station (do-game - (new-game (default-corp ["Glenn Station" "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Glenn Station" "Ice Wall"]}}) (play-and-score state "Glenn Station") (let [gs-scored (get-scored state :corp 0)] (card-ability state :corp gs-scored 0) @@ -1012,8 +972,7 @@ (deftest global-food-initiative ;; Global Food Initiative (do-game - (new-game (default-corp [(qty "Global Food Initiative" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Global Food Initiative" 2)]}}) (testing "Corp scores" (is (zero? (:agenda-point (get-runner))) "Runner should start with 0 agenda points") (is (zero? (:agenda-point (get-corp))) "Corp should start with 0 agenda points") @@ -1030,8 +989,7 @@ (deftest government-contracts ;; Government Contracts (do-game - (new-game (default-corp ["Government Contracts"]) - (default-runner)) + (new-game {:corp {:deck ["Government Contracts"]}}) (play-and-score state "Government Contracts") (is (= 2 (:click (get-corp)))) (card-ability state :corp (get-scored state :corp 0) 0) @@ -1041,8 +999,7 @@ (deftest government-takeover ;; Government Takeover (do-game - (new-game (default-corp ["Government Takeover"]) - (default-runner)) + (new-game {:corp {:deck ["Government Takeover"]}}) (play-and-score state "Government Takeover") (is (= 5 (:credit (get-corp))) "Should start with 5 credits") (let [gt-scored (get-scored state :corp 0)] @@ -1054,9 +1011,8 @@ (letfn [(graft-test [[number-of-picks deck-size]] (let [cards ["Ice Wall" "Fire Wall" "Orion"]] (do-game - (new-game (default-corp ["Graft" "Ice Wall" - "Fire Wall" "Orion"]) - (default-runner)) + (new-game {:corp {:deck ["Graft" "Ice Wall" + "Fire Wall" "Orion"]}}) (starting-hand state :corp ["Graft"]) (play-and-score state "Graft") (dotimes [current-pick number-of-picks] @@ -1072,8 +1028,7 @@ (deftest hades-fragment ;; Hades Fragment (do-game - (new-game (default-corp ["Hades Fragment" (qty "Hedge Fund" 2)]) - (default-runner)) + (new-game {:corp {:deck ["Hades Fragment" (qty "Hedge Fund" 2)]}}) (starting-hand state :corp ["Hades Fragment"]) (play-and-score state "Hades Fragment") (take-credits state :corp) @@ -1090,10 +1045,9 @@ (deftest helium-3-deposit ;; Helium-3 Deposit (do-game - (new-game (default-corp ["Helium-3 Deposit" + (new-game {:corp {:deck ["Helium-3 Deposit" "Chief Slee" - "Ice Wall"]) - (default-runner)) + "Ice Wall"]}}) (play-from-hand state :corp "Chief Slee" "New remote") (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) @@ -1113,8 +1067,7 @@ (deftest high-risk-investment ;; High-Risk Investment (do-game - (new-game (default-corp ["High-Risk Investment"]) - (default-runner)) + (new-game {:corp {:deck ["High-Risk Investment"]}}) (play-and-score state "High-Risk Investment") (let [hri-scored (get-scored state :corp 0)] (is (= 1 (get-counters (refresh hri-scored) :agenda)) "Has 1 agenda counter") @@ -1130,8 +1083,7 @@ (deftest hollywood-renovation ;; Hollywood Renovation (do-game - (new-game (default-corp ["Hollywood Renovation" "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Hollywood Renovation" "Ice Wall"]}}) (core/gain state :corp :click 10 :credit 10) (play-from-hand state :corp "Ice Wall" "HQ") (play-from-hand state :corp "Hollywood Renovation" "New remote") @@ -1152,8 +1104,7 @@ (deftest hostile-takeover ;; Hostile Takeover (do-game - (new-game (default-corp ["Hostile Takeover"]) - (default-runner)) + (new-game {:corp {:deck ["Hostile Takeover"]}}) (play-and-score state "Hostile Takeover") (is (= 12 (:credit (get-corp))) "Gain 7 credits") (is (= 1 (:bad-publicity (get-corp))) "Take 1 bad publicity"))) @@ -1161,8 +1112,7 @@ (deftest house-of-knives ;; House of Knives (do-game - (new-game (default-corp ["House of Knives"]) - (default-runner)) + (new-game {:corp {:deck ["House of Knives"]}}) (play-and-score state "House of Knives") (let [hok-scored (get-scored state :corp 0)] (is (= 3 (get-counters (refresh hok-scored) :agenda)) "House of Knives should start with 3 counters") @@ -1181,16 +1131,14 @@ ;; Hyperloop Extension (testing "Score" (do-game - (new-game (default-corp ["Hyperloop Extension"]) - (default-runner)) + (new-game {:corp {:deck ["Hyperloop Extension"]}}) (play-from-hand state :corp "Hyperloop Extension" "New remote") (is (= 5 (:credit (get-corp))) "Corp starts with 5 credits") (score-agenda state :corp (get-content state :remote1 0)) (is (= 8 (:credit (get-corp))) "Corp gains 3 credits"))) (testing "Steal" (do-game - (new-game (default-corp ["Hyperloop Extension"]) - (default-runner)) + (new-game {:corp {:deck ["Hyperloop Extension"]}}) (play-from-hand state :corp "Hyperloop Extension" "New remote") (take-credits state :corp) (run-empty-server state "Server 1") @@ -1202,8 +1150,7 @@ ;; Ikawah Project (testing "Basic test" (do-game - (new-game (default-corp ["Ikawah Project"]) - (default-runner)) + (new-game {:corp {:deck ["Ikawah Project"]}}) (play-from-hand state :corp "Ikawah Project" "New remote") (testing "No credits" (take-credits state :corp) @@ -1238,8 +1185,7 @@ (testing "Not stealing" ;; do not reveal when the Runner does not steal from R&D (do-game - (new-game (default-corp [(qty "Ikawah Project" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Ikawah Project" 2)]}}) (take-credits state :corp) (starting-hand state :corp ["Ikawah Project"]) (run-empty-server state "R&D") @@ -1254,8 +1200,7 @@ (letfn [(illicit-sales-test [[starting-bp answer credits-gained]] (testing (str "starting with " starting-bp " and answering " answer " and gaining " credits-gained) (do-game - (new-game (default-corp ["Illicit Sales"]) - (default-runner)) + (new-game {:corp {:deck ["Illicit Sales"]}}) (let [credits (:credit (get-corp))] (core/gain state :corp :bad-publicity starting-bp) (play-and-score state "Illicit Sales") @@ -1274,8 +1219,7 @@ (deftest improved-protein-source ;; Improved Protein Source (do-game - (new-game (default-corp [(qty "Improved Protein Source" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Improved Protein Source" 2)]}}) (is (= 5 (:credit (get-runner))) "Runner starts with 5 credits") (play-and-score state "Improved Protein Source") (is (= 9 (:credit (get-runner))) "Runner should gain 4 credits from Corp scoring") @@ -1288,8 +1232,7 @@ (deftest improved-tracers ;; Improved Tracers (do-game - (new-game (default-corp ["Improved Tracers" "News Hound" "Information Overload"]) - (default-runner)) + (new-game {:corp {:deck ["Improved Tracers" "News Hound" "Information Overload"]}}) (core/gain state :corp :credit 10) (play-from-hand state :corp "News Hound" "HQ") (play-from-hand state :corp "Information Overload" "R&D") @@ -1323,8 +1266,7 @@ (deftest jumon ;; Jumon (do-game - (new-game (default-corp ["Jumon" "Ice Wall" "Crisium Grid" "Project Atlas"]) - (default-runner)) + (new-game {:corp {:deck ["Jumon" "Ice Wall" "Crisium Grid" "Project Atlas"]}}) (play-and-score state "Jumon") (play-from-hand state :corp "Ice Wall" "New remote") (play-from-hand state :corp "Project Atlas" "Server 2") @@ -1349,8 +1291,7 @@ (deftest labyrinthine-servers ;; Labyrinthine Servers (do-game - (new-game (default-corp [(qty "Labyrinthine Servers" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Labyrinthine Servers" 2)]}}) (play-and-score state "Labyrinthine Servers") (play-and-score state "Labyrinthine Servers") (take-credits state :corp) @@ -1394,10 +1335,9 @@ (deftest license-acquisition ;; License Acquisition (do-game - (new-game (default-corp [(qty "License Acquisition" 4) + (new-game {:corp {:deck [(qty "License Acquisition" 4) "Adonis Campaign" "Eve Campaign" - "Strongbox" "Corporate Troubleshooter"]) - (default-runner)) + "Strongbox" "Corporate Troubleshooter"]}}) (testing "Set up" (starting-hand state :corp ["License Acquisition" "License Acquisition" "License Acquisition" "License Acquisition" "Adonis Campaign" "Strongbox"]) @@ -1428,11 +1368,10 @@ (deftest mandatory-seed-replacement ;; Mandatory Seed Replacement (do-game - (new-game (default-corp ["Mandatory Seed Replacement" + (new-game {:corp {:deck ["Mandatory Seed Replacement" "Ice Wall" "Fire Wall" "Kakugo" "Chum" - "RSVP" "Sensei"]) - (default-runner)) + "RSVP" "Sensei"]}}) (core/click-draw state :corp 2) (core/gain state :corp :click 10 :credit 10) (play-from-hand state :corp "Ice Wall" "Archives") @@ -1465,9 +1404,8 @@ ;; Mandatory Upgrades (testing "Gain an additional click" (do-game - (new-game (default-corp ["Mandatory Upgrades" - "Melange Mining Corp."]) - (default-runner)) + (new-game {:corp {:deck ["Mandatory Upgrades" + "Melange Mining Corp."]}}) (play-and-score state "Mandatory Upgrades") (is (= 2 (:agenda-point (get-corp)))) (play-from-hand state :corp "Melange Mining Corp." "New remote") @@ -1480,9 +1418,8 @@ (is (= 1 (:click (get-corp))))))) (testing "Lose additional click if sacrificed" (do-game - (new-game (default-corp ["Mandatory Upgrades" - "Archer"]) - (default-runner)) + (new-game {:corp {:deck ["Mandatory Upgrades" + "Archer"]}}) (play-and-score state "Mandatory Upgrades") (is (= 2 (:agenda-point (get-corp)))) (play-from-hand state :corp "Archer" "HQ") @@ -1498,8 +1435,7 @@ (deftest market-research ;; Market Research (do-game - (new-game (default-corp [(qty "Market Research" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Market Research" 2)]}}) (testing "Runner is not tagged" (play-and-score state "Market Research") (is (= 2 (:agenda-point (get-corp))) "Only 4 advancements: scored for standard 2 points")) @@ -1511,8 +1447,7 @@ (deftest medical-breakthrough ;; Medical Breakthrough (do-game - (new-game (default-corp [(qty "Medical Breakthrough" 3) (qty "Hedge Fund" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Medical Breakthrough" 3) (qty "Hedge Fund" 3)]}}) (play-from-hand state :corp "Medical Breakthrough" "New remote") (play-from-hand state :corp "Medical Breakthrough" "New remote") (play-from-hand state :corp "Hedge Fund") @@ -1535,8 +1470,7 @@ (deftest merger ;; Merger (do-game - (new-game (default-corp [(qty "Merger" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Merger" 2)]}}) (play-and-score state "Merger") (is (= 2 (:agenda-point (get-corp))) "Corp should score 2 points") (play-from-hand state :corp "Merger" "New remote") @@ -1549,8 +1483,7 @@ ;; Meteor Mining (testing "when Meteor Mining is stolen" (do-game - (new-game (default-corp ["Meteor Mining"]) - (default-runner)) + (new-game {:corp {:deck ["Meteor Mining"]}}) (play-from-hand state :corp "Meteor Mining" "New remote") (take-credits state :corp) (run-empty-server state :remote1) @@ -1559,8 +1492,8 @@ (testing "when Meteor Mining is scored" (letfn [(meteor-mining-test [[tags num-choices pick creds dmg]] (do-game - (new-game (default-corp ["Meteor Mining"]) - (default-runner [(qty "Sure Gamble" 7)])) + (new-game {:corp {:deck ["Meteor Mining"]} + :runner {:deck [(qty "Sure Gamble" 7)]}}) (starting-hand state :runner (repeat 7 "Sure Gamble")) (let [credits (:credit (get-corp)) grip (count (:hand (get-runner)))] @@ -1588,8 +1521,7 @@ ;; NAPD Contract (testing "basic test" (do-game - (new-game (default-corp ["NAPD Contract"]) - (default-runner)) + (new-game {:corp {:deck ["NAPD Contract"]}}) (play-from-hand state :corp "NAPD Contract" "New remote") (let [napd (get-content state :remote1 0)] (advance state napd 2) @@ -1610,8 +1542,8 @@ (is (= 2 (:agenda-point (get-corp))) "Scored NAPD for 2 points after 5 advancements")))) (testing "scoring requirement increases with bad publicity from Corporate Scandal" (do-game - (new-game (default-corp ["NAPD Contract"]) - (default-runner ["Corporate Scandal"])) + (new-game {:corp {:deck ["NAPD Contract"]} + :runner {:deck ["Corporate Scandal"]}}) (play-from-hand state :corp "NAPD Contract" "New remote") (let [napd (get-content state :remote1 0)] (advance state napd 2) @@ -1629,8 +1561,7 @@ (deftest net-quarantine ;; Net Quarantine (do-game - (new-game (default-corp ["Net Quarantine"]) - (default-runner)) + (new-game {:corp {:deck ["Net Quarantine"]}}) (core/gain state :runner :link 1) (core/gain state :corp :click 3) (play-and-score state "Net Quarantine") @@ -1652,8 +1583,7 @@ (deftest new-construction ;; New Construction (do-game - (new-game (default-corp ["New Construction" (qty "Commercial Bankers Group" 10)]) - (default-runner)) + (new-game {:corp {:deck ["New Construction" (qty "Commercial Bankers Group" 10)]}}) (starting-hand state :corp (vec (cons "New Construction" (repeat 10 "Commercial Bankers Group")))) (core/gain state :corp :click 10 :credit 10) (play-from-hand state :corp "New Construction" "New remote") @@ -1676,8 +1606,7 @@ (deftest next-wave-2 ;; NEXT Wave 2 (do-game - (new-game (default-corp [(qty "NEXT Wave 2" 2) "NEXT Bronze"]) - (default-runner)) + (new-game {:corp {:deck [(qty "NEXT Wave 2" 2) "NEXT Bronze"]}}) (is (zero? (:brain-damage (get-runner))) "Runner should start with 0 brain damage") (play-from-hand state :corp "NEXT Bronze" "HQ") (let [nxbr (get-ice state :hq 0)] @@ -1692,8 +1621,7 @@ (deftest nisei-mk-ii ;; Nisei MK II - Remove hosted counter to ETR, check this works in 4.3 (do-game - (new-game (default-corp ["Nisei MK II"]) - (default-runner)) + (new-game {:corp {:deck ["Nisei MK II"]}}) (play-and-score state "Nisei MK II") (let [scored-nisei (get-scored state :corp 0)] (is (= 1 (get-counters (refresh scored-nisei) :agenda)) "Scored Nisei has one counter") @@ -1708,8 +1636,7 @@ (deftest oaktown-renovation ;; Oaktown Renovation (do-game - (new-game (default-corp ["Oaktown Renovation" "Shipment from SanSan"]) - (default-runner)) + (new-game {:corp {:deck ["Oaktown Renovation" "Shipment from SanSan"]}}) (core/gain state :corp :click 3) (play-from-hand state :corp "Oaktown Renovation" "New remote") (let [oak (get-content state :remote1 0)] @@ -1731,8 +1658,9 @@ (deftest obokata-protocol ;; Obotaka Protocol (do-game - (new-game (make-deck "Jinteki: Personal Evolution" [(qty "Obokata Protocol" 10)]) - (default-runner [(qty "Sure Gamble" 4)])) + (new-game {:corp {:id "Jinteki: Personal Evolution" + :deck [(qty "Obokata Protocol" 10)]} + :runner {:deck [(qty "Sure Gamble" 4)]}}) (play-from-hand state :corp "Obokata Protocol" "New remote") (take-credits state :corp) (core/gain state :runner :agenda-point 6) @@ -1746,10 +1674,10 @@ (deftest paper-trail ;; Paper Trail (do-game - (new-game (default-corp ["Paper Trail"]) - (default-runner ["Aeneas Informant" "Bank Job" + (new-game {:corp {:deck ["Paper Trail"]} + :runner {:deck ["Aeneas Informant" "Bank Job" "Rosetta 2.0" "Magnum Opus" - "Astrolabe"])) + "Astrolabe"]}}) (take-credits state :corp) (core/gain state :runner :click 10 :credit 10) (play-from-hand state :runner "Aeneas Informant") @@ -1771,9 +1699,9 @@ ;; Personality Profiles (testing "basic test" (do-game - (new-game (default-corp ["Personality Profiles"]) - (default-runner ["Self-modifying Code" "Clone Chip" - "Corroder" (qty "Patron" 2)])) + (new-game {:corp {:deck ["Personality Profiles"]} + :runner {:deck ["Self-modifying Code" "Clone Chip" + "Corroder" (qty "Patron" 2)]}}) (starting-hand state :runner ["Self-modifying Code" "Clone Chip" "Patron" "Patron"]) (play-and-score state "Personality Profiles") (take-credits state :corp) @@ -1791,9 +1719,9 @@ (is (= 3 (count (:discard (get-runner)))))))) (testing "Ensure effects still fire with an empty hand, #1840" (do-game - (new-game (default-corp ["Personality Profiles"]) - (default-runner ["Self-modifying Code" "Clone Chip" - "Corroder"])) + (new-game {:corp {:deck ["Personality Profiles"]} + :runner {:deck ["Self-modifying Code" "Clone Chip" + "Corroder"]}}) (starting-hand state :runner ["Self-modifying Code" "Clone Chip"]) (play-and-score state "Personality Profiles") (take-credits state :corp) @@ -1817,8 +1745,8 @@ (deftest philotic-entanglement ;; Philotic Entanglement (do-game - (new-game (default-corp ["Philotic Entanglement" (qty "House of Knives" 3)]) - (default-runner [(qty "Sure Gamble" 3) (qty "Cache" 2)])) + (new-game {:corp {:deck ["Philotic Entanglement" (qty "House of Knives" 3)]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Cache" 2)]}}) (play-from-hand state :corp "House of Knives" "New remote") (play-from-hand state :corp "House of Knives" "New remote") (play-from-hand state :corp "House of Knives" "New remote") @@ -1839,8 +1767,7 @@ ;; Posted Bounty (testing "Forfeiting takes 1 bad publicity" (do-game - (new-game (default-corp ["Posted Bounty"]) - (default-runner)) + (new-game {:corp {:deck ["Posted Bounty"]}}) (play-and-score state "Posted Bounty") (click-prompt state :corp "Yes") (is (zero? (:agenda-point (get-corp))) "Forfeiting Posted Bounty nullifies agenda points") @@ -1848,8 +1775,7 @@ (is (= 1 (count-tags state)) "Runner receives 1 tag forfeiting Posted Bounty"))) (testing "Choosing not to forfeit scores normally" (do-game - (new-game (default-corp ["Posted Bounty"]) - (default-runner)) + (new-game {:corp {:deck ["Posted Bounty"]}}) (play-and-score state "Posted Bounty") (click-prompt state :corp "No") (is (= 1 (:agenda-point (get-corp)))) @@ -1859,8 +1785,7 @@ (deftest priority-requisition ;; Priority Requisition (do-game - (new-game (default-corp ["Priority Requisition" "Archer"]) - (default-runner)) + (new-game {:corp {:deck ["Priority Requisition" "Archer"]}}) (play-from-hand state :corp "Archer" "HQ") (let [arc (get-ice state :hq 0)] (play-and-score state "Priority Requisition") @@ -1870,8 +1795,7 @@ (deftest private-security-force ;; Private Security Force (do-game - (new-game (default-corp [(qty "Private Security Force" 10)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Private Security Force" 10)]}}) (core/gain-tags state :runner 1) (play-and-score state "Private Security Force") (let [psf-scored (get-scored state :corp 0)] @@ -1887,8 +1811,7 @@ (deftest profiteering ;; Profiteering (do-game - (new-game (default-corp ["Profiteering"]) - (default-runner)) + (new-game {:corp {:deck ["Profiteering"]}}) (play-and-score state "Profiteering") (click-prompt state :corp "3") (is (= 1 (:agenda-point (get-corp)))) @@ -1898,8 +1821,8 @@ (deftest project-ares ;; Project Ares (do-game - (new-game (default-corp [(qty "Project Ares" 2)]) - (default-runner ["Clone Chip"])) + (new-game {:corp {:deck [(qty "Project Ares" 2)]} + :runner {:deck ["Clone Chip"]}}) (take-credits state :corp) (play-from-hand state :runner "Clone Chip") (take-credits state :runner) @@ -1921,9 +1844,8 @@ ;; Project Atlas (testing "basic test" (do-game - (new-game (default-runner ["Project Atlas" - "Beanstalk Royalties"]) - (default-runner)) + (new-game {:corp {:deck ["Project Atlas" + "Beanstalk Royalties"]}}) ;; Set up (starting-hand state :corp ["Project Atlas"]) (is (= 1 (count (:hand (get-corp)))) "Corp should have 1 cards in hand") @@ -1942,9 +1864,8 @@ (is (= 1 (count (:hand (get-corp)))) "Corp should have 1 cards in hand")))) (testing "test with Titan" (do-game - (new-game (make-deck "Titan Transnational: Investing In Your Future" - [(qty "Project Atlas" 2) "Beanstalk Royalties" "Hedge Fund"]) - (default-runner)) + (new-game {:corp {:id "Titan Transnational: Investing In Your Future" + :deck [(qty "Project Atlas" 2) "Beanstalk Royalties" "Hedge Fund"]}}) ;; Set up (starting-hand state :corp ["Project Atlas" "Project Atlas"]) (is (= 2 (count (:hand (get-corp)))) "Corp should have 2 cards in hand") @@ -1977,8 +1898,7 @@ (deftest project-beale ;; Project Beale (do-game - (new-game (default-corp [(qty "Project Beale" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Project Beale" 2)]}}) (core/gain state :corp :click 8 :credit 8) (play-from-hand state :corp "Project Beale" "New remote") (let [pb1 (get-content state :remote1 0)] @@ -1994,8 +1914,7 @@ (deftest project-kusanagi ;; Project Kusanagi (do-game - (new-game (default-corp [(qty "Project Kusanagi" 2) "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Project Kusanagi" 2) "Ice Wall"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (core/gain state :corp :click 10 :credit 10) (testing "Should gain 0 counters" @@ -2018,9 +1937,8 @@ (deftest project-vitruvius ;; Project Vitruvius (do-game - (new-game (default-corp ["Project Vitruvius" - "Hedge Fund"]) - (default-runner)) + (new-game {:corp {:deck ["Project Vitruvius" + "Hedge Fund"]}}) ;; Set up (core/move state :corp (find-card "Hedge Fund" (:hand (get-corp))) :discard) (is (= 1 (count (:discard (get-corp)))) "Corp should have 1 cards in hand") @@ -2042,10 +1960,9 @@ (deftest project-wotan ;; Project Wotan - Only checks if agenda counter is spent (do-game - (new-game (default-corp ["Project Wotan" + (new-game {:corp {:deck ["Project Wotan" "Eli 1.0" - (qty "Hedge Fund" 3)]) - (default-runner)) + (qty "Hedge Fund" 3)]}}) (starting-hand state :corp ["Project Wotan" "Eli 1.0"]) (play-from-hand state :corp "Eli 1.0" "HQ") (let [eli (get-ice state :hq 0)] @@ -2061,8 +1978,7 @@ (deftest puppet-master ;; Puppet Master - game progresses if no valid targets. Issue #1661. (do-game - (new-game (default-corp ["Puppet Master"]) - (default-runner)) + (new-game {:corp {:deck ["Puppet Master"]}}) (play-and-score state "Puppet Master") (take-credits state :corp) (run-empty-server state :archives) @@ -2072,8 +1988,7 @@ (deftest quantum-predictive-model ;; Quantum Predictive Model (do-game - (new-game (default-corp [(qty "Quantum Predictive Model" 4)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Quantum Predictive Model" 4)]}}) (testing "Set up" (starting-hand state :corp ["Quantum Predictive Model" "Quantum Predictive Model"]) (play-from-hand state :corp "Quantum Predictive Model" "New remote") @@ -2107,9 +2022,8 @@ (deftest rebranding-team ;; Rebranding Team (do-game - (new-game (default-corp ["Rebranding Team" "Launch Campaign" "City Surveillance" - "Jackson Howard" "Museum of History" "Advanced Assembly Lines"]) - (default-runner)) + (new-game {:corp {:deck ["Rebranding Team" "Launch Campaign" "City Surveillance" + "Jackson Howard" "Museum of History" "Advanced Assembly Lines"]}}) (play-and-score state "Rebranding Team") (core/click-draw state :runner 1) (is (core/has-subtype? (find-card "Advanced Assembly Lines" (:hand (get-corp))) "Advertisement")) @@ -2137,10 +2051,10 @@ ;; Reeducation (testing "Simple test" (do-game - (new-game (default-corp ["Reeducation" "Sweeps Week" "Hedge Fund" - "Jackson Howard" "Gutenberg"]) - (default-runner ["Self-modifying Code" "Clone Chip" - "Corroder" "Sure Gamble" "Desperado"])) + (new-game {:corp {:deck ["Reeducation" "Sweeps Week" "Hedge Fund" + "Jackson Howard" "Gutenberg"]} + :runner {:deck ["Self-modifying Code" "Clone Chip" + "Corroder" "Sure Gamble" "Desperado"]}}) (starting-hand state :corp ["Reeducation" "Sweeps Week"]) (starting-hand state :runner ["Self-modifying Code"]) (play-and-score state "Reeducation") @@ -2158,10 +2072,10 @@ ;; If Corp is adding more cards in HQ than Runner has in their Grip, Runner ;; is not 'able' to resolve the effect and doesn't have to add to bottom of Stack (do-game - (new-game (default-corp ["Reeducation" "Sweeps Week" "Hedge Fund" - "Jackson Howard" "Gutenberg"]) - (default-runner ["Self-modifying Code" "Clone Chip" - "Corroder" "Sure Gamble" "Desperado"])) + (new-game {:corp {:deck ["Reeducation" "Sweeps Week" "Hedge Fund" + "Jackson Howard" "Gutenberg"]} + :runner {:deck ["Self-modifying Code" "Clone Chip" + "Corroder" "Sure Gamble" "Desperado"]}}) (starting-hand state :corp ["Reeducation" "Sweeps Week" "Hedge Fund"]) (starting-hand state :runner ["Self-modifying Code"]) (play-and-score state "Reeducation") @@ -2181,8 +2095,7 @@ (deftest remote-data-farm ;; Remote Data Farm (do-game - (new-game (default-corp ["Remote Data Farm"]) - (default-runner)) + (new-game {:corp {:deck ["Remote Data Farm"]}}) (is (= 5 (get-hand-size :corp))) (play-and-score state "Remote Data Farm") (is (= 7 (get-hand-size :corp))))) @@ -2190,34 +2103,33 @@ (deftest remote-enforcement ;; Remote Enforcement - Search R&D for a piece of ice and install it on a remote at no rez cost (do-game - (new-game (default-corp [(qty "Remote Enforcement" 2) - "Archer" - "Chiyashi"]) - (make-deck "Reina Roja: Freedom Fighter" [])) - (starting-hand state :corp ["Remote Enforcement" "Remote Enforcement"]) - (is (= 2 (count (:deck (get-corp))))) - (play-and-score state "Remote Enforcement") - (let [N (:credit (get-corp))] - (click-prompt state :corp "Yes") - (click-prompt state :corp (find-card "Chiyashi" (:deck (get-corp)))) - (click-prompt state :corp "New remote") - (is (core/rezzed? (get-ice state :remote2 0)) "Chiyashi was installed rezzed") - (is (= N (:credit (get-corp))) "Rezzing Chiyashi was free")) - (play-and-score state "Remote Enforcement") - (let [N (:credit (get-corp))] - (click-prompt state :corp "Yes") - (click-prompt state :corp (find-card "Archer" (:deck (get-corp)))) - (click-prompt state :corp "Server 2") - (is (= (dec N) (:credit (get-corp))) "Installing Archer cost a credit") - (is (not-empty (:prompt (get-corp))) "Corp prompted to forfeit an agenda for Archer") - (is (= (dec N) (:credit (get-corp))) "Rezzing Archer didn't cost any credits")))) + (new-game {:corp {:deck [(qty "Remote Enforcement" 2) + "Archer" + "Chiyashi"]} + :runner {:id "Reina Roja: Freedom Fighter"}}) + (starting-hand state :corp ["Remote Enforcement" "Remote Enforcement"]) + (is (= 2 (count (:deck (get-corp))))) + (play-and-score state "Remote Enforcement") + (let [N (:credit (get-corp))] + (click-prompt state :corp "Yes") + (click-prompt state :corp (find-card "Chiyashi" (:deck (get-corp)))) + (click-prompt state :corp "New remote") + (is (core/rezzed? (get-ice state :remote2 0)) "Chiyashi was installed rezzed") + (is (= N (:credit (get-corp))) "Rezzing Chiyashi was free")) + (play-and-score state "Remote Enforcement") + (let [N (:credit (get-corp))] + (click-prompt state :corp "Yes") + (click-prompt state :corp (find-card "Archer" (:deck (get-corp)))) + (click-prompt state :corp "Server 2") + (is (= (dec N) (:credit (get-corp))) "Installing Archer cost a credit") + (is (not-empty (:prompt (get-corp))) "Corp prompted to forfeit an agenda for Archer") + (is (= (dec N) (:credit (get-corp))) "Rezzing Archer didn't cost any credits")))) (deftest research-grant ;; Research Grant (testing "Basic test" (do-game - (new-game (default-corp [(qty "Research Grant" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Research Grant" 2)]}}) (play-from-hand state :corp "Research Grant" "New remote") (play-and-score state "Research Grant") (click-card state :corp (get-content state :remote1 0)) @@ -2225,8 +2137,9 @@ (testing "vs Leela" ;; Issue #3069 (do-game - (new-game (default-corp [(qty "Research Grant" 2) (qty "Ice Wall" 2)]) - (make-deck "Leela Patel: Trained Pragmatist" ["Sure Gamble"])) + (new-game {:corp {:deck [(qty "Research Grant" 2) (qty "Ice Wall" 2)]} + :runner {:id "Leela Patel: Trained Pragmatist" + :deck ["Sure Gamble"]}}) (core/gain state :corp :click 1) (play-from-hand state :corp "Ice Wall" "HQ") (play-from-hand state :corp "Ice Wall" "R&D") @@ -2241,8 +2154,7 @@ (deftest restructured-datapool ;; Restructured Datapool (do-game - (new-game (default-corp ["Restructured Datapool"]) - (default-runner)) + (new-game {:corp {:deck ["Restructured Datapool"]}}) (is (zero? (count-tags state)) "Runner should start with no tags") (play-and-score state "Restructured Datapool") (let [rd-scored (get-scored state :corp 0)] @@ -2254,8 +2166,7 @@ (deftest self-destruct-chips ;; Self-Destruct Chips (do-game - (new-game (default-corp ["Self-Destruct Chips"]) - (default-runner)) + (new-game {:corp {:deck ["Self-Destruct Chips"]}}) (is (= 5 (get-hand-size :runner)) "Runner's hand size starts at 5") (play-and-score state "Self-Destruct Chips") (is (= 4 (get-hand-size :runner)) "By scoring Self-Destruct Chips, Runner's hand size is reduced by 1"))) @@ -2263,8 +2174,7 @@ (deftest sensor-net-activation ;; Sensor Net Activation (do-game - (new-game (default-corp [(qty "Sensor Net Activation" 2) "Enforcer 1.0" "Ash 2X3ZB9CY"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Sensor Net Activation" 2) "Enforcer 1.0" "Ash 2X3ZB9CY"]}}) (play-from-hand state :corp "Enforcer 1.0" "HQ") (play-and-score state "Sensor Net Activation") (let [sna-scored (get-scored state :corp 0) @@ -2294,8 +2204,8 @@ (deftest sentinel-defense-program ;; Sentinel Defense Program - Doesn't fire if brain damage is prevented (do-game - (new-game (default-corp ["Sentinel Defense Program" "Viktor 1.0"]) - (default-runner ["Feedback Filter" (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Sentinel Defense Program" "Viktor 1.0"]} + :runner {:deck ["Feedback Filter" (qty "Sure Gamble" 3)]}}) (play-and-score state "Sentinel Defense Program") (play-from-hand state :corp "Viktor 1.0" "HQ") (take-credits state :corp) @@ -2319,8 +2229,7 @@ (deftest show-of-force ;; Show of Force (do-game - (new-game (default-corp ["Show of Force"]) - (default-runner)) + (new-game {:corp {:deck ["Show of Force"]}}) (is (= 3 (count (:hand (get-runner)))) "Runner should start with 3 cards in hand") (play-and-score state "Show of Force") (is (= 1 (count (:hand (get-runner)))) "Runner should have 1 card in hand") @@ -2330,8 +2239,7 @@ ;; SSL Endorsement (testing "gain credits when in corp score area before turn begins" (do-game - (new-game (default-corp ["SSL Endorsement"]) - (default-runner)) + (new-game {:corp {:deck ["SSL Endorsement"]}}) (play-and-score state "SSL Endorsement") (take-credits state :runner) (is (not-empty (:prompt (get-corp))) "Corp prompted to take credits") @@ -2354,8 +2262,7 @@ (is (empty? (:prompt (get-corp))) "Not prompted when out of money"))) (testing "gain credits when in runner score area before turn begins" (do-game - (new-game (default-corp ["SSL Endorsement"]) - (default-runner)) + (new-game {:corp {:deck ["SSL Endorsement"]}}) (play-from-hand state :corp "SSL Endorsement" "New remote") (take-credits state :corp) (run-on state "Server 1") @@ -2383,8 +2290,8 @@ (testing "register event when agenda swapped with Turntable" ;; Regression test for #3114 (do-game - (new-game (default-corp ["SSL Endorsement" "Breaking News"]) - (default-runner ["Turntable"])) + (new-game {:corp {:deck ["SSL Endorsement" "Breaking News"]} + :runner {:deck ["Turntable"]}}) (play-from-hand state :corp "Breaking News" "New remote") (play-and-score state "SSL Endorsement") (take-credits state :corp) @@ -2401,9 +2308,8 @@ (is (= 9 (:credit (get-corp))) "Corp gains 3 credits from Turntable'd SSL Endorsement"))) (testing "don't double register event when agenda is swapped" (do-game - (new-game (default-corp ["SSL Endorsement" "Breaking News" - "Exchange of Information"]) - (default-runner)) + (new-game {:corp {:deck ["SSL Endorsement" "Breaking News" + "Exchange of Information"]}}) (play-from-hand state :corp "SSL Endorsement" "New remote") (play-and-score state "Breaking News") (take-credits state :corp) @@ -2439,8 +2345,8 @@ ;; Standoff (testing "Runner declines first" (do-game - (new-game (default-corp ["Standoff" "Ice Wall" "News Team"]) - (default-runner ["Cache"])) + (new-game {:corp {:deck ["Standoff" "Ice Wall" "News Team"]} + :runner {:deck ["Cache"]}}) (starting-hand state :corp ["Standoff" "Ice Wall"]) (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) @@ -2461,8 +2367,8 @@ (is (= 1 (-> (get-corp) :hand count)) "Corp should draw a card from Runner declining to trash an installed card")))) (testing "Corp declines first" (do-game - (new-game (default-corp ["Standoff" "Ice Wall" "News Team"]) - (default-runner ["Cache" "Cache"])) + (new-game {:corp {:deck ["Standoff" "Ice Wall" "News Team"]} + :runner {:deck ["Cache" "Cache"]}}) (starting-hand state :corp ["Standoff" "Ice Wall"]) (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) @@ -2488,8 +2394,7 @@ (deftest successful-field-test ;; Successful Field Test (do-game - (new-game (default-corp ["Successful Field Test" (qty "Ice Wall" 10)]) - (default-runner)) + (new-game {:corp {:deck ["Successful Field Test" (qty "Ice Wall" 10)]}}) (starting-hand state :corp (vec (cons "Successful Field Test" (repeat 10 "Ice Wall")))) (is (= 5 (:credit (get-corp))) "Should start with 5 credits") (play-and-score state "Successful Field Test") @@ -2502,8 +2407,7 @@ (deftest superior-cyberwalls ;; Superior Cyberwalls (do-game - (new-game (default-corp ["Superior Cyberwalls" "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Superior Cyberwalls" "Ice Wall"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (let [iw (get-ice state :hq 0)] (core/rez state :corp iw) @@ -2517,8 +2421,7 @@ ;; TGTBT - Give the Runner 1 tag when they access ;; OHG still not working... (do-game - (new-game (default-corp [(qty "TGTBT" 2) "Old Hollywood Grid"]) - (default-runner)) + (new-game {:corp {:deck [(qty "TGTBT" 2) "Old Hollywood Grid"]}}) (play-from-hand state :corp "TGTBT" "New remote") (play-from-hand state :corp "Old Hollywood Grid" "Server 1") (play-from-hand state :corp "TGTBT" "New remote") @@ -2543,16 +2446,16 @@ ;; The Cleaners (testing "Basic test" (do-game - (new-game (default-corp ["The Cleaners" "Scorched Earth"]) - (default-runner [(qty "Sure Gamble" 3) (qty "Diesel" 3)])) + (new-game {:corp {:deck ["The Cleaners" "Scorched Earth"]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Diesel" 3)]}}) (play-and-score state "The Cleaners") (core/gain-tags state :runner 1) (play-from-hand state :corp "Scorched Earth") (is (zero? (count (:hand (get-runner)))) "5 damage dealt to Runner"))) (testing "No bonus damage when runner 'suffers' damage, ie Cybernetics" (do-game - (new-game (default-corp ["The Cleaners"]) - (default-runner [(qty "Respirocytes" 3)])) + (new-game {:corp {:deck ["The Cleaners"]} + :runner {:deck [(qty "Respirocytes" 3)]}}) (play-and-score state "The Cleaners") (take-credits state :corp) (play-from-hand state :runner "Respirocytes") @@ -2562,8 +2465,7 @@ ;; The Future is Now (testing "With at least one card in deck" (do-game - (new-game (default-corp ["The Future is Now" "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["The Future is Now" "Ice Wall"]}}) (starting-hand state :corp ["The Future is Now"]) (is (= 1 (count (:hand (get-corp))))) (is (= 1 (count (:deck (get-corp))))) @@ -2573,8 +2475,7 @@ (is (zero? (count (:deck (get-corp))))))) (testing "With an empty deck" (do-game - (new-game (default-corp ["The Future is Now"]) - (default-runner)) + (new-game {:corp {:deck ["The Future is Now"]}}) (is (= 1 (count (:hand (get-corp))))) (is (zero? (count (:deck (get-corp))))) (play-and-score state "The Future is Now") @@ -2585,8 +2486,7 @@ (deftest the-future-perfect ;; The Future Perfect (do-game - (new-game (default-corp [(qty "The Future Perfect" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "The Future Perfect" 2)]}}) (play-from-hand state :corp "The Future Perfect" "New remote") (take-credits state :corp) (testing "No steal on not-equal Psi game" @@ -2610,8 +2510,7 @@ (deftest underway-renovation ;; Underway Renovation (do-game - (new-game (default-corp ["Underway Renovation" "Shipment from SanSan"]) - (default-runner)) + (new-game {:corp {:deck ["Underway Renovation" "Shipment from SanSan"]}}) (core/gain state :corp :click 2) (starting-hand state :runner []) (play-from-hand state :corp "Underway Renovation" "New remote") @@ -2637,8 +2536,7 @@ (deftest unorthodox-predictions ;; Unorthodox Predictions (do-game - (new-game (default-corp ["Unorthodox Predictions"]) - (default-runner)) + (new-game {:corp {:deck ["Unorthodox Predictions"]}}) (play-and-score state "Unorthodox Predictions") (click-prompt state :corp "Barrier") (is (last-log-contains? state "Barrier")))) @@ -2646,9 +2544,8 @@ (deftest utopia-fragment ;; Utopia Fragment (do-game - (new-game (default-corp ["Utopia Fragment" - "Hostile Takeover"]) - (default-runner)) + (new-game {:corp {:deck ["Utopia Fragment" + "Hostile Takeover"]}}) (play-and-score state "Utopia Fragment") (play-from-hand state :corp "Hostile Takeover" "New remote") (advance state (get-content state :remote2 0)) @@ -2663,8 +2560,7 @@ (deftest vanity-project ;; Vanity Project (do-game - (new-game (default-corp ["Vanity Project"]) - (default-runner)) + (new-game {:corp {:deck ["Vanity Project"]}}) (play-and-score state "Vanity Project") (is (= 4 (:agenda-point (get-corp)))))) @@ -2672,8 +2568,7 @@ ;; Veterans Program (testing "Veterans Program basic test" (do-game - (new-game (default-corp [(qty "Hostile Takeover" 2) "Veterans Program"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Hostile Takeover" 2) "Veterans Program"]}}) (play-and-score state "Hostile Takeover") (play-and-score state "Hostile Takeover") (is (= 19 (:credit (get-corp))) "Should gain 14 credits from 5 to 19") @@ -2682,8 +2577,7 @@ (is (zero? (:bad-publicity (get-corp))) "Should lose 2 bad publicity"))) (testing "Removes _up to 2_ bad publicity" (do-game - (new-game (default-corp ["Hostile Takeover" "Veterans Program"]) - (default-runner)) + (new-game {:corp {:deck ["Hostile Takeover" "Veterans Program"]}}) (play-and-score state "Hostile Takeover") (is (= 12 (:credit (get-corp))) "Should gain 7 credits from 5 to 12") (is (= 1 (:bad-publicity (get-corp))) "Should gain 1 bad publicity") @@ -2694,8 +2588,8 @@ ;; Viral Weaponization - at the end of turn scored, do 1 net damage for each card in grip (testing "Score on corp turn" (do-game - (new-game (default-corp [(qty "Viral Weaponization" 2)]) - (default-runner [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Viral Weaponization" 2)]} + :runner {:deck [(qty "Sure Gamble" 3)]}}) (starting-hand state :runner ["Sure Gamble" "Sure Gamble"]) (play-and-score state "Viral Weaponization") (is (= 2 (count (:hand (get-runner)))) "Runner doesn't take damage when scored") @@ -2713,8 +2607,8 @@ (is (zero? (count (:hand (get-runner)))) "Runner's hand is empty"))) (testing "Score on runners turn" (do-game - (new-game (default-corp ["Viral Weaponization" "Plan B"]) - (default-runner [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Viral Weaponization" "Plan B"]} + :runner {:deck [(qty "Sure Gamble" 3)]}}) (starting-hand state :runner ["Sure Gamble" "Sure Gamble"]) (play-from-hand state :corp "Plan B" "New remote") (core/add-prop state :corp (get-content state :remote1 0) :advance-counter 4) @@ -2733,8 +2627,7 @@ ;; Voting Machine Initiative (testing "Voting Machine Initiative" (do-game - (new-game (default-corp ["Voting Machine Initiative"]) - (default-runner)) + (new-game {:corp {:deck ["Voting Machine Initiative"]}}) (letfn [(vmi-test [vmi choice counter] (let [diff (if (= "Yes" choice) 1 0)] (is (= counter (get-counters (refresh vmi) :agenda))) @@ -2756,8 +2649,7 @@ (deftest vulcan-coverup ;; Vulcan Coverup (do-game - (new-game (default-corp [(qty "Vulcan Coverup" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Vulcan Coverup" 2)]}}) (play-from-hand state :corp "Vulcan Coverup" "New remote") (take-credits state :corp) (run-empty-server state :remote1) @@ -2770,8 +2662,8 @@ (deftest water-monopoly ;; Water Monopoly (do-game - (new-game (default-corp ["Water Monopoly"]) - (default-runner ["Fan Site" "Levy Advanced Research Lab"])) + (new-game {:corp {:deck ["Water Monopoly"]} + :runner {:deck ["Fan Site" "Levy Advanced Research Lab"]}}) (play-and-score state "Water Monopoly") (take-credits state :corp) (is (= 5 (:credit (get-runner))) "Runner should start with 5 credits") diff --git a/test/clj/game_test/cards/assets.clj b/test/clj/game_test/cards/assets.clj index 514e2d0e81..7ccfcb651a 100644 --- a/test/clj/game_test/cards/assets.clj +++ b/test/clj/game_test/cards/assets.clj @@ -1,18 +1,16 @@ (ns game-test.cards.assets (:require [game.core :as core] + [game.utils :as utils] [game-test.core :refer :all] [game-test.utils :refer :all] [game-test.macros :refer :all] [jinteki.utils :refer [count-tags]] [clojure.test :refer :all])) -(use-fixtures :once load-all-cards (partial reset-card-defs "assets")) - (deftest adonis-campaign ;; Adonis Campaign (do-game - (new-game (default-corp ["Adonis Campaign"]) - (default-runner)) + (new-game {:corp {:deck ["Adonis Campaign"]}}) (play-from-hand state :corp "Adonis Campaign" "New remote") (let [ac (get-content state :remote1 0)] (core/rez state :corp ac) @@ -28,9 +26,8 @@ (deftest advanced-assembly-lines ;; Advanced Assembly Lines (do-game - (new-game (default-corp ["Advanced Assembly Lines" - "PAD Campaign"]) - (default-runner)) + (new-game {:corp {:deck ["Advanced Assembly Lines" + "PAD Campaign"]}}) (play-from-hand state :corp "Advanced Assembly Lines" "New remote") (let [aal (get-content state :remote1 0) credits (:credit (get-corp)) @@ -45,9 +42,8 @@ (deftest aggressive-secretary ;; Aggressive Secretary (do-game - (new-game - (default-corp ["Aggressive Secretary"]) - (default-runner [(qty "Cache" 3)])) + (new-game {:corp {:deck ["Aggressive Secretary"]} + :runner {:deck [(qty "Cache" 3)]}}) (play-from-hand state :corp "Aggressive Secretary" "New remote") (let [as (get-content state :remote1 0)] ;; Single advance AggSec @@ -69,10 +65,8 @@ (deftest alexa-belsky ;; Alexa Belsky (do-game - (new-game - (default-corp ["Alexa Belsky" "Hedge Fund" "Breaking News" - "Gutenberg" "Product Placement" "Jackson Howard"]) - (default-runner)) + (new-game {:corp {:deck ["Alexa Belsky" "Hedge Fund" "Breaking News" + "Gutenberg" "Product Placement" "Jackson Howard"]}}) (play-from-hand state :corp "Alexa Belsky" "New remote") (let [alexa (get-content state :remote1 0)] (core/rez state :corp alexa) @@ -88,9 +82,7 @@ (deftest alix-t4lb07 ;; Alix T4LB07 (do-game - (new-game - (default-corp ["Alix T4LB07" (qty "PAD Campaign" 3)]) - (default-runner)) + (new-game {:corp {:deck ["Alix T4LB07" (qty "PAD Campaign" 3)]}}) (play-from-hand state :corp "Alix T4LB07" "New remote") (let [alix (get-content state :remote1 0)] (core/rez state :corp alix) @@ -106,8 +98,7 @@ (deftest allele-repression ;; Allele Repression (do-game - (new-game (default-corp ["Allele Repression"]) - (default-runner)) + (new-game {:corp {:deck ["Allele Repression"]}}) (play-from-hand state :corp "Allele Repression" "New remote") (let [ar (get-content state :remote1 0)] (core/advance state :corp (refresh ar)) @@ -118,9 +109,9 @@ (deftest amani-senai ;; Amani Senai - trace on score/steal to bounce, with base strength = advancement req of the agenda (do-game - (new-game (default-corp ["Amani Senai" - (qty "Medical Breakthrough" 2)]) - (default-runner ["Analog Dreamers"])) + (new-game {:corp {:deck ["Amani Senai" + (qty "Medical Breakthrough" 2)]} + :runner {:deck ["Analog Dreamers"]}}) (play-from-hand state :corp "Amani Senai" "New remote") (play-from-hand state :corp "Medical Breakthrough" "New remote") (play-from-hand state :corp "Medical Breakthrough" "New remote") @@ -152,9 +143,7 @@ (deftest anson-rose ;; Anson Rose (do-game - (new-game - (default-corp ["Anson Rose" "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Anson Rose" "Ice Wall"]}}) (play-from-hand state :corp "Anson Rose" "New remote") (play-from-hand state :corp "Ice Wall" "HQ") (let [ar (get-content state :remote1 0) @@ -179,11 +168,9 @@ (is (= 2 (get-counters (refresh iw) :advancement)) "Ice Wall should gain 2 advancement counter")))) (deftest api-s-keeper-isobel - ;; API-S Keeper Isobel - (do-game - (new-game - (default-corp ["API-S Keeper Isobel" "Ice Wall"]) - (default-runner)) + ;; API-S Keeper Isobel + (do-game + (new-game {:corp {:deck ["API-S Keeper Isobel" "Ice Wall"]}}) (play-from-hand state :corp "API-S Keeper Isobel" "New remote") (play-from-hand state :corp "Ice Wall" "HQ") (let [ap (get-content state :remote1 0) @@ -203,10 +190,8 @@ (deftest aryabhata-tech ;; Aryabhata Tech (do-game - (new-game - (default-corp ["Aryabhata Tech" - "Hunter"]) - (default-runner)) + (new-game {:corp {:deck ["Aryabhata Tech" + "Hunter"]}}) (play-from-hand state :corp "Aryabhata Tech" "New remote") (play-from-hand state :corp "Hunter" "HQ") (let [at (get-content state :remote1 0) @@ -227,9 +212,7 @@ ;; Bio-Ethics Association (testing "Basic test" (do-game - (new-game - (default-corp ["Bio-Ethics Association"]) - (default-runner)) + (new-game {:corp {:deck ["Bio-Ethics Association"]}}) (play-from-hand state :corp "Bio-Ethics Association" "New remote") (core/rez state :corp (get-content state :remote1 0)) (take-credits state :corp) @@ -237,9 +220,8 @@ (is (= 1 (count (:discard (get-runner))))))) (testing "should be able to prevent damage from multiple copies" (do-game - (new-game - (default-corp [(qty "Bio-Ethics Association" 2)]) - (default-runner ["Feedback Filter" (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Bio-Ethics Association" 2)]} + :runner {:deck ["Feedback Filter" (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Bio-Ethics Association" "New remote") (play-from-hand state :corp "Bio-Ethics Association" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -260,9 +242,7 @@ ;; Bioroid Work Crew (letfn [(bwc-test [card] (do-game - (new-game - (default-corp ["Bioroid Work Crew" card]) - (default-runner)) + (new-game {:corp {:deck ["Bioroid Work Crew" card]}}) (play-from-hand state :corp "Bioroid Work Crew" "New remote") (let [bwc (get-content state :remote1 0)] (core/rez state :corp bwc) @@ -283,8 +263,7 @@ ;; Blacklist (testing "#2426. Need to allow steal." (do-game - (new-game (default-corp [(qty "Fetal AI" 3) "Blacklist"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Fetal AI" 3) "Blacklist"]}}) (trash-from-hand state :corp "Fetal AI") (play-from-hand state :corp "Blacklist" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -298,9 +277,8 @@ (deftest brain-taping-warehouse ;; Brain-Taping Warehouse - Lower rez cost of Bioroid ICE by 1 for each unspent Runner click (do-game - (new-game (default-corp ["Brain-Taping Warehouse" "Ichi 1.0" - "Eli 1.0"]) - (default-runner)) + (new-game {:corp {:deck ["Brain-Taping Warehouse" "Ichi 1.0" + "Eli 1.0"]}}) (play-from-hand state :corp "Brain-Taping Warehouse" "New remote") (play-from-hand state :corp "Ichi 1.0" "Server 1") (play-from-hand state :corp "Eli 1.0" "HQ") @@ -321,8 +299,8 @@ (deftest breached-dome ;; Breached Dome (do-game - (new-game (default-corp [(qty "Breached Dome" 10)]) - (default-runner [(qty "Sure Gamble" 10)])) + (new-game {:corp {:deck [(qty "Breached Dome" 10)]} + :runner {:deck [(qty "Sure Gamble" 10)]}}) (trash-from-hand state :corp "Breached Dome") (play-from-hand state :corp "Breached Dome" "New remote") (take-credits state :corp) @@ -344,8 +322,7 @@ (deftest broadcast-square ;; Broadcast Square - Trace 3: Prevent all bad publicity (do-game - (new-game (default-corp ["Profiteering" "Hostile Takeover" "Broadcast Square"]) - (default-runner)) + (new-game {:corp {:deck ["Profiteering" "Hostile Takeover" "Broadcast Square"]}}) (play-from-hand state :corp "Broadcast Square" "New remote") (core/rez state :corp (get-content state :remote1 0)) (is (= 3 (:credit (get-corp))) "Corp should have spent 2 credits") @@ -365,11 +342,40 @@ (is (= 1 (:bad-publicity (get-corp))) "Corp should gain 1 bad publicity from failed trace") (is (= 10 (:credit (get-corp))) "Corp should gain 7 credits"))) +(deftest c-i-fund + ;; C.I. Fund + (do-game + (new-game {:corp {:deck ["C.I. Fund" "Hedge Fund"]}}) + (play-from-hand state :corp "Hedge Fund") + (play-from-hand state :corp "C.I. Fund" "New remote") + (take-credits state :corp) + (let [ci (get-content state :remote1 0)] + (core/rez state :corp ci) + (take-credits state :runner) + (card-ability state :corp ci 0) + (click-prompt state :corp "3") + (is (= 3 (get-counters (refresh ci) :credit))) + (core/end-phase-12 state :corp nil) + (take-credits state :corp) + (take-credits state :runner) + (card-ability state :corp ci 0) + (click-prompt state :corp "3") + (is (= 6 (get-counters (refresh ci) :credit))) + (core/end-phase-12 state :corp nil) + (is (= 8 (get-counters (refresh ci) :credit))) + (take-credits state :corp) + (take-credits state :runner) + (core/end-phase-12 state :corp nil) + (is (= 10 (get-counters (refresh ci) :credit))) + (let [credits (:credit (get-corp))] + (card-ability state :corp ci 1) + (is (= 8 (- (:credit (get-corp)) credits))) + (is (zero? (get-counters (refresh ci) :credit))))))) + (deftest capital-investors ;; Capital Investors - Click for 2 credits (do-game - (new-game (default-corp ["Capital Investors"]) - (default-runner)) + (new-game {:corp {:deck ["Capital Investors"]}}) (play-from-hand state :corp "Capital Investors" "New remote") (let [cap (get-content state :remote1 0)] (core/rez state :corp cap) @@ -381,8 +387,7 @@ (deftest cerebral-overwriter ;; Cerebral Overwriter (do-game - (new-game (default-corp ["Cerebral Overwriter"]) - (default-runner)) + (new-game {:corp {:deck ["Cerebral Overwriter"]}}) (play-from-hand state :corp "Cerebral Overwriter" "New remote") (let [co (get-content state :remote1 0)] (core/advance state :corp {:card (refresh co)}) @@ -396,8 +401,7 @@ (deftest chairman-hiro ;; Chairman Hiro - Reduce Runner max hand size; add as 2 agenda points if Runner trashes him (do-game - (new-game (default-corp [(qty "Chairman Hiro" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Chairman Hiro" 2)]}}) (play-from-hand state :corp "Chairman Hiro" "New remote") (play-from-hand state :corp "Chairman Hiro" "Server 1") (click-prompt state :corp "OK") @@ -419,8 +423,8 @@ (deftest chief-slee ;; Chief Slee (do-game - (new-game (default-corp ["Chief Slee" "Hive" "Hedge Fund"]) - (default-runner [(qty "Sure Gamble" 5)])) + (new-game {:corp {:deck ["Chief Slee" "Hive" "Hedge Fund"]} + :runner {:deck [(qty "Sure Gamble" 5)]}}) (play-from-hand state :corp "Hedge Fund") (play-from-hand state :corp "Hive" "HQ") (play-from-hand state :corp "Chief Slee" "New remote") @@ -435,42 +439,10 @@ (card-ability state :corp slee 1) (is (= 5 (count (:discard (get-runner)))) "Chief Slee should do 5 meat damage")))) -(deftest c.i.-fund - ;; C.I. Fund - (do-game - (new-game (default-corp ["C.I. Fund" "Hedge Fund"]) - (default-runner)) - (play-from-hand state :corp "Hedge Fund") - (play-from-hand state :corp "C.I. Fund" "New remote") - (take-credits state :corp) - (let [ci (get-content state :remote1 0)] - (core/rez state :corp ci) - (take-credits state :runner) - (card-ability state :corp ci 0) - (click-prompt state :corp "3") - (is (= 3 (get-counters (refresh ci) :credit))) - (core/end-phase-12 state :corp nil) - (take-credits state :corp) - (take-credits state :runner) - (card-ability state :corp ci 0) - (click-prompt state :corp "3") - (is (= 6 (get-counters (refresh ci) :credit))) - (core/end-phase-12 state :corp nil) - (is (= 8 (get-counters (refresh ci) :credit))) - (take-credits state :corp) - (take-credits state :runner) - (core/end-phase-12 state :corp nil) - (is (= 10 (get-counters (refresh ci) :credit))) - (let [credits (:credit (get-corp))] - (card-ability state :corp ci 1) - (is (= 8 (- (:credit (get-corp)) credits))) - (is (zero? (get-counters (refresh ci) :credit))))))) - (deftest city-surveillance ;; City Surveillance - Runner chooses to pay 1 credit or take 1 tag at start of their turn (do-game - (new-game (default-corp ["City Surveillance"]) - (default-runner)) + (new-game {:corp {:deck ["City Surveillance"]}}) (play-from-hand state :corp "City Surveillance" "New remote") (let [surv (get-content state :remote1 0)] (core/rez state :corp surv) @@ -492,8 +464,7 @@ (deftest clone-suffrage-movement ;; Clone Suffrage Movement (do-game - (new-game (default-corp ["Clone Suffrage Movement" (qty "Hedge Fund" 2) "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Clone Suffrage Movement" (qty "Hedge Fund" 2) "Ice Wall"]}}) (core/gain state :corp :click 1) (play-from-hand state :corp "Clone Suffrage Movement" "New remote") (play-from-hand state :corp "Hedge Fund") @@ -516,8 +487,8 @@ (deftest clyde-van-rite ;; Clyde Van Rite - Multiple scenarios involving Runner not having credits/cards to trash (do-game - (new-game (default-corp ["Clyde Van Rite"]) - (default-runner [(qty "Sure Gamble" 3) (qty "Restructure" 2) (qty "John Masanori" 2)])) + (new-game {:corp {:deck ["Clyde Van Rite"]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Restructure" 2) (qty "John Masanori" 2)]}}) (play-from-hand state :corp "Clyde Van Rite" "New remote") (let [clyde (get-content state :remote1 0)] (core/rez state :corp clyde) @@ -580,8 +551,7 @@ (deftest commercial-bankers-group ;; Commercial Bankers Group - Gain 3 credits at turn start if unprotected by ice (do-game - (new-game (default-corp ["Commercial Bankers Group" "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Commercial Bankers Group" "Ice Wall"]}}) (play-from-hand state :corp "Commercial Bankers Group" "New remote") (let [cbg (get-content state :remote1 0)] (core/rez state :corp cbg) @@ -598,8 +568,7 @@ ;; Constellation Protocol (testing "Basic test" (do-game - (new-game (default-corp ["Constellation Protocol" "Ice Wall" "Fire Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Constellation Protocol" "Ice Wall" "Fire Wall"]}}) (core/gain state :corp :credit 100 :click 10) (play-from-hand state :corp "Constellation Protocol" "New remote") (play-from-hand state :corp "Ice Wall" "New remote") @@ -625,8 +594,7 @@ (core/end-phase-12 state :corp nil)))) (testing "Variable number of advanceable cards" (do-game - (new-game (default-corp ["Constellation Protocol" "Ice Wall" "Hive"]) - (default-runner)) + (new-game {:corp {:deck ["Constellation Protocol" "Ice Wall" "Hive"]}}) (core/gain state :corp :credit 100 :click 10) (play-from-hand state :corp "Constellation Protocol" "New remote") (let [cp (get-content state :remote1 0)] @@ -649,8 +617,7 @@ (is (not (:corp-phase-12 @state)) "Constellation Protocol shouldn't fire when the target ice can't be advanced")))) (testing "Can't advance assets" (do-game - (new-game (default-corp ["Constellation Protocol" "Ice Wall" "Contract Killer"]) - (default-runner)) + (new-game {:corp {:deck ["Constellation Protocol" "Ice Wall" "Contract Killer"]}}) (core/gain state :corp :credit 100 :click 10) (play-from-hand state :corp "Constellation Protocol" "New remote") (play-from-hand state :corp "Ice Wall" "New remote") @@ -669,8 +636,8 @@ (deftest contract-killer ;; Contract Killer (do-game - (new-game (default-corp ["Contract Killer"]) - (default-runner [(qty "Sure Gamble" 2) "Data Dealer"])) + (new-game {:corp {:deck ["Contract Killer"]} + :runner {:deck [(qty "Sure Gamble" 2) "Data Dealer"]}}) (core/gain state :corp :credit 10) (play-from-hand state :corp "Contract Killer" "New remote") (take-credits state :corp) @@ -696,8 +663,8 @@ (deftest corporate-town ;; Corporate Town (do-game - (new-game (default-corp ["Corporate Town" "Hostile Takeover"]) - (default-runner ["Data Dealer"])) + (new-game {:corp {:deck ["Corporate Town" "Hostile Takeover"]} + :runner {:deck ["Data Dealer"]}}) (core/gain state :corp :click 1) (play-and-score state "Hostile Takeover") (play-from-hand state :corp "Corporate Town" "New remote") @@ -719,8 +686,7 @@ (deftest cpc-generator ;; CPC Generator (do-game - (new-game (default-corp ["CPC Generator"]) - (default-runner)) + (new-game {:corp {:deck ["CPC Generator"]}}) (play-from-hand state :corp "CPC Generator" "New remote") (core/rez state :corp (get-content state :remote1 0)) (take-credits state :corp) @@ -734,8 +700,7 @@ (deftest cybernetics-court ;; Cybernetics Court (do-game - (new-game (default-corp ["Cybernetics Court"]) - (default-runner)) + (new-game {:corp {:deck ["Cybernetics Court"]}}) (play-from-hand state :corp "Cybernetics Court" "New remote") (core/rez state :corp (get-content state :remote1 0)) (is (= 9 (get-hand-size :corp)) "Corp should have hand size of 9"))) @@ -744,9 +709,8 @@ ;; Daily Business Show (testing "Full test" (do-game - (new-game (default-corp [(qty "Daily Business Show" 3) "Hedge Fund" "Jackson Howard" - "Resistor" "Product Placement" "Breaking News"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Daily Business Show" 3) "Hedge Fund" "Jackson Howard" + "Resistor" "Product Placement" "Breaking News"]}}) (starting-hand state :corp ["Daily Business Show" "Daily Business Show" "Daily Business Show" "Hedge Fund"]) (core/gain state :corp :credit 1) (play-from-hand state :corp "Daily Business Show" "New remote") @@ -775,10 +739,9 @@ "Breaking News third last card in deck"))) (testing "Sensie Actors Union interaction" (do-game - (new-game (default-corp ["Daily Business Show" (qty "Sensie Actors Union" 2) + (new-game {:corp {:deck ["Daily Business Show" (qty "Sensie Actors Union" 2) "Hedge Fund" "Jackson Howard" - "Resistor" "Product Placement" "Breaking News"]) - (default-runner)) + "Resistor" "Product Placement" "Breaking News"]}}) (starting-hand state :corp ["Daily Business Show" "Sensie Actors Union" "Sensie Actors Union" "Hedge Fund"]) (play-from-hand state :corp "Daily Business Show" "New remote") (play-from-hand state :corp "Sensie Actors Union" "New remote") @@ -813,9 +776,8 @@ (is (= "Breaking News" (:title (last (:deck (get-corp))))) "Breaking News last card in deck")))) (testing "Should not trigger if rezzed after mandatory draw" (do-game - (new-game (default-corp [(qty "Daily Business Show" 3) "Hedge Fund" "Jackson Howard" - "Resistor" "Product Placement" "Breaking News"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Daily Business Show" 3) "Hedge Fund" "Jackson Howard" + "Resistor" "Product Placement" "Breaking News"]}}) (starting-hand state :corp ["Daily Business Show"]) (play-from-hand state :corp "Daily Business Show" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -824,9 +786,9 @@ (is (empty? (:prompt (get-corp))) "Corp is not being asked to bury a card with DBS"))) (testing "Fire on Runner turn" (do-game - (new-game (default-corp ["Daily Business Show" "Hedge Fund" - "Resistor" "Product Placement" "Breaking News"]) - (default-runner ["Fisk Investment Seminar"])) + (new-game {:corp {:deck ["Daily Business Show" "Hedge Fund" + "Resistor" "Product Placement" "Breaking News"]} + :runner {:deck ["Fisk Investment Seminar"]}}) (starting-hand state :corp ["Daily Business Show"]) (play-from-hand state :corp "Daily Business Show" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -839,12 +801,10 @@ (is (empty? (:prompt (get-runner))) "Runner prompt cleared") (is (= 3 (count (:hand (get-corp)))))))) - (deftest dedicated-response-team ;; Dedicated Response Team - Do 2 meat damage when successful run ends if Runner is tagged (do-game - (new-game (default-corp ["Dedicated Response Team"]) - (default-runner)) + (new-game {:corp {:deck ["Dedicated Response Team"]}}) (play-from-hand state :corp "Dedicated Response Team" "New remote") (let [drt (get-content state :remote1 0)] (core/rez state :corp drt) @@ -861,8 +821,7 @@ (deftest dedicated-server ;; Dedicated Servers (do-game - (new-game (default-corp ["Dedicated Server"]) - (default-runner)) + (new-game {:corp {:deck ["Dedicated Server"]}}) (play-from-hand state :corp "Dedicated Server" "New remote") (let [servers (get-content state :remote1 0)] (core/rez state :corp servers) @@ -871,8 +830,7 @@ (deftest director-haas ;; Director Haas (do-game - (new-game (default-corp [(qty "Director Haas" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Director Haas" 2)]}}) (play-from-hand state :corp "Director Haas" "New remote") (play-from-hand state :corp "Director Haas" "Server 1") (click-prompt state :corp "OK") @@ -897,8 +855,8 @@ ;; Docklands Crackdown (letfn [(dlcd-test [number] (do-game - (new-game (default-corp ["Docklands Crackdown"]) - (default-runner ["Cache"])) + (new-game {:corp {:deck ["Docklands Crackdown"]} + :runner {:deck ["Cache"]}}) (play-from-hand state :corp "Docklands Crackdown" "New remote") (let [dlcd (get-content state :remote1 0)] (core/rez state :corp dlcd) @@ -912,10 +870,9 @@ ;; Drudge Work - Shuffle agenda from HQ or Archives into R&D, and gain credits = to agenda points ;; TODO: do some Noah magic on this test to test several agendas from several locations (do-game - (new-game (default-corp ["Drudge Work" + (new-game {:corp {:deck ["Drudge Work" "Hostile Takeover" "Standoff" "Global Food Initiative" "Armed Intimidation" - "Hedge Fund"]) - (default-runner)) + "Hedge Fund"]}}) (core/gain state :corp :click 2) (play-from-hand state :corp "Drudge Work" "New remote") (play-from-hand state :corp "Armed Intimidation" "New remote") @@ -970,9 +927,8 @@ (deftest early-premiere ;; Early Premiere - Pay 1c at start of turn to place an advancement on a card in a server (do-game - (new-game (default-corp ["Early Premiere" "Ice Wall" - "Ghost Branch" "Blacklist"]) - (default-runner)) + (new-game {:corp {:deck ["Early Premiere" "Ice Wall" + "Ghost Branch" "Blacklist"]}}) (core/gain state :corp :click 1) (play-from-hand state :corp "Early Premiere" "New remote") (play-from-hand state :corp "Blacklist" "New remote") @@ -997,8 +953,7 @@ (deftest echo-chamber ;; Echo Chamber - 3 clicks to become 1 point agenda (do-game - (new-game (default-corp ["Echo Chamber"]) - (default-runner)) + (new-game {:corp {:deck ["Echo Chamber"]}}) (core/gain state :corp :click 1) (play-from-hand state :corp "Echo Chamber" "New remote") (let [ec (get-content state :remote1 0)] @@ -1009,8 +964,7 @@ (deftest edge-of-world ;; Edge of World (do-game - (new-game (default-corp [(qty "Edge of World" 3) (qty "Ice Wall" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Edge of World" 3) (qty "Ice Wall" 3)]}}) (core/gain state :corp :credit 6 :click 1) (play-from-hand state :corp "Edge of World" "New remote") (play-from-hand state :corp "Edge of World" "New remote") @@ -1028,11 +982,10 @@ (click-prompt state :runner "Pay 0 [Credits] to trash") (is (= 2 (:brain-damage (get-runner))) "Runner did not take brain damage when no ICE protected Edge of World"))) -(deftest eliza's-toybox +(deftest eliza-s-toybox ;; Eliza's Toybox - Rez a card ignoring all costs (do-game - (new-game (default-corp ["Eliza's Toybox" "Wotan" "Archer"]) - (default-runner)) + (new-game {:corp {:deck ["Eliza's Toybox" "Wotan" "Archer"]}}) (play-from-hand state :corp "Wotan" "R&D") (play-from-hand state :corp "Archer" "HQ") (play-from-hand state :corp "Eliza's Toybox" "New remote") @@ -1057,8 +1010,8 @@ (deftest elizabeth-mills ;; Elizabeth Mills - Remove 1 bad publicity when rezzed; click-trash to trash a location (do-game - (new-game (default-corp ["Elizabeth Mills"]) - (default-runner ["Earthrise Hotel"])) + (new-game {:corp {:deck ["Elizabeth Mills"]} + :runner {:deck ["Earthrise Hotel"]}}) (core/gain state :corp :bad-publicity 1) (play-from-hand state :corp "Elizabeth Mills" "New remote") (take-credits state :corp) @@ -1077,8 +1030,7 @@ (deftest encryption-protocol ;; Encryption Protocol - Trash cost of installed cards increased by 1 (do-game - (new-game (default-corp [(qty "Encryption Protocol" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Encryption Protocol" 2)]}}) (play-from-hand state :corp "Encryption Protocol" "New remote") (play-from-hand state :corp "Encryption Protocol" "New remote") (let [ep1 (get-content state :remote1 0) @@ -1098,8 +1050,7 @@ ;; Estelle Moon (letfn [(estelle-test [number] (do-game - (new-game (default-corp ["Estelle Moon" (qty "Encryption Protocol" 20)]) - (default-runner)) + (new-game {:corp {:deck ["Estelle Moon" (qty "Encryption Protocol" 20)]}}) (starting-hand state :corp (repeat 9 "Encryption Protocol")) (core/move state :corp (find-card "Estelle Moon" (:deck (get-corp))) :hand) (play-from-hand state :corp "Estelle Moon" "New remote") @@ -1119,8 +1070,7 @@ (deftest eve-campaign ;; Eve Campaign (do-game - (new-game (default-corp ["Eve Campaign"]) - (default-runner)) + (new-game {:corp {:deck ["Eve Campaign"]}}) (play-from-hand state :corp "Eve Campaign" "New remote") (let [eve (get-content state :remote1 0)] (core/rez state :corp eve) @@ -1135,8 +1085,7 @@ ;; Executive Boot Camp (testing "suppress the start-of-turn event on a rezzed card. Issue #1346" (do-game - (new-game (default-corp ["Eve Campaign" "Executive Boot Camp"]) - (default-runner)) + (new-game {:corp {:deck ["Eve Campaign" "Executive Boot Camp"]}}) (play-from-hand state :corp "Eve Campaign" "New remote") (play-from-hand state :corp "Executive Boot Camp" "New remote") (take-credits state :corp) @@ -1159,9 +1108,8 @@ (is (= 14 (get-counters (refresh eve) :credit)) "Took counters from Eve")))) (testing "works with Ice that has alternate rez costs" (do-game - (new-game (default-corp ["15 Minutes" "Executive Boot Camp" - "Tithonium"]) - (default-runner)) + (new-game {:corp {:deck ["15 Minutes" "Executive Boot Camp" + "Tithonium"]}}) (core/gain state :corp :credit 3) (score-agenda state :corp (find-card "15 Minutes" (:hand (get-corp)))) (play-from-hand state :corp "Tithonium" "HQ") @@ -1183,9 +1131,8 @@ (deftest executive-search-firm ;; Executive Search Firm (do-game - (new-game (default-corp ["Executive Search Firm" "Elizabeth Mills" - "Midori" "Shannon Claire"]) - (default-runner)) + (new-game {:corp {:deck ["Executive Search Firm" "Elizabeth Mills" + "Midori" "Shannon Claire"]}}) (starting-hand state :corp ["Executive Search Firm"]) (core/gain state :corp :click 4) (play-from-hand state :corp "Executive Search Firm" "New remote") @@ -1201,8 +1148,7 @@ (deftest expose ;; Exposé (do-game - (new-game (default-corp ["Exposé"]) - (default-runner)) + (new-game {:corp {:deck ["Exposé"]}}) (core/gain state :corp :click 100 :credit 100) (dotimes [i 5] (play-from-hand state :corp "Exposé" "New remote") @@ -1224,51 +1170,48 @@ (testing "when the corp attempts to score False Flag" (testing "and False Flag has 7 advancements" (do-game - (new-game (default-corp ["False Flag"]) - (default-runner)) - (play-from-hand state :corp "False Flag" "New remote") - (let [ff (get-content state :remote1 0)] - (core/add-counter state :corp ff :advancement 7) - (core/rez state :corp (refresh ff)) - (card-ability state :corp (refresh ff) 0) - (is (nil? (get-content state :remote1 0)) - "False Flag is no longer in remote") - (is (= 3 (:agendapoints (get-scored state :corp 0))) - "the corp can score False Flag") - (is (= 1 (:click (get-corp))) - "scoring False Flag costs one click")))) + (new-game {:corp {:deck ["False Flag"]}}) + (play-from-hand state :corp "False Flag" "New remote") + (let [ff (get-content state :remote1 0)] + (core/add-counter state :corp ff :advancement 7) + (core/rez state :corp (refresh ff)) + (card-ability state :corp (refresh ff) 0) + (is (nil? (get-content state :remote1 0)) + "False Flag is no longer in remote") + (is (= 3 (:agendapoints (get-scored state :corp 0))) + "the corp can score False Flag") + (is (= 1 (:click (get-corp))) + "scoring False Flag costs one click")))) (testing "and False Flag has less than 7 advancements" (do-game - (new-game (default-corp ["False Flag"]) - (default-runner)) - (play-from-hand state :corp "False Flag" "New remote") - (let [ff (get-content state :remote1 0)] - (core/add-counter state :corp ff :advancement 6) - (core/rez state :corp (refresh ff)) - (card-ability state :corp (refresh ff) 0) - (is (not (nil? (get-content state :remote1 0))) - "False Flag remains in the remote") - (is (nil? (:agendapoints (get-scored state :corp 0))) - "the corp cannot score false flag") - (is (= 2 (:click (get-corp))) - "the corp does not lose a click"))))) + (new-game {:corp {:deck ["False Flag"]}}) + (play-from-hand state :corp "False Flag" "New remote") + (let [ff (get-content state :remote1 0)] + (core/add-counter state :corp ff :advancement 6) + (core/rez state :corp (refresh ff)) + (card-ability state :corp (refresh ff) 0) + (is (not (nil? (get-content state :remote1 0))) + "False Flag remains in the remote") + (is (nil? (:agendapoints (get-scored state :corp 0))) + "the corp cannot score false flag") + (is (= 2 (:click (get-corp))) + "the corp does not lose a click"))))) (testing "when the runner accesses False Flag" (letfn [(false-flag-tags-test [[advancements expected-tags]] (testing (str "and False Flag has " advancements " advancements") (do-game - (new-game (default-corp ["False Flag"]) - (default-runner)) - (play-from-hand state :corp "False Flag" "New remote") - (core/add-prop state :corp - (get-content state :remote1 0) - :advance-counter advancements) - (take-credits state :corp) - (run-empty-server state "Server 1") - (click-prompt state :runner "No action") - (let [tags (count-tags state)] - (is (= expected-tags tags) - (str "the runner recieves " tags " tags"))))))] + (new-game {:corp {:deck ["False Flag"]}}) + (play-from-hand state :corp "False Flag" "New remote") + (core/add-prop state :corp + (get-content state :remote1 0) + :advance-counter advancements) + (take-credits state :corp) + (run-empty-server state "Server 1") + (click-prompt state :runner "No action") + (let [tags (count-tags state)] + (is (= expected-tags tags) + (str "the runner recieves " tags " tags"))))))] (doall (map false-flag-tags-test [[0 0] [2 1] @@ -1278,8 +1221,7 @@ (deftest franchise-city ;; Franchise City (do-game - (new-game (default-corp ["Franchise City" "Accelerated Beta Test"]) - (default-runner)) + (new-game {:corp {:deck ["Franchise City" "Accelerated Beta Test"]}}) (play-from-hand state :corp "Franchise City" "New remote") (play-from-hand state :corp "Accelerated Beta Test" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -1297,11 +1239,9 @@ ;; Full Immmersion RecStudio - install directly, and via Interns (testing "Full test" (do-game - (new-game - (default-corp ["Full Immersion RecStudio" - (qty "Interns" 2) - (qty "Launch Campaign" 3)]) - (default-runner)) + (new-game {:corp {:deck ["Full Immersion RecStudio" + (qty "Interns" 2) + (qty "Launch Campaign" 3)]}}) (play-from-hand state :corp "Full Immersion RecStudio" "New remote") (let [fir (get-content state :remote1 0)] (core/rez state :corp fir) @@ -1321,10 +1261,8 @@ (is (= 2 (count (:hosted (refresh fir)))) "Interns installed onto FIR"))))) (testing "hosting an asset with events does not double-register events. Issue #1827" (do-game - (new-game - (default-corp ["Full Immersion RecStudio" "Sandburg" "Vanilla" - "Oaktown Renovation"]) - (default-runner)) + (new-game {:corp {:deck ["Full Immersion RecStudio" "Sandburg" "Vanilla" + "Oaktown Renovation"]}}) (play-from-hand state :corp "Full Immersion RecStudio" "New remote") (play-from-hand state :corp "Vanilla" "HQ") (let [fir (get-content state :remote1 0) @@ -1344,9 +1282,7 @@ (deftest fumiko-yamamori ;; Fumiko Yamamori (do-game - (new-game - (default-corp ["Fumiko Yamamori"]) - (default-runner)) + (new-game {:corp {:deck ["Fumiko Yamamori"]}}) (core/gain state :corp :credit 10) (play-from-hand state :corp "Fumiko Yamamori" "New remote") (let [fumiko (get-content state :remote1 0)] @@ -1361,11 +1297,10 @@ (deftest gene-splicer ;; Gene Splicer (testing "Runner accesses an unadvanced Gene Splicer and doesn't trash - ;; No net damage is dealt and Gene Splicer remains installed" + ;; No net damage is dealt and Gene Splicer remains installed" (do-game - (new-game - (default-corp ["Gene Splicer"]) - (default-runner [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Gene Splicer"]} + :runner {:deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Gene Splicer" "New remote") (take-credits state :corp) (run-empty-server state "Server 1") @@ -1374,11 +1309,10 @@ (is (= "Gene Splicer" (:title (get-content state :remote1 0))) "Gene Splicer was not trashed") (is (= 5 (:credit (get-runner))) "Runner spent no credits"))) (testing "Runner accesses an unadvanced Gene Splicer and trashes it. - No net damage is dealt and Gene Splicer is trashed" + No net damage is dealt and Gene Splicer is trashed" (do-game - (new-game - (default-corp ["Gene Splicer"]) - (default-runner [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Gene Splicer"]} + :runner {:deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Gene Splicer" "New remote") (take-credits state :corp) (run-empty-server state "Server 1") @@ -1388,11 +1322,10 @@ (is (= (:title (last (:discard (get-corp)))) "Gene Splicer") "Gene Splicer trashed") (is (= 4 (:credit (get-runner))) "Runner spent 1 credit to trash Gene Splicer"))) (testing "Runner accesses a single-advanced Gene Splicer and doesn't trash. - 1 net damage is dealt and Gene Splicer remains installed" + 1 net damage is dealt and Gene Splicer remains installed" (do-game - (new-game - (default-corp ["Gene Splicer"]) - (default-runner [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Gene Splicer"]} + :runner {:deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Gene Splicer" "New remote") (core/add-counter state :corp (get-content state :remote1 0) :advancement 1) (take-credits state :corp) @@ -1402,11 +1335,10 @@ (is (= "Gene Splicer" (:title (get-content state :remote1 0))) "Gene Splicer was not trashed") (is (= 5 (:credit (get-runner))) "Runner spent no credits"))) (testing "Runner accesses a single-advanced Gene Splicer and trashes it. - 1 net damage is dealt and Gene Splicer is trashed" + 1 net damage is dealt and Gene Splicer is trashed" (do-game - (new-game - (default-corp ["Gene Splicer"]) - (default-runner [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Gene Splicer"]} + :runner {:deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Gene Splicer" "New remote") (core/add-counter state :corp (get-content state :remote1 0) :advancement 1) (take-credits state :corp) @@ -1417,11 +1349,10 @@ (is (= (:title (last (:discard (get-corp)))) "Gene Splicer") "Gene Splicer trashed") (is (= 4 (:credit (get-runner))) "Runner spent 1 credit to trash Gene Splicer"))) (testing "Runner accesses a double-advanced Gene Splicer and doesn't trash - 2 net damage is dealt and Gene Splicer remains installed" + 2 net damage is dealt and Gene Splicer remains installed" (do-game - (new-game - (default-corp ["Gene Splicer"]) - (default-runner [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Gene Splicer"]} + :runner {:deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Gene Splicer" "New remote") (core/add-counter state :corp (get-content state :remote1 0) :advancement 2) (take-credits state :corp) @@ -1431,11 +1362,10 @@ (is (= "Gene Splicer" (:title (get-content state :remote1 0))) "Gene Splicer was not trashed") (is (= 5 (:credit (get-runner))) "Runner spent no credits"))) (testing "Runner accesses a double-advanced Gene Splicer and trashes it. - 2 net damage is dealt and Gene Splicer is trashed" + 2 net damage is dealt and Gene Splicer is trashed" (do-game - (new-game - (default-corp ["Gene Splicer"]) - (default-runner [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Gene Splicer"]} + :runner {:deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Gene Splicer" "New remote") (core/add-counter state :corp (get-content state :remote1 0) :advancement 2) (take-credits state :corp) @@ -1447,9 +1377,8 @@ (is (= 4 (:credit (get-runner))) "Runner spent 1 credit to trash Gene Splicer"))) (testing "Corp triple-advances a Gene Splicer and uses its ability to add to their score area as a 1 point agenda" (do-game - (new-game - (default-corp [(qty "Gene Splicer" 2) (qty "Ice Wall" 3) (qty "Vanilla" 2)]) - (default-runner [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Gene Splicer" 2) (qty "Ice Wall" 3) (qty "Vanilla" 2)]} + :runner {:deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Gene Splicer" "New remote") (let [gs (get-content state :remote1 0)] (core/add-counter state :corp gs :advancement 2) @@ -1464,8 +1393,8 @@ ;; Genetics Pavilion - Limit Runner to 2 draws per turn, but only during Runner's turn (testing "Basic test" (do-game - (new-game (default-corp ["Genetics Pavilion"]) - (default-runner ["Diesel" (qty "Sure Gamble" 3) "Sports Hopper"])) + (new-game {:corp {:deck ["Genetics Pavilion"]} + :runner {:deck ["Diesel" (qty "Sure Gamble" 3) "Sports Hopper"]}}) (play-from-hand state :corp "Genetics Pavilion" "New remote") (let [gp (get-content state :remote1 0)] (take-credits state :corp) @@ -1497,8 +1426,8 @@ (is (= 2 (count (:hand (get-runner)))) "No card drawn; GP counts cards drawn prior to rez"))))) (testing "vs Fisk Investment Seminar" (do-game - (new-game (default-corp ["Genetics Pavilion" (qty "Hedge Fund" 3)]) - (default-runner ["Fisk Investment Seminar" (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Genetics Pavilion" (qty "Hedge Fund" 3)]} + :runner {:deck ["Fisk Investment Seminar" (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Genetics Pavilion" "New remote") (let [gp (get-content state :remote1 0)] (take-credits state :corp) @@ -1516,9 +1445,9 @@ (is (= 3 (count (:hand (get-corp)))) "Drew all 3 cards")))) (testing "Mr. Li interaction. #1594" (do-game - (new-game (default-corp ["Genetics Pavilion"]) - (default-runner ["Mr. Li" "Account Siphon" "Faerie" - "Sure Gamble" "John Masanori" "Desperado"])) + (new-game {:corp {:deck ["Genetics Pavilion"]} + :runner {:deck ["Mr. Li" "Account Siphon" "Faerie" + "Sure Gamble" "John Masanori" "Desperado"]}}) (starting-hand state :runner ["Mr. Li"]) (play-from-hand state :corp "Genetics Pavilion" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -1552,8 +1481,7 @@ ;; Ghost Branch - Advanceable; give the Runner tags equal to advancements when accessed (testing "Basic test" (do-game - (new-game (default-corp ["Ghost Branch"]) - (default-runner)) + (new-game {:corp {:deck ["Ghost Branch"]}}) (play-from-hand state :corp "Ghost Branch" "New remote") (let [gb (get-content state :remote1 0)] (core/advance state :corp {:card (refresh gb)}) @@ -1565,8 +1493,7 @@ (is (= 2 (count-tags state)) "Runner given 2 tags")))) (testing "with Dedicated Response Team" (do-game - (new-game (default-corp ["Ghost Branch" "Dedicated Response Team"]) - (default-runner)) + (new-game {:corp {:deck ["Ghost Branch" "Dedicated Response Team"]}}) (play-from-hand state :corp "Ghost Branch" "New remote") (play-from-hand state :corp "Dedicated Response Team" "New remote") (core/gain state :corp :click 1) @@ -1588,8 +1515,7 @@ (deftest grndl-refinery ;; GRNDL Refinery (do-game - (new-game (default-corp ["GRNDL Refinery"]) - (default-runner)) + (new-game {:corp {:deck ["GRNDL Refinery"]}}) (core/gain state :corp :click 100 :credit 100) (dotimes [i 5] (play-from-hand state :corp "GRNDL Refinery" "New remote") @@ -1607,8 +1533,7 @@ (deftest haas-arcology-ai ;; Haas Arcology AI - Click and advancement to gain 2 clicks, once per turn (do-game - (new-game (default-corp ["Haas Arcology AI"]) - (default-runner)) + (new-game {:corp {:deck ["Haas Arcology AI"]}}) (core/gain state :corp :click 1) (play-from-hand state :corp "Haas Arcology AI" "New remote") (let [haa (get-content state :remote1 0)] @@ -1626,8 +1551,7 @@ (deftest honeyfarm ;; Honeyfarm - lose one credit on access (do-game - (new-game (default-corp [(qty "Honeyfarm" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Honeyfarm" 3)]}}) (trash-from-hand state :corp "Honeyfarm") (play-from-hand state :corp "Honeyfarm" "New remote") (take-credits state :corp) @@ -1641,8 +1565,7 @@ (deftest hostile-infrastructure ;; Hostile Infrastructure - do 1 net damage when runner trashes a corp card (do-game - (new-game (default-corp [(qty "Hostile Infrastructure" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Hostile Infrastructure" 3)]}}) (core/gain state :runner :credit 50) (play-from-hand state :corp "Hostile Infrastructure" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -1657,8 +1580,7 @@ (deftest hyoubu-research-facility ;; Hyoubu Research Facility (do-game - (new-game (default-corp ["Hyoubu Research Facility" "Snowflake"]) - (default-runner)) + (new-game {:corp {:deck ["Hyoubu Research Facility" "Snowflake"]}}) (play-from-hand state :corp "Hyoubu Research Facility" "New remote") (play-from-hand state :corp "Snowflake" "HQ") (let [hrf (get-content state :remote1 0) @@ -1680,8 +1602,8 @@ (deftest ibrahim-salem ;; Ibrahim Salem (do-game - (new-game (default-corp ["Hostile Takeover" "Ibrahim Salem"]) - (default-runner ["Sure Gamble" "Astrolabe" "Paperclip" "Daily Casts"])) + (new-game {:corp {:deck ["Hostile Takeover" "Ibrahim Salem"]} + :runner {:deck ["Sure Gamble" "Astrolabe" "Paperclip" "Daily Casts"]}}) (play-and-score state "Hostile Takeover") (play-from-hand state :corp "Ibrahim Salem" "New remote") (let [is (get-content state :remote2 0)] @@ -1704,11 +1626,10 @@ (deftest illegal-arms-factory ;; Illegal Arms Factory; draw a card, gain a credit, bad pub when trashed while rezzed (do-game - (new-game (default-corp ["Hedge Fund" + (new-game {:corp {:deck ["Hedge Fund" "Beanstalk Royalties" "IPO" - (qty "Illegal Arms Factory" 3)]) - (default-runner)) + (qty "Illegal Arms Factory" 3)]}}) (core/gain state :runner :credit 20) (core/move state :corp (find-card "IPO" (:hand (get-corp))) :deck) (core/move state :corp (find-card "Hedge Fund" (:hand (get-corp))) :deck) @@ -1732,10 +1653,9 @@ (deftest indian-union-stock-exchange ;; Indian Union Stock Exchange (do-game - (new-game (make-deck "Argus Security: Protection Guaranteed" - ["Indian Union Stock Exchange" "Beanstalk Royalties" - "Kill Switch" "Net Police"]) - (default-runner)) + (new-game {:corp {:id "Argus Security: Protection Guaranteed" + :deck ["Indian Union Stock Exchange" "Beanstalk Royalties" + "Kill Switch" "Net Police"]}}) (core/gain state :corp :click 3) (play-from-hand state :corp "Indian Union Stock Exchange" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -1753,8 +1673,7 @@ (deftest isabel-mcguire ;; Isabel McGuire (do-game - (new-game (default-corp ["Ice Wall" "Isabel McGuire"]) - (default-runner)) + (new-game {:corp {:deck ["Ice Wall" "Isabel McGuire"]}}) (play-from-hand state :corp "Isabel McGuire" "New remote") (play-from-hand state :corp "Ice Wall" "HQ") (is (zero? (-> (get-corp) :hand count))) @@ -1768,8 +1687,7 @@ (deftest it-department ;; IT Department - Add strength to rezzed ICE until end of turn (do-game - (new-game (default-corp ["IT Department" "Wall of Static"]) - (default-runner)) + (new-game {:corp {:deck ["IT Department" "Wall of Static"]}}) (play-from-hand state :corp "IT Department" "New remote") (play-from-hand state :corp "Wall of Static" "Server 1") (let [itd (get-content state :remote1 0) @@ -1804,10 +1722,9 @@ (deftest jackson-howard ;; Jackson Howard - Draw 2 cards (do-game - (new-game (default-corp [(qty "Jackson Howard" 3) + (new-game {:corp {:deck [(qty "Jackson Howard" 3) (qty "Hedge Fund" 3) - (qty "Restructure" 2)]) - (default-runner)) + (qty "Restructure" 2)]}}) ;; guaranteed to be at least 1 jhow in hand after draw, and 2 cards in R&D (play-from-hand state :corp "Jackson Howard" "New remote") (let [jhow (get-content state :remote1 0)] @@ -1821,9 +1738,9 @@ (deftest jeeves-model-bioroids ;; Jeeves Model Bioroids (do-game - (new-game (default-corp ["Jeeves Model Bioroids" "TGTBT" - (qty "Melange Mining Corp." 2)]) - (default-runner [(qty "Ghost Runner" 3)])) + (new-game {:corp {:deck ["Jeeves Model Bioroids" "TGTBT" + (qty "Melange Mining Corp." 2)]} + :runner {:deck [(qty "Ghost Runner" 3)]}}) (play-from-hand state :corp "Jeeves Model Bioroids" "New remote") (core/rez state :corp (get-content state :remote1 0)) (take-credits state :corp) @@ -1877,8 +1794,7 @@ (deftest kala-ghoda-real-tv ;; Kala Ghoda Real TV (do-game - (new-game (default-corp ["Kala Ghoda Real TV"]) - (default-runner) [(qty "Sure Gamble" 3)]) + (new-game {:corp {:deck ["Kala Ghoda Real TV"]}}) (starting-hand state :runner ["Sure Gamble"]) (play-from-hand state :corp "Kala Ghoda Real TV" "New remote") (let [tv (get-content state :remote1 0)] @@ -1897,8 +1813,7 @@ (deftest kuwinda-k4h1u3 ;; Kuwinda K4H1U3 (do-game - (new-game (default-corp ["Kuwinda K4H1U3"]) - (default-runner)) + (new-game {:corp {:deck ["Kuwinda K4H1U3"]}}) (core/gain state :corp :credit 100) (core/gain state :runner :credit 100) (play-from-hand state :corp "Kuwinda K4H1U3" "New remote") @@ -1941,8 +1856,7 @@ ;; Lady Liberty - Score agenda from hand equal to number of power counters on Lady Libery (testing "Basic behavior" (do-game - (new-game (default-corp ["Lady Liberty" "Breaking News" "Ikawah Project"]) - (default-runner)) + (new-game {:corp {:deck ["Lady Liberty" "Breaking News" "Ikawah Project"]}}) (play-from-hand state :corp "Lady Liberty" "New remote") (let [ll (get-content state :remote1 0)] (core/rez state :corp ll) @@ -1969,8 +1883,7 @@ (is (= 4 (:agenda-point (get-corp))) "Gained 3 agenda points")))) (testing "Agenda constant effects" (do-game - (new-game (default-corp ["Lady Liberty" "Self-Destruct Chips"]) - (default-runner)) + (new-game {:corp {:deck ["Lady Liberty" "Self-Destruct Chips"]}}) (play-from-hand state :corp "Lady Liberty" "New remote") (let [ll (get-content state :remote1 0)] (core/rez state :corp ll) @@ -1982,8 +1895,7 @@ (is (= 4 (core/hand-size state :runner)) "Runner hand size reduced by 1")))) (testing "Agenda events" (do-game - (new-game (default-corp ["Lady Liberty" "Puppet Master"]) - (default-runner)) + (new-game {:corp {:deck ["Lady Liberty" "Puppet Master"]}}) (play-from-hand state :corp "Lady Liberty" "New remote") (let [ll (get-content state :remote1 0)] (core/rez state :corp ll) @@ -2001,9 +1913,8 @@ (deftest lakshmi-smartfabrics ;; Lakshmi Smartfabrics - Gain power counter when rezzing a card; use counters to protect agenda in HQ (do-game - (new-game (default-corp ["Lakshmi Smartfabrics" "Vanilla" - "Marked Accounts" "Elective Upgrade"]) - (default-runner)) + (new-game {:corp {:deck ["Lakshmi Smartfabrics" "Vanilla" + "Marked Accounts" "Elective Upgrade"]}}) (play-from-hand state :corp "Lakshmi Smartfabrics" "New remote") (let [lak (get-content state :remote1 0)] (core/rez state :corp lak) @@ -2031,8 +1942,7 @@ (deftest launch-campaign ;; Launch Campaign (do-game - (new-game (default-corp ["Launch Campaign"]) - (default-runner)) + (new-game {:corp {:deck ["Launch Campaign"]}}) (play-from-hand state :corp "Launch Campaign" "New remote") (let [launch (get-content state :remote1 0)] (core/rez state :corp launch) @@ -2046,8 +1956,7 @@ (deftest levy-university ;; Levy University (do-game - (new-game (default-corp ["Levy University" "Ice Wall" (qty "Fire Wall" 10)]) - (default-runner)) + (new-game {:corp {:deck ["Levy University" "Ice Wall" (qty "Fire Wall" 10)]}}) (starting-hand state :corp ["Levy University"]) (play-from-hand state :corp "Levy University" "New remote") (let [levy (get-content state :remote1 0) @@ -2067,8 +1976,7 @@ (deftest lily-lockwell ;; Lily Lockwell (do-game - (new-game (default-corp ["Lily Lockwell" "Beanstalk Royalties" (qty "Fire Wall" 10)]) - (default-runner)) + (new-game {:corp {:deck ["Lily Lockwell" "Beanstalk Royalties" (qty "Fire Wall" 10)]}}) (core/gain state :corp :click 10) (starting-hand state :corp ["Lily Lockwell" "Beanstalk Royalties"]) (play-from-hand state :corp "Lily Lockwell" "New remote") @@ -2095,8 +2003,7 @@ (deftest long-term-investment ;; Long-Term Investment (do-game - (new-game (default-corp ["Long-Term Investment"]) - (default-runner)) + (new-game {:corp {:deck ["Long-Term Investment"]}}) (play-from-hand state :corp "Long-Term Investment" "New remote") (let [lti (get-content state :remote1 0)] (core/rez state :corp lti) @@ -2113,65 +2020,62 @@ (deftest malia-z0l0k4 ;; Malia Z0L0K4 - blank an installed non-virtual runner resource (do-game - (new-game (default-corp [(qty "Malia Z0L0K4" 2) - "Mausolus"]) - (default-runner ["Rachel Beckman" - "Daily Casts" - "Rumor Mill"])) - (play-from-hand state :corp "Malia Z0L0K4" "New remote") - (play-from-hand state :corp "Malia Z0L0K4" "New remote") - (play-from-hand state :corp "Mausolus" "HQ") - (take-credits state :corp) - (let [malia1 (get-content state :remote1 0) - malia2 (get-content state :remote2 0) - mausolus (get-ice state :hq 0)] - (play-from-hand state :runner "Daily Casts") - (take-credits state :runner) - (let [N (:credit (get-runner))] - (core/rez state :corp malia1) - (click-card state :corp (get-resource state 0)) - (take-credits state :corp) - (is (= N (:credit (get-runner))) "Daily casts did not trigger when blanked")) - (take-credits state :runner) - (core/derez state :corp malia1) - (let [N (:credit (get-runner))] - (take-credits state :corp) - (is (= (+ N 2) (:credit (get-runner))) "Daily casts triggers again when unblanked")) - (play-from-hand state :runner "Rachel Beckman") - (is (= 4 (:click (get-runner))) "Runner has 4 clicks after playing Beckman") - (core/rez state :corp malia1) - (click-card state :corp (get-resource state 1)) - (is (= 3 (:click (get-runner))) "Runner has 3 clicks after Beckman is blank") - (core/derez state :corp malia1) - (is (= 4 (:click (get-runner))) "Runner has 4 clicks after Beckman is unblanked") - (core/rez state :corp malia1) - (click-card state :corp (get-resource state 1)) - (core/rez state :corp mausolus) - (card-subroutine state :corp mausolus 2) - (is (and (= 1 (count-tags state)) - (zero? (count (:discard (get-runner))))) "Runner has 1 tag, but Rachel Beckman not trashed") - (take-credits state :runner) - (is (zero? (count (:hand (get-corp)))) "Malia is not in hand") - (core/move-card state :corp {:card malia1 :server "HQ"}) - (is (= 1 (count (:hand (get-corp)))) "Malia is in hand") - (is (= 1 (count (:discard (get-runner)))) "Rachel Beckman got trashed on unblanking") - (core/rez state :corp malia2) - (click-card state :corp (get-resource state 0)) - (let [N (:credit (get-runner))] - (take-credits state :corp) - (is (= N (:credit (get-runner))) "Daily casts is blank, so no drip"))) - (play-from-hand state :runner "Rumor Mill") - (take-credits state :runner) - (let [N (:credit (get-runner))] - (take-credits state :corp) - (is (= (+ N 2) (:credit (get-runner))))))) + (new-game {:corp {:deck [(qty "Malia Z0L0K4" 2) "Mausolus"]} + :runner {:deck ["Rachel Beckman" + "Daily Casts" + "Rumor Mill"]}}) + (play-from-hand state :corp "Malia Z0L0K4" "New remote") + (play-from-hand state :corp "Malia Z0L0K4" "New remote") + (play-from-hand state :corp "Mausolus" "HQ") + (take-credits state :corp) + (let [malia1 (get-content state :remote1 0) + malia2 (get-content state :remote2 0) + mausolus (get-ice state :hq 0)] + (play-from-hand state :runner "Daily Casts") + (take-credits state :runner) + (let [N (:credit (get-runner))] + (core/rez state :corp malia1) + (click-card state :corp (get-resource state 0)) + (take-credits state :corp) + (is (= N (:credit (get-runner))) "Daily casts did not trigger when blanked")) + (take-credits state :runner) + (core/derez state :corp malia1) + (let [N (:credit (get-runner))] + (take-credits state :corp) + (is (= (+ N 2) (:credit (get-runner))) "Daily casts triggers again when unblanked")) + (play-from-hand state :runner "Rachel Beckman") + (is (= 4 (:click (get-runner))) "Runner has 4 clicks after playing Beckman") + (core/rez state :corp malia1) + (click-card state :corp (get-resource state 1)) + (is (= 3 (:click (get-runner))) "Runner has 3 clicks after Beckman is blank") + (core/derez state :corp malia1) + (is (= 4 (:click (get-runner))) "Runner has 4 clicks after Beckman is unblanked") + (core/rez state :corp malia1) + (click-card state :corp (get-resource state 1)) + (core/rez state :corp mausolus) + (card-subroutine state :corp mausolus 2) + (is (and (= 1 (count-tags state)) + (zero? (count (:discard (get-runner))))) "Runner has 1 tag, but Rachel Beckman not trashed") + (take-credits state :runner) + (is (zero? (count (:hand (get-corp)))) "Malia is not in hand") + (core/move-card state :corp {:card malia1 :server "HQ"}) + (is (= 1 (count (:hand (get-corp)))) "Malia is in hand") + (is (= 1 (count (:discard (get-runner)))) "Rachel Beckman got trashed on unblanking") + (core/rez state :corp malia2) + (click-card state :corp (get-resource state 0)) + (let [N (:credit (get-runner))] + (take-credits state :corp) + (is (= N (:credit (get-runner))) "Daily casts is blank, so no drip"))) + (play-from-hand state :runner "Rumor Mill") + (take-credits state :runner) + (let [N (:credit (get-runner))] + (take-credits state :corp) + (is (= (+ N 2) (:credit (get-runner))))))) (deftest marilyn-campaign ;; Marilyn Campaign (do-game - (new-game - (default-corp ["Marilyn Campaign"]) - (default-runner)) + (new-game {:corp {:deck ["Marilyn Campaign"]}}) (play-from-hand state :corp "Marilyn Campaign" "New remote") (let [marilyn (get-content state :remote1 0)] (core/rez state :corp marilyn) @@ -2196,9 +2100,7 @@ (deftest mark-yale ;; Mark Yale (do-game - (new-game - (default-corp ["Mark Yale" "Project Atlas" (qty "Ice Wall" 10)]) - (default-runner)) + (new-game {:corp {:deck ["Mark Yale" "Project Atlas" (qty "Ice Wall" 10)]}}) (starting-hand state :corp ["Mark Yale" "Project Atlas"]) (core/gain state :corp :credit 100 :click 100) (play-from-hand state :corp "Mark Yale" "New remote") @@ -2223,9 +2125,7 @@ (deftest marked-accounts ;; Marked Accounts (do-game - (new-game - (default-corp ["Marked Accounts"]) - (default-runner)) + (new-game {:corp {:deck ["Marked Accounts"]}}) (play-from-hand state :corp "Marked Accounts" "New remote") (let [ma (get-content state :remote1 0)] (core/rez state :corp ma) @@ -2239,9 +2139,7 @@ (deftest mca-austerity-policy (do-game - (new-game - (default-corp ["MCA Austerity Policy"]) - (default-runner)) + (new-game {:corp {:deck ["MCA Austerity Policy"]}}) (play-from-hand state :corp "MCA Austerity Policy" "New remote") (let [mca (get-content state :remote1 0)] (core/rez state :corp mca) @@ -2265,11 +2163,10 @@ (card-ability state :corp (refresh mca) 1) (is (= 5 (:click (get-corp))))))) -(deftest melange-mining-corp. +(deftest melange-mining-corp ;; Melange Mining Corp. (do-game - (new-game (default-corp ["Melange Mining Corp."]) - (default-runner)) + (new-game {:corp {:deck ["Melange Mining Corp."]}}) (play-from-hand state :corp "Melange Mining Corp." "New remote") (take-credits state :corp) (take-credits state :runner) @@ -2284,8 +2181,7 @@ (deftest mental-health-clinic ;; Mental Health Clinic - Gain 1 credit when turn begins; Runner max hand size increased by 1 (do-game - (new-game (default-corp ["Mental Health Clinic"]) - (default-runner)) + (new-game {:corp {:deck ["Mental Health Clinic"]}}) (play-from-hand state :corp "Mental Health Clinic" "New remote") (let [mhc (get-content state :remote1 0)] (core/rez state :corp mhc) @@ -2294,11 +2190,10 @@ (take-credits state :runner) (is (= 8 (:credit (get-corp))) "Gained 1 credit at start of turn")))) -(deftest mr.-stone +(deftest mr-stone ;; Mr Stone (do-game - (new-game (default-corp ["Mr. Stone"]) - (default-runner)) + (new-game {:corp {:deck ["Mr. Stone"]}}) (play-from-hand state :corp "Mr. Stone" "New remote") (let [stone (get-content state :remote1 0)] (core/rez state :corp stone) @@ -2310,8 +2205,7 @@ (deftest mumba-temple ;; Mumba Temple (do-game - (new-game (default-corp ["Mumba Temple"]) - (default-runner)) + (new-game {:corp {:deck ["Mumba Temple"]}}) (play-from-hand state :corp "Mumba Temple" "New remote") (let [mumba (get-content state :remote1 0)] (core/rez state :corp mumba) @@ -2320,10 +2214,9 @@ (deftest mumbad-city-hall ;; Mumbad City Hall (do-game - (new-game (default-corp ["Mumbad City Hall" + (new-game {:corp {:deck ["Mumbad City Hall" "PAD Factory" - "Salem's Hospitality"]) - (default-runner)) + "Salem's Hospitality"]}}) (core/gain state :corp :click 3 :credit 100) (starting-hand state :corp ["Mumbad City Hall"]) (play-from-hand state :corp "Mumbad City Hall" "New remote") @@ -2338,12 +2231,11 @@ (click-prompt state :corp "Sure Gamble") (is (= 3 (-> (get-runner) :discard count)) "Runner should have discarded all cards from Salem's Hospitality")))) -(deftest mumbad-construction-co. +(deftest mumbad-construction-co ;; Mumbad Construction Co. (do-game - (new-game (default-corp ["Mumbad Construction Co." - "Oaktown Renovation"]) - (default-runner)) + (new-game {:corp {:deck ["Mumbad Construction Co." + "Oaktown Renovation"]}}) (play-from-hand state :corp "Mumbad Construction Co." "New remote") (play-from-hand state :corp "Oaktown Renovation" "New remote") (let [mcc (get-content state :remote1 0) @@ -2364,9 +2256,8 @@ (deftest museum-of-history ;; Museum of History (do-game - (new-game (default-corp ["Museum of History" "Beanstalk Royalties" - (qty "Ice Wall" 10)]) - (default-runner)) + (new-game {:corp {:deck ["Museum of History" "Beanstalk Royalties" + (qty "Ice Wall" 10)]}}) (starting-hand state :corp ["Beanstalk Royalties" "Museum of History"]) (play-from-hand state :corp "Beanstalk Royalties") (play-from-hand state :corp "Museum of History" "New remote") @@ -2383,8 +2274,7 @@ (deftest nasx ;; NASX (do-game - (new-game (default-corp ["NASX"]) - (default-runner)) + (new-game {:corp {:deck ["NASX"]}}) (play-from-hand state :corp "NASX" "New remote") (let [nasx (get-content state :remote1 0)] (core/rez state :corp nasx) @@ -2410,8 +2300,8 @@ (deftest net-analytics ;; Draw a card when runner avoids or removes 1 or more tags (do-game - (new-game (default-corp [(qty "Ghost Branch" 3) (qty "Net Analytics" 3)]) - (default-runner [(qty "New Angeles City Hall" 3)])) + (new-game {:corp {:deck [(qty "Ghost Branch" 3) (qty "Net Analytics" 3)]} + :runner {:deck [(qty "New Angeles City Hall" 3)]}}) (starting-hand state :corp ["Net Analytics" "Ghost Branch"]) (play-from-hand state :corp "Ghost Branch" "New remote") (play-from-hand state :corp "Net Analytics" "New remote") @@ -2445,10 +2335,10 @@ (deftest net-police ;; Net Police - Recurring credits equal to Runner's link (do-game - (new-game - (default-corp ["Net Police"]) - (make-deck "Sunny Lebeau: Security Specialist" ["Dyson Mem Chip" - "Access to Globalsec"])) + (new-game {:corp {:deck ["Net Police"]} + :runner {:id "Sunny Lebeau: Security Specialist" + :deck ["Dyson Mem Chip" + "Access to Globalsec"]}}) (play-from-hand state :corp "Net Police" "New remote") (is (= 2 (:link (get-runner)))) (let [netpol (get-content state :remote1 0)] @@ -2466,9 +2356,8 @@ (deftest neurostasis ;; Neurostasis - ambush, shuffle cards into the stack (do-game - (new-game - (default-corp ["Neurostasis"]) - (default-runner [(qty "Cache" 3)])) + (new-game {:corp {:deck ["Neurostasis"]} + :runner {:deck [(qty "Cache" 3)]}}) (play-from-hand state :corp "Neurostasis" "New remote") (let [neuro (get-content state :remote1 0)] ;; Single advance Neurostasis @@ -2503,8 +2392,7 @@ (deftest news-team ;; News Team - on access take 2 tags or take as agenda worth -1 (do-game - (new-game (default-corp [(qty "News Team" 3) "Blacklist"]) - (default-runner)) + (new-game {:corp {:deck [(qty "News Team" 3) "Blacklist"]}}) (trash-from-hand state :corp "News Team") (play-from-hand state :corp "Blacklist" "New remote") (take-credits state :corp) @@ -2523,8 +2411,7 @@ (deftest ngo-front ;; NGO Front - full test (do-game - (new-game (default-corp [(qty "NGO Front" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "NGO Front" 3)]}}) (core/gain state :corp :click 3) (play-from-hand state :corp "NGO Front" "New remote") (play-from-hand state :corp "NGO Front" "New remote") @@ -2556,8 +2443,7 @@ (deftest open-forum ;; Open Forum (do-game - (new-game (default-corp ["Open Forum" "Ice Wall" "Fire Wall" "Enigma"]) - (default-runner)) + (new-game {:corp {:deck ["Open Forum" "Ice Wall" "Fire Wall" "Enigma"]}}) (play-from-hand state :corp "Open Forum" "New remote") (core/move state :corp (find-card "Ice Wall" (:hand (get-corp))) :deck) (core/move state :corp (find-card "Fire Wall" (:hand (get-corp))) :deck) @@ -2575,8 +2461,7 @@ (deftest pad-campaign ;; PAD Campaign (do-game - (new-game (default-corp ["PAD Campaign"]) - (default-runner)) + (new-game {:corp {:deck ["PAD Campaign"]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (let [pad (get-content state :remote1 0)] (core/rez state :corp pad) @@ -2588,8 +2473,7 @@ (deftest pad-factory ;; PAD Factory - Click to place an advancement, cannot score target until next turn (do-game - (new-game (default-corp ["PAD Factory" "15 Minutes"]) - (default-runner)) + (new-game {:corp {:deck ["PAD Factory" "15 Minutes"]}}) (core/gain state :corp :click 1) (play-from-hand state :corp "PAD Factory" "New remote") (play-from-hand state :corp "15 Minutes" "New remote") @@ -2612,8 +2496,7 @@ (deftest palana-agroplex ;; Pālanā Agroplex - Both players draw 1 at start of Corp turn (do-game - (new-game (default-corp ["Pālanā Agroplex" (qty "Hedge Fund" 3)]) - (default-runner)) + (new-game {:corp {:deck ["Pālanā Agroplex" (qty "Hedge Fund" 3)]}}) (starting-hand state :corp ["Pālanā Agroplex"]) (starting-hand state :runner ["Sure Gamble"]) (play-from-hand state :corp "Pālanā Agroplex" "New remote") @@ -2628,8 +2511,8 @@ ;; Personalized Portal - on corp turn start, force the runner to draw 1 card ;; and then gain 1 credit for every 2 cards in the runners hand (do-game - (new-game (default-corp ["Personalized Portal"]) - (default-runner [(qty "Daily Casts" 3) (qty "Dyson Mem Chip" 3)])) + (new-game {:corp {:deck ["Personalized Portal"]} + :runner {:deck [(qty "Daily Casts" 3) (qty "Dyson Mem Chip" 3)]}}) (play-from-hand state :corp "Personalized Portal" "New remote") (core/rez state :corp (get-content state :remote1 0)) (take-credits state :corp) @@ -2651,11 +2534,10 @@ (deftest plan-b ;; Plan B - score agenda with adv cost <= # of adv counters (do-game - (new-game (default-corp ["Plan B" + (new-game {:corp {:deck ["Plan B" "Braintrust" "The Future Perfect" - "Mushin No Shin"]) - (default-runner)) + "Mushin No Shin"]}}) (play-from-hand state :corp "Mushin No Shin") (click-card state :corp (find-card "Plan B" (:hand (get-corp)))) (take-credits state :corp) @@ -2673,8 +2555,7 @@ ;; Political Dealings (testing "Full test" (do-game - (new-game (default-corp ["Political Dealings" "Medical Breakthrough" "Oaktown Renovation"]) - (default-runner)) + (new-game {:corp {:deck ["Political Dealings" "Medical Breakthrough" "Oaktown Renovation"]}}) (core/move state :corp (find-card "Medical Breakthrough" (:hand (get-corp))) :deck) (core/move state :corp (find-card "Oaktown Renovation" (:hand (get-corp))) :deck) (play-from-hand state :corp "Political Dealings" "New remote") @@ -2695,9 +2576,8 @@ "Oaktown Renovation installed face up"))) (testing "Daily Business Show interaction - Draw 2 agendas, install both of them but return 1 to bottom of R&D" (do-game - (new-game (default-corp ["Political Dealings" "Daily Business Show" "Turtlebacks" - "Breaking News" "Project Beale"]) - (default-runner)) + (new-game {:corp {:deck ["Political Dealings" "Daily Business Show" "Turtlebacks" + "Breaking News" "Project Beale"]}}) (starting-hand state :corp ["Political Dealings" "Daily Business Show" "Turtlebacks"]) (core/gain state :corp :credit 3) (play-from-hand state :corp "Political Dealings" "New remote") @@ -2731,8 +2611,7 @@ (deftest primary-transmission-dish ;; Primary Transmission Dish (do-game - (new-game (default-corp ["Primary Transmission Dish"]) - (default-runner)) + (new-game {:corp {:deck ["Primary Transmission Dish"]}}) (play-from-hand state :corp "Primary Transmission Dish" "New remote") (let [dish (get-content state :remote1 0)] (core/rez state :corp dish) @@ -2741,8 +2620,7 @@ (deftest private-contracts ;; Private Contracts (do-game - (new-game (default-corp ["Private Contracts"]) - (default-runner)) + (new-game {:corp {:deck ["Private Contracts"]}}) (play-from-hand state :corp "Private Contracts" "New remote") (let [pri (get-content state :remote1 0)] (core/rez state :corp pri) @@ -2758,8 +2636,8 @@ (deftest project-junebug ;; Project Junebug (do-game - (new-game (default-corp ["Project Junebug"]) - (default-runner [(qty "Sure Gamble" 100)])) + (new-game {:corp {:deck ["Project Junebug"]} + :runner {:deck [(qty "Sure Gamble" 100)]}}) (play-from-hand state :corp "Project Junebug" "New remote") (advance state (get-content state :remote1 0) 2) (take-credits state :corp) @@ -2773,8 +2651,8 @@ (testing "Basic test" ;; Psychic Field - Do 1 net damage for every card in Runner's hand when accessed/exposed (do-game - (new-game (default-corp [(qty "Psychic Field" 2)]) - (default-runner [(qty "Infiltration" 3) (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Psychic Field" 2)]} + :runner {:deck [(qty "Infiltration" 3) (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Psychic Field" "New remote") (play-from-hand state :corp "Psychic Field" "New remote") (let [psyf1 (get-content state :remote1 0) @@ -2797,8 +2675,7 @@ (is (= 6 (count (:discard (get-runner)))) "Suffered 3 net damage on access and psi loss")))) (testing "when in Archives. #1965" (do-game - (new-game (default-corp [(qty "Psychic Field" 2) (qty "Shock!" 2) (qty "Clone Retirement" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Psychic Field" 2) (qty "Shock!" 2) (qty "Clone Retirement" 2)]}}) (trash-from-hand state :corp "Psychic Field") (trash-from-hand state :corp "Shock!") (trash-from-hand state :corp "Clone Retirement") @@ -2809,8 +2686,8 @@ "Psychic Field is not a choice to access in Archives"))) (testing "Interaction with Neutralize All Threats and Hostile Infrastructure, #1208" (do-game - (new-game (default-corp [(qty "Psychic Field" 3) (qty "Hostile Infrastructure" 3)]) - (default-runner ["Neutralize All Threats" (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Psychic Field" 3) (qty "Hostile Infrastructure" 3)]} + :runner {:deck ["Neutralize All Threats" (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Psychic Field" "New remote") (play-from-hand state :corp "Hostile Infrastructure" "New remote") (core/rez state :corp (get-content state :remote2 0)) @@ -2827,8 +2704,7 @@ ;; Public support scoring and trashing ;; TODO could also test for NOT triggering "when scored" events (do-game - (new-game (default-corp [(qty "Public Support" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Public Support" 2)]}}) ;; Corp turn 1, install and rez public supports (play-from-hand state :corp "Public Support" "New remote") (play-from-hand state :corp "Public Support" "New remote") @@ -2866,9 +2742,7 @@ (deftest quarantine-system ;; Forfeit agenda to rez up to 3 ICE with 2 credit discount per agenda point (do-game - (new-game - (default-corp [(qty "Chiyashi" 3) "Quarantine System" "Project Beale"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Chiyashi" 3) "Quarantine System" "Project Beale"]}}) (core/gain state :corp :credit 100) (core/gain state :corp :click 100) (play-from-hand state :corp "Chiyashi" "HQ") @@ -2900,8 +2774,7 @@ (deftest raman-rai ;; Raman Rai (do-game - (new-game (default-corp ["Raman Rai" "Ice Wall" "Fire Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Raman Rai" "Ice Wall" "Fire Wall"]}}) (play-from-hand state :corp "Raman Rai" "New remote") (let [raman (get-content state :remote1 0)] (core/move state :corp (find-card "Ice Wall" (:hand (get-corp))) :deck) @@ -2918,8 +2791,7 @@ ;; Rashida Jaheem (testing "when there are enough cards in R&D" (do-game - (new-game (default-corp ["Rashida Jaheem" (qty "Hedge Fund" 3)]) - (default-runner)) + (new-game {:corp {:deck ["Rashida Jaheem" (qty "Hedge Fund" 3)]}}) (starting-hand state :corp ["Rashida Jaheem"]) (play-from-hand state :corp "Rashida Jaheem" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -2934,8 +2806,7 @@ (is (= (+ 3 cards) (count (:hand (get-corp)))))))) (testing "when there aren't enough cards in R&D" (do-game - (new-game (default-corp ["Rashida Jaheem" (qty "Hedge Fund" 4)]) - (default-runner)) + (new-game {:corp {:deck ["Rashida Jaheem" (qty "Hedge Fund" 4)]}}) (starting-hand state :corp ["Rashida Jaheem"]) (play-from-hand state :corp "Rashida Jaheem" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -2955,8 +2826,7 @@ (deftest reality-threedee ;; Reality Threedee - Take 1 bad pub on rez; gain 1c at turn start (2c if Runner tagged) (do-game - (new-game (default-corp ["Reality Threedee"]) - (default-runner)) + (new-game {:corp {:deck ["Reality Threedee"]}}) (play-from-hand state :corp "Reality Threedee" "New remote") (let [r3d (get-content state :remote1 0)] (core/rez state :corp r3d) @@ -2972,8 +2842,8 @@ (deftest reconstruction-contract ;; Reconstruction Contract - place advancement token when runner takes meat damage (do-game - (new-game (default-corp ["Reconstruction Contract" "Scorched Earth" "Pup"]) - (default-runner [(qty "Sure Gamble" 3) (qty "Imp" 3)])) + (new-game {:corp {:deck ["Reconstruction Contract" "Scorched Earth" "Pup"]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Imp" 3)]}}) (core/gain-tags state :runner 1) (core/gain state :corp :credit 5) (starting-hand state :runner ["Sure Gamble" "Sure Gamble" "Sure Gamble" "Imp" "Imp"]) @@ -2993,8 +2863,7 @@ (deftest reversed-accounts ;; Reversed Accounts - Trash to make Runner lose 4 credits per advancement (do-game - (new-game (default-corp ["Reversed Accounts"]) - (default-runner)) + (new-game {:corp {:deck ["Reversed Accounts"]}}) (play-from-hand state :corp "Reversed Accounts" "New remote") (let [rev (get-content state :remote1 0)] (core/advance state :corp {:card (refresh rev)}) @@ -3017,8 +2886,7 @@ ;; Rex Campaign (testing "Gain 5 credits" (do-game - (new-game (default-corp ["Rex Campaign"]) - (default-runner)) + (new-game {:corp {:deck ["Rex Campaign"]}}) (play-from-hand state :corp "Rex Campaign" "New remote") (let [rex (get-content state :remote1 0)] (core/rez state :corp rex) @@ -3038,8 +2906,7 @@ (is (= "Rex Campaign" (-> (get-corp) :discard first :title))))))) (testing "Lose 1 bad publicity" (do-game - (new-game (default-corp ["Rex Campaign"]) - (default-runner)) + (new-game {:corp {:deck ["Rex Campaign"]}}) (core/gain-bad-publicity state :corp 1) (play-from-hand state :corp "Rex Campaign" "New remote") (let [rex (get-content state :remote1 0)] @@ -3061,8 +2928,7 @@ (deftest ronald-five ;; Ronald Five - Runner loses a click every time they trash a Corp card (do-game - (new-game (default-corp ["Ronald Five" "Melange Mining Corp."]) - (default-runner)) + (new-game {:corp {:deck ["Ronald Five" "Melange Mining Corp."]}}) (play-from-hand state :corp "Ronald Five" "New remote") (play-from-hand state :corp "Melange Mining Corp." "New remote") (take-credits state :corp) @@ -3078,8 +2944,7 @@ ;; Ronin - Click-trash to do 3 net damage when it has 4 or more advancements (testing "Basic test" (do-game - (new-game (default-corp ["Ronin" "Mushin No Shin"]) - (default-runner)) + (new-game {:corp {:deck ["Ronin" "Mushin No Shin"]}}) (play-from-hand state :corp "Mushin No Shin") (click-card state :corp (find-card "Ronin" (:hand (get-corp)))) (let [ron (get-content state :remote1 0)] @@ -3096,8 +2961,7 @@ (is (= 2 (count (:discard (get-corp)))) "Ronin trashed")))) (testing "doesn't fire (or crash) if no advance counters" (do-game - (new-game (default-corp ["Ronin"]) - (default-runner)) + (new-game {:corp {:deck ["Ronin"]}}) (play-from-hand state :corp "Ronin" "New remote") (let [ron (get-content state :remote1 0)] (is (zero? (get-counters (refresh ron) :advancement)) "Ronin starts with no counters") @@ -3109,8 +2973,7 @@ (deftest sandburg ;; Sandburg - +1 strength to all ICE for every 5c when Corp has over 10c (do-game - (new-game (default-corp ["Sandburg" (qty "Ice Wall" 2) (qty "Hedge Fund" 3)]) - (default-runner)) + (new-game {:corp {:deck ["Sandburg" (qty "Ice Wall" 2) (qty "Hedge Fund" 3)]}}) (core/gain state :corp :click 3 :credit 3) (play-from-hand state :corp "Sandburg" "New remote") (play-from-hand state :corp "Ice Wall" "HQ") @@ -3140,8 +3003,7 @@ (deftest sealed-vault ;; Sealed Vault - Store credits for 1c, retrieve credits by trashing or spending click (do-game - (new-game (default-corp ["Sealed Vault" "Hedge Fund"]) - (default-runner)) + (new-game {:corp {:deck ["Sealed Vault" "Hedge Fund"]}}) (play-from-hand state :corp "Sealed Vault" "New remote") (play-from-hand state :corp "Hedge Fund") (let [sv (get-content state :remote1 0)] @@ -3167,8 +3029,7 @@ (deftest security-subcontract ;; Security Subcontract (do-game - (new-game (default-corp ["Security Subcontract" "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Security Subcontract" "Ice Wall"]}}) (play-from-hand state :corp "Security Subcontract" "New remote") (play-from-hand state :corp "Ice Wall" "HQ") (let [ss (get-content state :remote1 0) @@ -3186,8 +3047,7 @@ (deftest sensie-actors-union ;; Sensie Actors Union (do-game - (new-game (default-corp ["Sensie Actors Union" "Ronin" (qty "Ice Wall" 10)]) - (default-runner)) + (new-game {:corp {:deck ["Sensie Actors Union" "Ronin" (qty "Ice Wall" 10)]}}) (starting-hand state :corp ["Sensie Actors Union" "Ronin"]) (core/move state :corp (find-card "Ronin" (:hand (get-corp))) :deck {:front true}) (play-from-hand state :corp "Sensie Actors Union" "New remote") @@ -3211,9 +3071,8 @@ (deftest server-diagnostics ;; Server Diagnostics - Gain 2c when turn begins; trashed when ICE is installed (do-game - (new-game (default-corp ["Server Diagnostics" "Pup" - "Launch Campaign"]) - (default-runner)) + (new-game {:corp {:deck ["Server Diagnostics" "Pup" + "Launch Campaign"]}}) (play-from-hand state :corp "Server Diagnostics" "New remote") (core/rez state :corp (get-content state :remote1 0)) (play-from-hand state :corp "Launch Campaign" "New remote") @@ -3227,8 +3086,7 @@ (deftest shannon-claire ;; Shannon Claire (do-game - (new-game (default-corp ["Shannon Claire" "Hostile Takeover" "Ronin" (qty "Ice Wall" 10)]) - (default-runner)) + (new-game {:corp {:deck ["Shannon Claire" "Hostile Takeover" "Ronin" (qty "Ice Wall" 10)]}}) (starting-hand state :corp ["Shannon Claire" "Ronin"]) (core/move state :corp (find-card "Ronin" (:hand (get-corp))) :deck) (play-from-hand state :corp "Shannon Claire" "New remote") @@ -3259,8 +3117,8 @@ (deftest shattered-remains ;; Shattered Remains (do-game - (new-game (default-corp [(qty "Shattered Remains" 2)]) - (default-runner ["Cyberfeeder" "Lemuria Codecracker"])) + (new-game {:corp {:deck [(qty "Shattered Remains" 2)]} + :runner {:deck ["Cyberfeeder" "Lemuria Codecracker"]}}) (play-from-hand state :corp "Shattered Remains" "New remote") (play-from-hand state :corp "Shattered Remains" "New remote") (take-credits state :corp) @@ -3285,11 +3143,11 @@ (is (= (- credits 1) (:credit (get-corp))) "Shattered Remains ability should cost 1") (is (count (:discard (get-runner))) "Cyberfeeder should be in discard from Shattered Remains"))))) -(deftest shi.kyu +(deftest shi-kyu ;; Shi.Kyū (do-game - (new-game (default-corp ["Shi.Kyū"]) - (default-runner [(qty "Sure Gamble" 5)])) + (new-game {:corp {:deck ["Shi.Kyū"]} + :runner {:deck [(qty "Sure Gamble" 5)]}}) (play-from-hand state :corp "Shi.Kyū" "New remote") (take-credits state :corp) (run-empty-server state "Server 1") @@ -3307,12 +3165,11 @@ (is (empty? (prompt-map :runner)) "Runner shouldn't get the option to trash Shi.Kyū as it was added to agenda area") (is (= -1 (:agenda-point (get-runner))) "Runner should be at -1 agenda points after adding Shi.Kyū to agenda area"))) -(deftest shock! +(deftest shock ;; Shock! - do 1 net damage on access (testing "Basic test" (do-game - (new-game (default-corp [(qty "Shock!" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Shock!" 3)]}}) (trash-from-hand state :corp "Shock!") (play-from-hand state :corp "Shock!" "New remote") (take-credits state :corp) @@ -3322,8 +3179,7 @@ (is (= 1 (count (:hand (get-runner)))) "Runner took 1 net damage"))) (testing "ensure :access flag is cleared on run end. Issue #2319" (do-game - (new-game (default-corp [(qty "Shock!" 3) "Chairman Hiro"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Shock!" 3) "Chairman Hiro"]}}) (trash-from-hand state :corp "Shock!") (play-from-hand state :corp "Shock!" "New remote") (take-credits state :corp) @@ -3338,29 +3194,27 @@ ;; SIU (testing "Flags 1.2 and trace for tag with base 3" (do-game - (new-game (default-corp [(qty "SIU" 10)]) - (default-runner)) - (play-from-hand state :corp "SIU" "New remote") - (let [siu (get-content state :remote1 0)] - (core/rez state :corp siu) - (card-ability state :corp (refresh siu) 0) ; try to trigger SIU outside phase 1.2 - (is (= 0 (-> (get-corp) :discard count)) "SIU should not trigger because it's not 1.2") - (take-credits state :corp) - (take-credits state :runner) - (is (:corp-phase-12 @state) "Corp is in Step 1.2 because SIU is on the table") - (card-ability state :corp (refresh siu) 0) - (is (= 1 (-> (get-corp) :discard count)) "SIU should discard to fire trace") - (is (= 3 (-> (get-corp) :prompt first :base)) "Base Trace should be 3") - (click-prompt state :corp "0") - (click-prompt state :runner "0") - (is (= 1 (count-tags state)) "Runner has 1 tag"))))) - -(deftest snare! + (new-game {:corp {:deck [(qty "SIU" 10)]}}) + (play-from-hand state :corp "SIU" "New remote") + (let [siu (get-content state :remote1 0)] + (core/rez state :corp siu) + (card-ability state :corp (refresh siu) 0) ; try to trigger SIU outside phase 1.2 + (is (= 0 (-> (get-corp) :discard count)) "SIU should not trigger because it's not 1.2") + (take-credits state :corp) + (take-credits state :runner) + (is (:corp-phase-12 @state) "Corp is in Step 1.2 because SIU is on the table") + (card-ability state :corp (refresh siu) 0) + (is (= 1 (-> (get-corp) :discard count)) "SIU should discard to fire trace") + (is (= 3 (-> (get-corp) :prompt first :base)) "Base Trace should be 3") + (click-prompt state :corp "0") + (click-prompt state :runner "0") + (is (= 1 (count-tags state)) "Runner has 1 tag"))))) + +(deftest snare (testing "Basic test" ;; pay 4 on access, and do 3 net damage and give 1 tag (do-game - (new-game (default-corp [(qty "Snare!" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Snare!" 3)]}}) (play-from-hand state :corp "Snare!" "New remote") (take-credits state :corp) (run-empty-server state "Server 1") @@ -3372,8 +3226,8 @@ (is (zero? (count (:hand (get-runner)))) "Runner took 3 net damage"))) (testing "Can't afford" (do-game - (new-game (default-corp ["Snare!"]) - (default-runner [(qty "Sure Gamble" 3) (qty "Diesel" 3)])) + (new-game {:corp {:deck ["Snare!"]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Diesel" 3)]}}) (play-from-hand state :corp "Snare!" "New remote") (take-credits state :corp) (core/lose state :corp :credit 7) @@ -3387,8 +3241,8 @@ (is (zero? (count (:discard (get-runner)))) "Runner took no damage"))) (testing "with Dedicated Response Team" (do-game - (new-game (default-corp ["Snare!" "Dedicated Response Team"]) - (default-runner [(qty "Sure Gamble" 3) (qty "Diesel" 3)])) + (new-game {:corp {:deck ["Snare!" "Dedicated Response Team"]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Diesel" 3)]}}) (play-from-hand state :corp "Snare!" "New remote") (play-from-hand state :corp "Dedicated Response Team" "New remote") (core/gain state :corp :click 1 :credit 4) @@ -3407,8 +3261,7 @@ (deftest space-camp (testing "when in Archives. #1929" (do-game - (new-game (default-corp ["Space Camp" "News Team" "Breaking News"]) - (default-runner)) + (new-game {:corp {:deck ["Space Camp" "News Team" "Breaking News"]}}) (trash-from-hand state :corp "Space Camp") (trash-from-hand state :corp "News Team") (play-from-hand state :corp "Breaking News" "New remote") @@ -3426,8 +3279,7 @@ (deftest student-loans ;; Student Loans - costs Runner 2c extra to play event if already same one in discard (do-game - (new-game (default-corp ["Student Loans" (qty "Hedge Fund" 2)]) - (default-runner)) + (new-game {:corp {:deck ["Student Loans" (qty "Hedge Fund" 2)]}}) (core/gain state :corp :credit 2) (play-from-hand state :corp "Student Loans" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -3448,8 +3300,7 @@ ;; Sundew (testing "Basic test" (do-game - (new-game (default-corp ["Sundew"]) - (default-runner)) + (new-game {:corp {:deck ["Sundew"]}}) (play-from-hand state :corp "Sundew" "New remote") (let [sund (get-content state :remote1 0)] (core/rez state :corp sund) @@ -3460,28 +3311,26 @@ (is (= 7 (:credit (get-corp))) "Corp gained 2cr from Sundew") (take-credits state :corp) (run-on state "Server 1") - (is (= 10 (:credit (get-corp))) "Corp did not gain 2cr from run on Sundew") + ; (is (= 10 (:credit (get-corp))) "Corp did not gain 2cr from run on Sundew") (is (= 3 (:click (get-runner))) "Runner spent 1 click to start run")))) - ; (testing "Sundew - Dirty Laundry" - ; (do-game - ; (new-game (default-corp ["Sundew"]) - ; (default-runner ["Dirty Laundry"])) - ; (play-from-hand state :corp "Sundew" "New remote") - ; (let [sund (get-content state :remote1 0)] - ; (core/rez state :corp (refresh sund)) - ; (is (= 3 (:credit (get-corp))) "Cost 2cr to rez") - ; (take-credits state :corp) - ; (play-from-hand state :runner "Dirty Laundry") - ; (click-prompt state :runner "Server 1") - ; ;; spend a click on a run through a card, not through click-run - ; (is (= 5 (:credit (get-corp))) "Corp did not gain 2cr from run on Sundew")))) - ) + (testing "Sundew - Dirty Laundry" + (do-game + (new-game {:corp {:deck ["Sundew"]} + :runner {:deck ["Dirty Laundry"]}}) + (play-from-hand state :corp "Sundew" "New remote") + (let [sund (get-content state :remote1 0)] + (core/rez state :corp (refresh sund)) + (is (= 3 (:credit (get-corp))) "Cost 2cr to rez") + (take-credits state :corp) + (play-from-hand state :runner "Dirty Laundry") + (click-prompt state :runner "Server 1") + ;; spend a click on a run through a card, not through click-run + (is (= 5 (:credit (get-corp))) "Corp did not gain 2cr from run on Sundew"))))) (deftest synth-dna-modification ;; Synth DNA Modification (do-game - (new-game (default-corp ["Synth DNA Modification" "Data Mine"]) - (default-runner)) + (new-game {:corp {:deck ["Synth DNA Modification" "Data Mine"]}}) (play-from-hand state :corp "Synth DNA Modification" "New remote") (play-from-hand state :corp "Data Mine" "HQ") (let [dna (get-content state :remote1 0) @@ -3501,10 +3350,9 @@ ;; Team Sponsorship (testing "Install from HQ" (do-game - (new-game (default-corp ["Domestic Sleepers" + (new-game {:corp {:deck ["Domestic Sleepers" "Team Sponsorship" - "Adonis Campaign"]) - (default-runner)) + "Adonis Campaign"]}}) (play-from-hand state :corp "Team Sponsorship" "New remote") (play-from-hand state :corp "Domestic Sleepers" "New remote") (let [ag1 (get-content state :remote2 0) @@ -3518,10 +3366,9 @@ (is (nil? (find-card "Adonis Campaign" (:hand (get-corp)))) "No Adonis in hand")))) (testing "Install from Archives" (do-game - (new-game (default-corp ["Domestic Sleepers" + (new-game {:corp {:deck ["Domestic Sleepers" "Team Sponsorship" - "Adonis Campaign"]) - (default-runner)) + "Adonis Campaign"]}}) (play-from-hand state :corp "Team Sponsorship" "New remote") (play-from-hand state :corp "Domestic Sleepers" "New remote") (trash-from-hand state :corp "Adonis Campaign") @@ -3536,10 +3383,9 @@ (is (nil? (find-card "Adonis Campaign" (:discard (get-corp)))) "No Adonis in discard")))) (testing "Multiple installs" (do-game - (new-game (default-corp ["Domestic Sleepers" + (new-game {:corp {:deck ["Domestic Sleepers" (qty "Team Sponsorship" 2) - (qty "Adonis Campaign" 2)]) - (default-runner)) + (qty "Adonis Campaign" 2)]}}) (play-from-hand state :corp "Team Sponsorship" "New remote") (play-from-hand state :corp "Team Sponsorship" "New remote") (play-from-hand state :corp "Domestic Sleepers" "New remote") @@ -3561,11 +3407,10 @@ "Adonis installed by Team Sponsorship")))) (testing "Score 5 points in one window" (do-game - (new-game (default-corp [(qty "AstroScript Pilot Program" 3) + (new-game {:corp {:deck [(qty "AstroScript Pilot Program" 3) "Team Sponsorship" "Breaking News" - "SanSan City Grid"]) - (default-runner)) + "SanSan City Grid"]}}) (play-from-hand state :corp "SanSan City Grid" "New remote") (core/gain state :corp :credit 100 :click 5) (core/rez state :corp (get-content state :remote1 0)) @@ -3595,8 +3440,7 @@ (deftest tech-startup ;; Tech Startup (do-game - (new-game (default-corp ["Tech Startup" "TechnoCo" (qty "Ice Wall" 10)]) - (default-runner)) + (new-game {:corp {:deck ["Tech Startup" "TechnoCo" (qty "Ice Wall" 10)]}}) (starting-hand state :corp ["Tech Startup"]) (play-from-hand state :corp "Tech Startup" "New remote") (let [tech (get-content state :remote1 0)] @@ -3614,11 +3458,11 @@ (deftest technoco ;; TechnoCo - Increase program / hardware / virtual cost by 1 and gain 1 when they are installed (do-game - (new-game (default-corp ["TechnoCo"]) - (default-runner ["Misdirection" ;; 0 cost program + (new-game {:corp {:deck ["TechnoCo"]} + :runner {:deck ["Misdirection" ;; 0 cost program "Bookmark" ;; 0 cost hardware "Ice Analyzer" ;; 0 cost virtual resource - "Fall Guy"])) ;; 0 cost non-virtual resource + "Fall Guy"]}}) ;; 0 cost non-virtual resource (play-from-hand state :corp "TechnoCo" "New remote") (core/rez state :corp (get-content state :remote1 0)) (take-credits state :corp) @@ -3640,9 +3484,8 @@ (deftest tenma-line ;; Tenma Line - Swap 2 pieces of installed ICE (do-game - (new-game (default-corp ["Tenma Line" "Harvester" - "Aimor" "Lockdown"]) - (default-runner)) + (new-game {:corp {:deck ["Tenma Line" "Harvester" + "Aimor" "Lockdown"]}}) (core/gain state :corp :click 2) (play-from-hand state :corp "Tenma Line" "New remote") (play-from-hand state :corp "Harvester" "HQ") @@ -3662,8 +3505,7 @@ (deftest test-ground ;; Test Ground (do-game - (new-game (default-corp ["Test Ground" "Ice Wall" "News Team"]) - (default-runner)) + (new-game {:corp {:deck ["Test Ground" "Ice Wall" "News Team"]}}) (core/gain state :corp :credit 100 :click 100) (play-from-hand state :corp "Test Ground" "New remote") (play-from-hand state :corp "Ice Wall" "New remote") @@ -3689,8 +3531,8 @@ ;; The Board (testing "Modify everything in the score area (regression test for #1938)" (do-game - (new-game (default-corp ["The Board" "News Team" (qty "Firmware Updates" 2)]) - (default-runner [(qty "Artist Colony" 3) (qty "Fan Site" 3)])) + (new-game {:corp {:deck ["The Board" "News Team" (qty "Firmware Updates" 2)]} + :runner {:deck [(qty "Artist Colony" 3) (qty "Fan Site" 3)]}}) (starting-hand state :runner ["Artist Colony" "Fan Site"]) (play-from-hand state :corp "The Board" "New remote") (play-from-hand state :corp "News Team" "New remote") @@ -3725,8 +3567,7 @@ (is (= 2 (:agenda-point (get-runner))) "Runner has 2 agenda points"))) (testing "handle Fifteen Minutes clicked out of Runner's score area" (do-game - (new-game (default-corp ["The Board" "15 Minutes"]) - (default-runner)) + (new-game {:corp {:deck ["The Board" "15 Minutes"]}}) (play-from-hand state :corp "The Board" "New remote") (play-from-hand state :corp "15 Minutes" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -3743,8 +3584,7 @@ (is (empty? (:scored (get-runner))) "Runner has no agendas in scored area")))) (testing "Corp scoring agenda shouldn't trigger The Board to lower Runner points" (do-game - (new-game (default-corp ["The Board" (qty "Hostile Takeover" 2)]) - (default-runner)) + (new-game {:corp {:deck ["The Board" (qty "Hostile Takeover" 2)]}}) (core/gain state :corp :credit 6) (play-from-hand state :corp "The Board" "New remote") (play-from-hand state :corp "Hostile Takeover" "New remote") @@ -3764,8 +3604,7 @@ (is (= 1 (count (:scored (get-runner)))) "Runner still has 1 agenda in scored area"))) (testing "Scoring two copies should be 4 agenda points" (do-game - (new-game (default-corp [(qty "The Board" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "The Board" 2)]}}) (core/gain state :corp :credit 6) (play-from-hand state :corp "The Board" "New remote") (play-from-hand state :corp "The Board" "New remote") @@ -3787,8 +3626,8 @@ (deftest the-news-now-hour ;; The News Now Hour (do-game - (new-game (default-corp ["The News Now Hour"]) - (default-runner ["Rumor Mill"])) + (new-game {:corp {:deck ["The News Now Hour"]} + :runner {:deck ["Rumor Mill"]}}) (play-from-hand state :corp "The News Now Hour" "New remote") (core/rez state :corp (get-content state :remote1 0)) (take-credits state :corp) @@ -3798,15 +3637,15 @@ (deftest the-root ;; The Root - recurring credits refill at Step 1.2 (do-game - (new-game (make-deck "Blue Sun: Powering the Future" ["The Root"]) - (default-runner)) + (new-game {:corp {:id "Blue Sun: Powering the Future" + :deck ["The Root"]}}) (play-from-hand state :corp "The Root" "New remote") (core/gain state :corp :credit 6) (let [root (get-content state :remote1 0)] (core/rez state :corp root) (card-ability state :corp (refresh root) 0) (is (= 2 (get-counters (refresh root) :recurring)) "Took 1 credit from The Root") - (is (= 6 (:credit (get-corp))) "Corp took Root credit into credit pool") + (is (= 6 (:credit (get-corp))) "Corp took Root credit into credit pool") (take-credits state :corp) (take-credits state :runner) ;; we expect Step 1.2 to have triggered because of Blue Sun @@ -3817,8 +3656,7 @@ ;; Thomas Haas (letfn [(haas-test [number] (do-game - (new-game (default-corp ["Thomas Haas"]) - (default-runner)) + (new-game {:corp {:deck ["Thomas Haas"]}}) (core/gain state :corp :credit 10 :click 10) (play-from-hand state :corp "Thomas Haas" "New remote") (let [haas (get-content state :remote1 0)] @@ -3838,8 +3676,8 @@ (deftest toshiyuki-sakai ;; Toshiyuki Sakai - Swap with an asset/agenda from HQ; Runner can choose to access new card or not (do-game - (new-game (default-corp ["Toshiyuki Sakai" "Project Junebug" "Hedge Fund"]) - (default-runner [(qty "Sure Gamble" 3) (qty "Easy Mark" 2)])) + (new-game {:corp {:deck ["Toshiyuki Sakai" "Project Junebug" "Hedge Fund"]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Easy Mark" 2)]}}) (play-from-hand state :corp "Toshiyuki Sakai" "New remote") (let [toshi (get-content state :remote1 0)] (core/advance state :corp {:card (refresh toshi)}) @@ -3863,8 +3701,7 @@ (deftest turtlebacks ;; Turtlebacks - Gain 1 credit for every new server created (do-game - (new-game (default-corp ["Turtlebacks" (qty "PAD Campaign" 2) "Wraparound"]) - (default-runner)) + (new-game {:corp {:deck ["Turtlebacks" (qty "PAD Campaign" 2) "Wraparound"]}}) (core/gain state :corp :click 1) (play-from-hand state :corp "Turtlebacks" "New remote") (let [tb (get-content state :remote1 0)] @@ -3879,8 +3716,8 @@ (deftest urban-renewal ;; Urban renewal meat damage (do-game - (new-game (default-corp ["Urban Renewal"]) - (default-runner [(qty "Sure Gamble" 3) (qty "Easy Mark" 2)])) + (new-game {:corp {:deck ["Urban Renewal"]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Easy Mark" 2)]}}) ;; Corp turn 1, install and rez urban renewal (play-from-hand state :corp "Urban Renewal" "New remote") (let [ur (get-content state :remote1 0)] @@ -3909,8 +3746,7 @@ (deftest victoria-jenkins ;; Victoria Jenkins (do-game - (new-game (default-corp ["Victoria Jenkins"]) - (default-runner)) + (new-game {:corp {:deck ["Victoria Jenkins"]}}) (play-from-hand state :corp "Victoria Jenkins" "New remote") (take-credits state :corp) (is (= 4 (:click (get-runner))) "Runner should have 4 clicks by default") @@ -3927,9 +3763,8 @@ (deftest warden-fatuma ;; Warden Fatuma - rezzed bioroid ice gains an additional sub (do-game - (new-game (default-corp ["Warden Fatuma" "Kakugo" - "Eli 2.0" "Ichi 2.0"]) - (default-runner)) + (new-game {:corp {:deck ["Warden Fatuma" "Kakugo" + "Eli 2.0" "Ichi 2.0"]}}) (core/gain state :corp :credit 20 :click 5) (play-from-hand state :corp "Kakugo" "Archives") (play-from-hand state :corp "Eli 2.0" "HQ") @@ -3960,8 +3795,7 @@ (deftest watchdog ;; Watchdog - Reduce rez cost of first ICE per turn by number of Runner tags (do-game - (new-game (default-corp ["Watchdog" "Architect" "Wraparound"]) - (default-runner)) + (new-game {:corp {:deck ["Watchdog" "Architect" "Wraparound"]}}) (play-from-hand state :corp "Watchdog" "New remote") (play-from-hand state :corp "Wraparound" "HQ") (play-from-hand state :corp "Architect" "HQ") @@ -3981,9 +3815,8 @@ (deftest whampoa-reclamation ;; Whampoa Reclamation: Enable trashing a card from HQ to place a card in Archives on the bottom of R&D (do-game - (new-game (default-corp [(qty "Whampoa Reclamation" 3) - (qty "Global Food Initiative" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Whampoa Reclamation" 3) + (qty "Global Food Initiative" 3)]}}) (play-from-hand state :corp "Whampoa Reclamation" "New remote") (core/trash state :corp (find-card "Whampoa Reclamation" (:hand (get-corp)))) (let [wr (get-content state :remote1 0) @@ -3999,11 +3832,10 @@ (deftest worlds-plaza ;; Worlds Plaza (do-game - (new-game (default-corp ["Worlds Plaza" + (new-game {:corp {:deck ["Worlds Plaza" "Personalized Portal" "Dedicated Response Team" - "Honeyfarm"]) - (default-runner)) + "Honeyfarm"]}}) (core/gain state :corp :credit 10 :click 10) (play-from-hand state :corp "Worlds Plaza" "New remote") (let [plaza (get-content state :remote1 0)] @@ -4025,8 +3857,8 @@ (deftest zaibatsu-loyalty ;; Zaibatsu Loyalty (do-game - (new-game (default-corp ["Zaibatsu Loyalty" "Ice Wall"]) - (default-runner ["Lemuria Codecracker"])) + (new-game {:corp {:deck ["Zaibatsu Loyalty" "Ice Wall"]} + :runner {:deck ["Lemuria Codecracker"]}}) (core/gain state :corp :click 10 :click 10) (play-from-hand state :corp "Zaibatsu Loyalty" "New remote") (play-from-hand state :corp "Ice Wall" "New remote") @@ -4056,8 +3888,7 @@ (deftest zealous-judge ;; Zealous Judge (do-game - (new-game (default-corp ["Zealous Judge"]) - (default-runner)) + (new-game {:corp {:deck ["Zealous Judge"]}}) (play-from-hand state :corp "Zealous Judge" "New remote") (let [judge (get-content state :remote1 0)] (core/rez state :corp judge) diff --git a/test/clj/game_test/cards/events.clj b/test/clj/game_test/cards/events.clj index ed0b58168f..249bed189d 100644 --- a/test/clj/game_test/cards/events.clj +++ b/test/clj/game_test/cards/events.clj @@ -7,14 +7,11 @@ [jinteki.utils :refer [count-tags]] [clojure.test :refer :all])) -(use-fixtures :once load-all-cards (partial reset-card-defs "events")) - (deftest account-siphon ;; Account Siphon (testing "Use ability" (do-game - (new-game (default-corp) - (default-runner [(qty "Account Siphon" 3)])) + (new-game {:runner {:deck [(qty "Account Siphon" 3)]}}) (take-credits state :corp) (is (= 8 (:credit (get-corp))) "Corp has 8 credits") ;; play Account Siphon, use ability @@ -25,8 +22,7 @@ (is (= 3 (:credit (get-corp))) "Corp lost 5 credits"))) (testing "Access" (do-game - (new-game (default-corp) - (default-runner [(qty "Account Siphon" 3)])) + (new-game {:runner {:deck [(qty "Account Siphon" 3)]}}) (take-credits state :corp) ; pass to runner's turn by taking credits (is (= 8 (:credit (get-corp))) "Corp has 8 credits") ;; play another Siphon, do not use ability @@ -38,9 +34,8 @@ (testing "New Angeles City Hall interaction" ;; Account Siphon - Access (do-game - (new-game (default-corp) - (default-runner ["Account Siphon" - "New Angeles City Hall"])) + (new-game {:runner {:deck ["Account Siphon" + "New Angeles City Hall"]}}) (core/gain state :corp :bad-publicity 1) (is (= 1 (:bad-publicity (get-corp))) "Corp has 1 bad publicity") (core/lose state :runner :credit 1) @@ -65,10 +60,9 @@ (deftest amped-up ;; Amped Up - Gain 3 clicks and take 1 unpreventable brain damage (do-game - (new-game (default-corp) - (default-runner ["Amped Up" + (new-game {:runner {:deck ["Amped Up" "Feedback Filter" - (qty "Sure Gamble" 3)])) + (qty "Sure Gamble" 3)]}}) (take-credits state :corp) (play-from-hand state :runner "Feedback Filter") (play-from-hand state :runner "Amped Up") @@ -79,13 +73,11 @@ (is (= 4 (core/hand-size state :runner)) "Runner handsize decreased by 1") (is (= 1 (:brain-damage (get-runner))) "Took 1 brain damage"))) -(deftest ^{:card-title "another-day,-another-paycheck"} - another-day-another-paycheck +(deftest another-day-another-paycheck ;; Another Day, Another Paycheck (do-game - (new-game - (default-corp [(qty "Project Atlas" 3)]) - (default-runner ["Street Peddler" (qty "Another Day, Another Paycheck" 2)])) + (new-game {:corp {:deck [(qty "Project Atlas" 3)]} + :runner {:deck ["Street Peddler" (qty "Another Day, Another Paycheck" 2)]}}) (starting-hand state :runner ["Street Peddler" "Another Day, Another Paycheck"]) (play-from-hand state :corp "Project Atlas" "New remote") (score-agenda state :corp (get-content state :remote1 0)) @@ -106,8 +98,8 @@ ;; Apocalypse (testing "Ensure MU is correct and no duplicate cards in heap" (do-game - (new-game (default-corp [(qty "Launch Campaign" 2) "Ice Wall"]) - (default-runner ["Scheherazade" "Corroder" "Hivemind" (qty "Apocalypse" 2)])) + (new-game {:corp {:deck [(qty "Launch Campaign" 2) "Ice Wall"]} + :runner {:deck ["Scheherazade" "Corroder" "Hivemind" (qty "Apocalypse" 2)]}}) (play-from-hand state :corp "Ice Wall" "New remote") (play-from-hand state :corp "Launch Campaign" "New remote") (play-from-hand state :corp "Launch Campaign" "New remote") @@ -143,10 +135,9 @@ (is (= 4 (core/available-mu state)) "Memory back to 4"))) (testing "with Full Immersion - no duplicate cards in heap #2606" (do-game - (new-game - (default-corp ["Full Immersion RecStudio" "Sandburg" - "Oaktown Renovation"]) - (default-runner ["Apocalypse"])) + (new-game {:corp {:deck ["Full Immersion RecStudio" "Sandburg" + "Oaktown Renovation"]} + :runner {:deck ["Apocalypse"]}}) (play-from-hand state :corp "Full Immersion RecStudio" "New remote") (let [fir (get-content state :remote1 0)] (core/rez state :corp fir) @@ -164,9 +155,8 @@ (is (= 1 (count (:discard (get-runner)))) "Only Apocalypse is in the heap")))) (testing "with Hostile Infrastructure - should take damage equal to 2x cards on the table" (do-game - (new-game - (default-corp [(qty "Hostile Infrastructure" 2) (qty "Ice Wall" 2)]) - (default-runner ["Apocalypse" (qty "Sure Gamble" 9)])) + (new-game {:corp {:deck [(qty "Hostile Infrastructure" 2) (qty "Ice Wall" 2)]} + :runner {:deck ["Apocalypse" (qty "Sure Gamble" 9)]}}) (core/gain state :corp :click 1) (play-from-hand state :corp "Hostile Infrastructure" "New remote") (play-from-hand state :corp "Ice Wall" "New remote") @@ -187,8 +177,8 @@ (is (= 9 (count (:discard (get-runner)))) "There are 9 cards in heap"))) (testing "Turn Runner cards facedown and reduce memory and hand-size gains" (do-game - (new-game (default-corp [(qty "Launch Campaign" 2) "Ice Wall"]) - (default-runner ["Logos" "Apocalypse" (qty "Origami" 2)])) + (new-game {:corp {:deck [(qty "Launch Campaign" 2) "Ice Wall"]} + :runner {:deck ["Logos" "Apocalypse" (qty "Origami" 2)]}}) (play-from-hand state :corp "Ice Wall" "New remote") (play-from-hand state :corp "Launch Campaign" "New remote") (play-from-hand state :corp "Launch Campaign" "New remote") @@ -213,8 +203,8 @@ (is (= 4 (core/available-mu state)) "Memory reset with Logos and Origami facedown")))) (testing "Turn Runner cards facedown without firing their trash effects" (do-game - (new-game (default-corp [(qty "Launch Campaign" 2) "Ice Wall"]) - (default-runner [(qty "Tri-maf Contact" 3) (qty "Apocalypse" 3)])) + (new-game {:corp {:deck [(qty "Launch Campaign" 2) "Ice Wall"]} + :runner {:deck [(qty "Tri-maf Contact" 3) (qty "Apocalypse" 3)]}}) (play-from-hand state :corp "Ice Wall" "New remote") (play-from-hand state :corp "Launch Campaign" "New remote") (play-from-hand state :corp "Launch Campaign" "New remote") @@ -238,8 +228,8 @@ (deftest because-i-can ;; make a successful run on a remote to shuffle its contents into R&D (do-game - (new-game (default-corp ["Sand Storm" "PAD Campaign" "Project Atlas" (qty "Shell Corporation" 2)]) - (default-runner [(qty "Because I Can" 2)])) + (new-game {:corp {:deck ["Sand Storm" "PAD Campaign" "Project Atlas" (qty "Shell Corporation" 2)]} + :runner {:deck [(qty "Because I Can" 2)]}}) (play-from-hand state :corp "Shell Corporation" "New remote") (play-from-hand state :corp "Shell Corporation" "Server 1") (play-from-hand state :corp "Project Atlas" "Server 1") @@ -276,8 +266,8 @@ ;; Black Hat (testing "Basic test" (do-game - (new-game (default-corp [(qty "Hedge Fund" 10)]) - (default-runner [(qty "Black Hat" 3)])) + (new-game {:corp {:deck [(qty "Hedge Fund" 10)]} + :runner {:deck [(qty "Black Hat" 3)]}}) (take-credits state :corp) (core/gain state :runner :credit 10) (play-from-hand state :runner "Black Hat") @@ -292,8 +282,8 @@ (click-prompt state :runner "Card from deck"))) (testing "Kitsune interaction" (do-game - (new-game (default-corp [(qty "Kitsune" 10)]) - (default-runner [(qty "Black Hat" 3)])) + (new-game {:corp {:deck [(qty "Kitsune" 10)]} + :runner {:deck [(qty "Black Hat" 3)]}}) (starting-hand state :corp ["Kitsune" "Kitsune" "Kitsune" "Kitsune" "Kitsune"]) (play-from-hand state :corp "Kitsune" "R&D") (let [kitsune (get-ice state :rd 0)] @@ -316,9 +306,9 @@ ;; Prevent rezzing of ice for one run (testing "Basic test" (do-game - (new-game - (default-corp [(qty "Ice Wall" 3)]) - (make-deck "Valencia Estevez: The Angel of Cayambe" [(qty "Blackmail" 3)])) + (new-game {:corp {:deck [(qty "Ice Wall" 3)]} + :runner {:id "Valencia Estevez: The Angel of Cayambe" + :deck [(qty "Blackmail" 3)]}}) (is (= 1 (get-in @state [:corp :bad-publicity])) "Corp has 1 bad-publicity") (play-from-hand state :corp "Ice Wall" "HQ") (play-from-hand state :corp "Ice Wall" "HQ") @@ -339,8 +329,9 @@ (is (:rezzed (refresh iwall1)) "First Ice Wall is rezzed")))) (testing "Regression test for a rezzed tmi breaking game state on a blackmail run" (do-game - (new-game (default-corp [(qty "TMI" 3)]) - (make-deck "Valencia Estevez: The Angel of Cayambe" [(qty "Blackmail" 3)])) + (new-game {:corp {:deck [(qty "TMI" 3)]} + :runner {:id "Valencia Estevez: The Angel of Cayambe" + :deck [(qty "Blackmail" 3)]}}) (is (= 1 (get-in @state [:corp :bad-publicity])) "Corp has 1 bad-publicity") (play-from-hand state :corp "TMI" "HQ") (let [tmi (get-ice state :hq 0)] @@ -359,42 +350,43 @@ ;; By Any Means (testing "Full test" (do-game - (new-game (default-corp ["Hedge Fund" "Ice Wall" "Paper Trail" "PAD Campaign" - "Project Junebug"]) - (default-runner ["By Any Means" (qty "Sure Gamble" 5)])) - (take-credits state :corp) - (run-empty-server state "Archives") - ; (play-from-hand state :runner "By Any Means") - (is (= 3 (:click (get-runner))) "Card not played, priority restriction") - (take-credits state :runner) - (starting-hand state :corp ["Paper Trail" "Hedge Fund" "PAD Campaign" "Project Junebug"]) - (play-from-hand state :corp "Paper Trail" "New remote") - (play-from-hand state :corp "PAD Campaign" "New remote") - (play-from-hand state :corp "Project Junebug" "New remote") - (core/add-counter state :corp (get-content state :remote3 0) :advancement 2) - (take-credits state :corp) - (core/gain state :runner :click 2) - (core/draw state :runner) - (play-from-hand state :runner "By Any Means") - (run-empty-server state "HQ") - (is (= 1 (count (:discard (get-corp)))) "Operation was trashed") - (is (= 4 (count (:hand (get-runner)))) "Took 1 meat damage") - (run-empty-server state "R&D") - (is (= 2 (count (:discard (get-corp)))) "ICE was trashed") - (is (= 3 (count (:hand (get-runner)))) "Took 1 meat damage") - (run-empty-server state "Server 1") - (is (= 3 (count (:discard (get-corp)))) "Agenda was trashed") - (is (= 2 (count (:hand (get-runner)))) "Took 1 meat damage") - (run-empty-server state "Server 2") - (is (= 4 (count (:discard (get-corp)))) "Trashable was trashed") - (is (= 1 (count (:hand (get-runner)))) "Took 1 meat damage") - (run-empty-server state "Server 3") - (is (= 5 (count (:discard (get-corp)))) "Ambush was trashed") - (is (zero? (count (:hand (get-runner)))) "Took 1 meat damage"))) + (new-game {:corp {:deck ["Hedge Fund" "Ice Wall" "Paper Trail" "PAD Campaign" + "Project Junebug"]} + :runner {:deck ["By Any Means" (qty "Sure Gamble" 5)]}}) + (take-credits state :corp) + (run-empty-server state "Archives") + ; (play-from-hand state :runner "By Any Means") + (is (= 3 (:click (get-runner))) "Card not played, priority restriction") + (take-credits state :runner) + (starting-hand state :corp ["Paper Trail" "Hedge Fund" "PAD Campaign" "Project Junebug"]) + (play-from-hand state :corp "Paper Trail" "New remote") + (play-from-hand state :corp "PAD Campaign" "New remote") + (play-from-hand state :corp "Project Junebug" "New remote") + (core/add-counter state :corp (get-content state :remote3 0) :advancement 2) + (take-credits state :corp) + (core/gain state :runner :click 2) + (core/draw state :runner) + (play-from-hand state :runner "By Any Means") + (run-empty-server state "HQ") + (is (= 1 (count (:discard (get-corp)))) "Operation was trashed") + (is (= 4 (count (:hand (get-runner)))) "Took 1 meat damage") + (run-empty-server state "R&D") + (is (= 2 (count (:discard (get-corp)))) "ICE was trashed") + (is (= 3 (count (:hand (get-runner)))) "Took 1 meat damage") + (run-empty-server state "Server 1") + (is (= 3 (count (:discard (get-corp)))) "Agenda was trashed") + (is (= 2 (count (:hand (get-runner)))) "Took 1 meat damage") + (run-empty-server state "Server 2") + (is (= 4 (count (:discard (get-corp)))) "Trashable was trashed") + (is (= 1 (count (:hand (get-runner)))) "Took 1 meat damage") + (run-empty-server state "Server 3") + (is (= 5 (count (:discard (get-corp)))) "Ambush was trashed") + (is (zero? (count (:hand (get-runner)))) "Took 1 meat damage"))) (testing "vs Controlling the Message" (do-game - (new-game (make-deck "NBN: Controlling the Message" ["Paper Trail"]) - (default-runner [(qty "By Any Means" 2)])) + (new-game {:corp {:id "NBN: Controlling the Message" + :deck ["Paper Trail"]} + :runner {:deck [(qty "By Any Means" 2)]}}) (play-from-hand state :corp "Paper Trail" "New remote") (take-credits state :corp) (play-from-hand state :runner "By Any Means") @@ -405,8 +397,8 @@ (is (zero? (count (:hand (get-runner)))) "Took 1 meat damage"))) (testing "alongside Film Critic: should get the option to trigger either" (do-game - (new-game (default-corp [(qty "Hostile Takeover" 2)]) - (default-runner ["By Any Means" "Film Critic" (qty "Sure Gamble" 2)])) + (new-game {:corp {:deck [(qty "Hostile Takeover" 2)]} + :runner {:deck ["By Any Means" "Film Critic" (qty "Sure Gamble" 2)]}}) (take-credits state :corp) (play-from-hand state :runner "By Any Means") (play-from-hand state :runner "Film Critic") @@ -433,8 +425,8 @@ (deftest careful-planning ;; Careful Planning - Prevent card in/protecting remote server from being rezzed this turn (do-game - (new-game (default-corp ["PAD Campaign" (qty "Vanilla" 2)]) - (default-runner [(qty "Careful Planning" 2)])) + (new-game {:corp {:deck ["PAD Campaign" (qty "Vanilla" 2)]} + :runner {:deck [(qty "Careful Planning" 2)]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (play-from-hand state :corp "Vanilla" "HQ") (play-from-hand state :corp "Vanilla" "Server 1") @@ -463,9 +455,9 @@ (deftest cbi-raid ;; CBI Raid - Full test (do-game - (new-game (default-corp ["Caprice Nisei" "Adonis Campaign" "Quandary" - "Jackson Howard" "Global Food Initiative"]) - (default-runner ["CBI Raid"])) + (new-game {:corp {:deck ["Caprice Nisei" "Adonis Campaign" "Quandary" + "Jackson Howard" "Global Food Initiative"]} + :runner {:deck ["CBI Raid"]}}) (take-credits state :corp) (is (= 5 (count (:hand (get-corp))))) (play-from-hand state :runner "CBI Raid") @@ -496,8 +488,8 @@ ;; Make a run, and place 4 on this card, which you may use only during this run. ;; When this run ends, trash 1 program (cannot be prevented) used during this run. (do-game - (new-game (default-corp [(qty "Blacklist" 3)]) - (default-runner ["Imp" (qty "Cold Read" 2)])) + (new-game {:corp {:deck [(qty "Blacklist" 3)]} + :runner {:deck ["Imp" (qty "Cold Read" 2)]}}) (play-from-hand state :corp "Blacklist" "New remote") (take-credits state :corp) (play-from-hand state :runner "Imp") @@ -521,8 +513,7 @@ ;; Compile - Make a run, and install a program for free which is shuffled back into stack (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner ["Compile" "Gordian Blade"])) + (new-game {:runner {:deck ["Compile" "Gordian Blade"]}}) (starting-hand state :runner ["Compile"]) (take-credits state :corp) (core/gain state :runner :credit 10) @@ -540,9 +531,8 @@ (is (nil? (get-program state 0)))))) (testing "with Self-modifying Code, neither SMC nor other card should be shuffled back in" (do-game - (new-game (default-corp) - (default-runner ["Compile" "Clone Chip" - (qty "Self-modifying Code" 3)])) + (new-game {:runner {:deck ["Compile" "Clone Chip" + (qty "Self-modifying Code" 3)]}}) (starting-hand state :runner ["Compile" "Clone Chip"]) (take-credits state :corp) (core/gain state :runner :credit 10) @@ -564,34 +554,33 @@ (run-jack-out state) (is (= deck (count (:deck (get-runner)))) "No card was shuffled back into the stack")))) (testing "vs ending the run via corp action. #3639" - (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Compile" "Gordian Blade"])) - (starting-hand state :runner ["Compile"]) - (play-from-hand state :corp "Ice Wall" "Archives") - (let [iw (get-ice state :archives 0)] - (core/rez state :corp iw) - (take-credits state :corp) - (core/gain state :runner :credit 10) - (play-from-hand state :runner "Compile") - (click-prompt state :runner "Archives") - (click-prompt state :runner "OK") ; notification that Compile must be clicked to install - (let [compile-card (first (get-in @state [:runner :play-area]))] - (card-ability state :runner compile-card 0) - (click-prompt state :runner "Stack") - (click-prompt state :runner (find-card "Gordian Blade" (:deck (get-runner)))) - (is (:installed (get-program state 0)) "Gordian Blade should be installed")) - (let [deck (count (:deck (get-runner)))] - (card-subroutine state :corp iw 0) - (is (= (+ 1 deck) (count (:deck (get-runner)))) "Gordian Blade should be back in stack") - (is (nil? (get-program state 0)))))))) + (do-game + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Compile" "Gordian Blade"]}}) + (starting-hand state :runner ["Compile"]) + (play-from-hand state :corp "Ice Wall" "Archives") + (let [iw (get-ice state :archives 0)] + (core/rez state :corp iw) + (take-credits state :corp) + (core/gain state :runner :credit 10) + (play-from-hand state :runner "Compile") + (click-prompt state :runner "Archives") + (click-prompt state :runner "OK") ; notification that Compile must be clicked to install + (let [compile-card (first (get-in @state [:runner :play-area]))] + (card-ability state :runner compile-card 0) + (click-prompt state :runner "Stack") + (click-prompt state :runner (find-card "Gordian Blade" (:deck (get-runner)))) + (is (:installed (get-program state 0)) "Gordian Blade should be installed")) + (let [deck (count (:deck (get-runner)))] + (card-subroutine state :corp iw 0) + (is (= (+ 1 deck) (count (:deck (get-runner)))) "Gordian Blade should be back in stack") + (is (nil? (get-program state 0)))))))) (deftest contaminate ;; Contaminate - add 3 virus counters to an installed runner card with no virus counters (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner ["Yusuf" "Chrome Parlor" (qty "Contaminate" 3)])) + (new-game {:runner {:deck ["Yusuf" "Chrome Parlor" (qty "Contaminate" 3)]}}) (take-credits state :corp) (core/gain state :runner :credit 5 :click 2) (play-from-hand state :runner "Yusuf") @@ -612,8 +601,7 @@ (is (= 3 (get-counters (refresh cp) :virus)) "Yusuf isn't selectable by Contaminate")))) (testing "Hivemind makes virus programs act like they have a virus counter" (do-game - (new-game (default-corp) - (default-runner ["Aumakua" "Friday Chip" "Hivemind" "Contaminate"])) + (new-game {:runner {:deck ["Aumakua" "Friday Chip" "Hivemind" "Contaminate"]}}) (take-credits state :corp) (core/gain state :runner :credit 5 :click 2) (play-from-hand state :runner "Aumakua") @@ -629,13 +617,11 @@ (is (= 3 (get-counters (refresh fc) :virus)) "Friday Chip has 3 counters after Contaminate") (is (zero? (get-counters (refresh aum) :virus)) "Aumakua ends with 0 virus counters (not counting Hivemind)"))))) -(deftest ^{:card-title "corporate-\"grant\""} - corporate-grant +(deftest corporate-grant ;; Corporate "Grant" - First time runner installs a card, the corp loses 1 credit (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner ["Corporate \"Grant\"" (qty "Daily Casts" 2)])) + (new-game {:runner {:deck ["Corporate \"Grant\"" (qty "Daily Casts" 2)]}}) (take-credits state :corp) (core/gain state :runner :credit 5) (play-from-hand state :runner "Corporate \"Grant\"") @@ -647,8 +633,8 @@ (is (= 7 (:credit (get-corp))) "Corp doesn't lose 1 credit"))) (testing "with Hayley Kaplan. Issue #3162" (do-game - (new-game (default-corp) - (make-deck "Hayley Kaplan: Universal Scholar" ["Corporate \"Grant\"" (qty "Clone Chip" 2)])) + (new-game {:runner {:id "Hayley Kaplan: Universal Scholar" + :deck ["Corporate \"Grant\"" (qty "Clone Chip" 2)]}}) (take-credits state :corp) (core/gain state :runner :credit 5) (play-from-hand state :runner "Corporate \"Grant\"") @@ -661,9 +647,9 @@ (deftest corporate-scandal ;; Corporate Scandal - Corp has 1 additional bad pub even with 0 (do-game - (new-game (default-corp ["Elizabeth Mills"]) - (default-runner ["Corporate Scandal" "Activist Support" - "Raymond Flint" "Investigative Journalism"])) + (new-game {:corp {:deck ["Elizabeth Mills"]} + :runner {:deck ["Corporate Scandal" "Activist Support" + "Raymond Flint" "Investigative Journalism"]}}) (play-from-hand state :corp "Elizabeth Mills" "New remote") (take-credits state :corp) (core/gain state :runner :credit 5 :click 1) @@ -686,8 +672,8 @@ (deftest credit-kiting ;; Credit Kiting - After successful central run lower install cost by 8 and gain a tag (do-game - (new-game (default-corp ["PAD Campaign" "Ice Wall"]) - (default-runner ["Credit Kiting" "Femme Fatale"])) + (new-game {:corp {:deck ["PAD Campaign" "Ice Wall"]} + :runner {:deck ["Credit Kiting" "Femme Fatale"]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (play-from-hand state :corp "Ice Wall" "R&D") (take-credits state :corp) @@ -709,9 +695,7 @@ ;; Data Breach (testing "Basic test" (do-game - (new-game - (default-corp) - (default-runner [(qty "Data Breach" 3)])) + (new-game {:runner {:deck [(qty "Data Breach" 3)]}}) (starting-hand state :corp ["Hedge Fund"]) (take-credits state :corp) (play-from-hand state :runner "Data Breach") @@ -730,8 +714,7 @@ (is (empty? (:prompt (get-runner))) "No option to run again on unsuccessful run"))) (testing "FAQ 4.1 - ensure runner gets choice of activation order" (do-game - (new-game (default-corp) - (default-runner ["Doppelgänger" (qty "Data Breach" 3)])) + (new-game {:runner {:deck ["Doppelgänger" (qty "Data Breach" 3)]}}) (take-credits state :corp) (play-from-hand state :runner "Doppelgänger") (play-from-hand state :runner "Data Breach") @@ -754,11 +737,10 @@ (deftest deja-vu ;; Deja Vu - recur one non-virus or two virus cards (do-game - (new-game (default-corp) - (default-runner [(qty "Déjà Vu" 2) + (new-game {:runner {:deck [(qty "Déjà Vu" 2) "Cache" "Datasucker" - "Dirty Laundry"])) + "Dirty Laundry"]}}) (take-credits state :corp 3) ; pass to runner's turn (trash-from-hand state :runner "Cache") (trash-from-hand state :runner "Datasucker") @@ -777,10 +759,10 @@ (deftest demolition-run ;; Demolition Run - Trash at no cost (do-game - (new-game (default-corp ["False Lead" + (new-game {:corp {:deck ["False Lead" "Shell Corporation" - (qty "Hedge Fund" 3)]) - (default-runner ["Demolition Run"])) + (qty "Hedge Fund" 3)]} + :runner {:deck ["Demolition Run"]}}) (core/move state :corp (find-card "False Lead" (:hand (get-corp))) :deck) ; put False Lead back in R&D (play-from-hand state :corp "Shell Corporation" "R&D") ; install upgrade with a trash cost in root of R&D (take-credits state :corp 2) ; pass to runner's turn by taking credits @@ -801,9 +783,9 @@ (deftest deuces-wild ;; Deuces Wild (do-game - (new-game (default-corp ["Wraparound" - "The Future Perfect"]) - (default-runner [(qty "Deuces Wild" 2) (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Wraparound" + "The Future Perfect"]} + :runner {:deck [(qty "Deuces Wild" 2) (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Wraparound" "New remote") (take-credits state :corp) (starting-hand state :runner ["Deuces Wild" "Deuces Wild"]) @@ -833,8 +815,7 @@ (deftest dirty-laundry ;; Dirty Laundry - Gain 5 credits at the end of the run if it was successful (do-game - (new-game (default-corp) - (default-runner [(qty "Dirty Laundry" 2)])) + (new-game {:runner {:deck [(qty "Dirty Laundry" 2)]}}) (take-credits state :corp) (play-from-hand state :runner "Dirty Laundry") (click-prompt state :runner "Archives") @@ -849,7 +830,7 @@ ;; Diversion of Funds (testing "Use ability" (do-game - (new-game (default-corp) (default-runner [(qty "Diversion of Funds" 3)])) + (new-game {:runner {:deck [(qty "Diversion of Funds" 3)]}}) (take-credits state :corp) (is (= 8 (:credit (get-corp))) "Corp has 8 credits") ;; play Diversion of Funds, use ability @@ -861,7 +842,7 @@ (is (not (:run @state)) "Run finished"))) (testing "Access" (do-game - (new-game (default-corp) (default-runner [(qty "Diversion of Funds" 3)])) + (new-game {:runner {:deck [(qty "Diversion of Funds" 3)]}}) (take-credits state :corp) ; pass to runner's turn by taking credits (is (= 8 (:credit (get-corp))) "Corp has 8 credits") ;; play Diversion, do not use ability @@ -878,8 +859,8 @@ ;; Divide and Conquer (testing "Basic test" (do-game - (new-game (default-corp ["Hostile Takeover" (qty "Ice Wall" 100)]) - (default-runner ["Divide and Conquer"])) + (new-game {:corp {:deck ["Hostile Takeover" (qty "Ice Wall" 100)]} + :runner {:deck ["Divide and Conquer"]}}) (starting-hand state :corp ["Hostile Takeover" "Ice Wall" "Ice Wall"]) (trash-from-hand state :corp "Ice Wall") (trash-from-hand state :corp "Ice Wall") @@ -891,8 +872,8 @@ (is (= 4 (-> (get-runner) :register :last-run core/total-cards-accessed)) "Runner should access 2 cards in Archives, 1 in R&D, and 1 in HQ"))) (testing "with The Turning Wheel counters" (do-game - (new-game (default-corp ["Hostile Takeover" (qty "Ice Wall" 100)]) - (default-runner ["Divide and Conquer" "The Turning Wheel"])) + (new-game {:corp {:deck ["Hostile Takeover" (qty "Ice Wall" 100)]} + :runner {:deck ["Divide and Conquer" "The Turning Wheel"]}}) (starting-hand state :corp (concat ["Hostile Takeover"] (repeat 4 "Ice Wall"))) (trash-from-hand state :corp "Ice Wall") @@ -913,7 +894,6 @@ (dotimes [_ 3] (click-prompt state :runner "Card from deck") (click-prompt state :runner "No action")) - (is (empty? (:prompt (get-runner))) "No prompts after all accesses are complete") (is (= 2 (-> (get-runner) :register :last-run :access-bonus)) "The Turning Wheel should provide 2 additional accesses") (is (= 8 (-> (get-runner) :register :last-run core/total-cards-accessed)) "Runner should access 2 cards in Archives, 1 + 2 in R&D, and 1 + 2 in HQ"))))) @@ -922,10 +902,10 @@ ;; Drive By - Expose card in remote server and trash if asset or upgrade (testing "Basic test" (do-game - (new-game (default-corp [(qty "Eve Campaign" 2) + (new-game {:corp {:deck [(qty "Eve Campaign" 2) "Product Placement" - "Project Atlas"]) - (default-runner [(qty "Drive By" 2)])) + "Project Atlas"]} + :runner {:deck [(qty "Drive By" 2)]}}) (core/gain state :corp :click 1) (play-from-hand state :corp "Eve Campaign" "New remote") (play-from-hand state :corp "Eve Campaign" "New remote") @@ -957,8 +937,8 @@ "Project Atlas not trashed from Server 3")))) (testing "Psychic Field trashed after psi game. Issue #2127." (do-game - (new-game (default-corp ["Psychic Field"]) - (default-runner [(qty "Drive By" 3)])) + (new-game {:corp {:deck ["Psychic Field"]} + :runner {:deck [(qty "Drive By" 3)]}}) (play-from-hand state :corp "Psychic Field" "New remote") (take-credits state :corp) (play-from-hand state :runner "Drive By") @@ -968,8 +948,8 @@ (is (empty? (get-content state :remote1)) "Psychic Field trashed"))) (testing "Turn on reprisal cards. Issue #3755." (do-game - (new-game (default-corp ["PAD Campaign"]) - (default-runner ["Drive By"])) + (new-game {:corp {:deck ["PAD Campaign"]} + :runner {:deck ["Drive By"]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (take-credits state :corp) (play-from-hand state :runner "Drive By") @@ -980,8 +960,7 @@ (deftest early-bird ;; Early Bird - Priority, make a run and gain a click (do-game - (new-game (default-corp) - (default-runner ["Early Bird"])) + (new-game {:runner {:deck ["Early Bird"]}}) (take-credits state :corp) (run-empty-server state "Archives") (play-from-hand state :runner "Early Bird") @@ -996,8 +975,8 @@ ;; Embezzle (testing "Basic test" (do-game - (new-game (default-corp ["Ice Wall" "Archer"]) - (default-runner ["Embezzle"])) + (new-game {:corp {:deck ["Ice Wall" "Archer"]} + :runner {:deck ["Embezzle"]}}) (take-credits state :corp) (is (= 5 (:credit (get-runner)))) (play-run-event state (first (:hand (get-runner))) :hq) @@ -1006,8 +985,8 @@ (is (= 12 (:credit (get-runner)))))) (testing "Check that trashed cards are trashed face-up" (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Embezzle"])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Embezzle"]}}) (take-credits state :corp) (is (= 5 (:credit (get-runner)))) (play-run-event state (first (:hand (get-runner))) :hq) @@ -1019,9 +998,8 @@ (deftest emergent-creativity ;; Emergent Creativty - Double, discard programs/hardware from grip, install from heap (do-game - (new-game (default-corp) - (default-runner ["Emergent Creativity" "Paperclip" - "Heartbeat" "Gordian Blade" "Test Run"])) + (new-game {:runner {:deck ["Emergent Creativity" "Paperclip" + "Heartbeat" "Gordian Blade" "Test Run"]}}) (starting-hand state :runner ["Emergent Creativity" "Heartbeat" "Gordian Blade" "Test Run"]) (take-credits state :corp) (play-from-hand state :runner "Emergent Creativity") @@ -1038,8 +1016,9 @@ ;; Employee Strike (testing "vs Blue Sun, suppress Step 1.2" (do-game - (new-game (make-deck "Blue Sun: Powering the Future" ["Ice Wall"]) - (default-runner ["Employee Strike" "Scrubbed"])) + (new-game {:corp {:id "Blue Sun: Powering the Future" + :deck ["Ice Wall"]} + :runner {:deck ["Employee Strike" "Scrubbed"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (core/rez state :corp (get-ice state :hq 0)) (take-credits state :corp) @@ -1048,8 +1027,9 @@ (is (not (:corp-phase-12 @state)) "Employee Strike suppressed Blue Sun step 1.2"))) (testing "vs PU/Philotic - test for #2688" (do-game - (new-game (make-deck "Jinteki: Potential Unleashed" ["Philotic Entanglement" (qty "Braintrust" 2)]) - (default-runner [(qty "Employee Strike" 10)])) + (new-game {:corp {:id "Jinteki: Potential Unleashed" + :deck ["Philotic Entanglement" (qty "Braintrust" 2)]} + :runner {:deck [(qty "Employee Strike" 10)]}}) (play-from-hand state :corp "Braintrust" "New remote") (play-from-hand state :corp "Braintrust" "New remote") (take-credits state :corp) @@ -1068,8 +1048,8 @@ ;; Encore - Run all 3 central servers successfully to take another turn. Remove Encore from game. (testing "Basic test" (do-game - (new-game (default-corp ["Hedge Fund"]) - (default-runner ["Encore"])) + (new-game {:corp {:deck ["Hedge Fund"]} + :runner {:deck ["Encore"]}}) (play-from-hand state :corp "Hedge Fund") (take-credits state :corp) (run-empty-server state "Archives") @@ -1084,8 +1064,8 @@ (is (= 9 (:credit (get-runner)))))) (testing "2 encores in a 5 click turn results in 2 extra turns" (do-game - (new-game (default-corp ["Hedge Fund"]) - (default-runner [(qty "Encore" 2)])) + (new-game {:corp {:deck ["Hedge Fund"]} + :runner {:deck [(qty "Encore" 2)]}}) (play-from-hand state :corp "Hedge Fund") (take-credits state :corp) (core/gain state :runner :click 1) @@ -1101,11 +1081,10 @@ (take-credits state :runner) (is (= 13 (:credit (get-runner))))))) -(deftest eureka! +(deftest eureka ;; Eureka! - Install the program but trash the event (do-game - (new-game (default-corp) - (default-runner [(qty "Eureka!" 2) "Torch" "Sure Gamble"])) + (new-game {:runner {:deck [(qty "Eureka!" 2) "Torch" "Sure Gamble"]}}) (take-credits state :corp) (core/gain state :runner :credit 1) (core/move state :runner (find-card "Torch" (:hand (get-runner))) :deck) @@ -1122,8 +1101,8 @@ ;; Exploratory Romp - Remove advancements from card instead of accessing (testing "Basic test" (do-game - (new-game (default-corp ["TGTBT"]) - (default-runner ["Exploratory Romp"])) + (new-game {:corp {:deck ["TGTBT"]} + :runner {:deck ["Exploratory Romp"]}}) (play-from-hand state :corp "TGTBT" "New remote") (let [tg (get-content state :remote1 0)] (advance state tg 2) @@ -1138,8 +1117,8 @@ (is (zero? (get-counters (refresh tg) :advancement)) "Advancements removed")))) (testing "Don't remove more than the existing number of advancement tokens" (do-game - (new-game (default-corp ["TGTBT"]) - (default-runner ["Exploratory Romp"])) + (new-game {:corp {:deck ["TGTBT"]} + :runner {:deck ["Exploratory Romp"]}}) (play-from-hand state :corp "TGTBT" "New remote") (let [tg (get-content state :remote1 0)] (advance state tg 2) @@ -1158,10 +1137,10 @@ ;; server and correctly guess its type to gain 5 creds (testing "Basic test" (do-game - (new-game (default-corp [(qty "Eve Campaign" 2) + (new-game {:corp {:deck [(qty "Eve Campaign" 2) (qty "Product Placement" 2) - "Project Atlas"]) - (default-runner [(qty "Falsified Credentials" 3)])) + "Project Atlas"]} + :runner {:deck [(qty "Falsified Credentials" 3)]}}) (core/gain state :corp :click 2) (play-from-hand state :corp "Eve Campaign" "New remote") (play-from-hand state :corp "Eve Campaign" "New remote") @@ -1198,8 +1177,8 @@ "Gained 5 credits for guessing agenda correctly, even with rezzed card in server")))) (testing "vs Zaibatsu Loyalty. If Falsified Credentials fails to expose, it grants no credits." (do-game - (new-game (default-corp ["Zaibatsu Loyalty" "Project Atlas"]) - (default-runner [(qty "Falsified Credentials" 2)])) + (new-game {:corp {:deck ["Zaibatsu Loyalty" "Project Atlas"]} + :runner {:deck [(qty "Falsified Credentials" 2)]}}) (play-from-hand state :corp "Project Atlas" "New remote") (play-from-hand state :corp "Zaibatsu Loyalty" "New remote") (take-credits state :corp) @@ -1221,8 +1200,7 @@ (deftest feint ;; Feint - bypass 2 pieces of ice on HQ, but access no cards (do-game - (new-game (default-corp) - (default-runner ["Feint"])) + (new-game {:runner {:deck ["Feint"]}}) (take-credits state :corp) (play-from-hand state :runner "Feint") (run-successful state) @@ -1233,10 +1211,9 @@ ;; Frantic Coding - Install 1 program, other 9 cards are trashed (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner ["Frantic Coding" "Torch" "Corroder" + (new-game {:runner {:deck ["Frantic Coding" "Torch" "Corroder" "Magnum Opus" (qty "Daily Casts" 2) (qty "Sure Gamble" 2) - "John Masanori" "Amped Up" "Wanton Destruction"])) + "John Masanori" "Amped Up" "Wanton Destruction"]}}) (starting-hand state :runner ["Frantic Coding"]) (take-credits state :corp) (play-from-hand state :runner "Frantic Coding") @@ -1252,10 +1229,9 @@ (is (= 10 (count (:discard (get-runner)))))))) (testing "Don't install anything, all 10 cards are trashed" (do-game - (new-game (default-corp) - (default-runner ["Frantic Coding" "Torch" "Corroder" + (new-game {:runner {:deck ["Frantic Coding" "Torch" "Corroder" "Magnum Opus" (qty "Daily Casts" 2) (qty "Sure Gamble" 2) - "John Masanori" "Amped Up" "Wanton Destruction"])) + "John Masanori" "Amped Up" "Wanton Destruction"]}}) (starting-hand state :runner ["Frantic Coding"]) (take-credits state :corp) (play-from-hand state :runner "Frantic Coding") @@ -1268,13 +1244,12 @@ (is (zero? (count (get-program state)))) (is (= 11 (count (:discard (get-runner))))))))) -(deftest ^{:card-title "\"freedom-through-equality\""} - freedom-through-equality +(deftest freedom-through-equality ;; Move Freedom Through Equality to runner score on another steal ;; Check only one current used (do-game - (new-game (default-corp [(qty "Project Beale" 2)]) - (default-runner ["Street Peddler" (qty "\"Freedom Through Equality\"" 3) "Sure Gamble"])) + (new-game {:corp {:deck [(qty "Project Beale" 2)]} + :runner {:deck ["Street Peddler" (qty "\"Freedom Through Equality\"" 3) "Sure Gamble"]}}) (starting-hand state :runner ["Street Peddler" "\"Freedom Through Equality\"" "\"Freedom Through Equality\"" @@ -1299,9 +1274,8 @@ (deftest freelance-coding-contract ;; Freelance Coding Contract - Gain 2 credits per program trashed from Grip (do-game - (new-game (default-corp) - (default-runner ["Freelance Coding Contract" - "Paricia" "Cloak" "Inti"])) + (new-game {:runner {:deck ["Freelance Coding Contract" + "Paricia" "Cloak" "Inti"]}}) (take-credits state :corp) (play-from-hand state :runner "Freelance Coding Contract") (click-card state :runner (find-card "Cloak" (:hand (get-runner)))) @@ -1315,24 +1289,23 @@ (deftest game-day ;; Game Day - draw until at handsize (do-game - (new-game (default-corp) - (default-runner [(qty "Game Day" 3) - (qty "Public Sympathy" 3) - (qty "Sure Gamble" 3) - (qty "Easy Mark" 3)])) - (take-credits state :corp) - ;; move needed cards to hand -- in case they were not drawn - (core/move state :runner (find-card "Game Day" (:deck (get-runner))) :hand) - (core/move state :runner (find-card "Public Sympathy" (:deck (get-runner))) :hand) - (play-from-hand state :runner "Public Sympathy") - (is (= 7 (core/hand-size state :runner)) "Runner hand size is 7") - (play-from-hand state :runner "Game Day") - (is (= 7 (count (:hand (get-runner)))) "Drew up to 7 cards"))) + (new-game {:runner {:deck [(qty "Game Day" 3) + (qty "Public Sympathy" 3) + (qty "Sure Gamble" 3) + (qty "Easy Mark" 3)]}}) + (take-credits state :corp) + ;; move needed cards to hand -- in case they were not drawn + (core/move state :runner (find-card "Game Day" (:deck (get-runner))) :hand) + (core/move state :runner (find-card "Public Sympathy" (:deck (get-runner))) :hand) + (play-from-hand state :runner "Public Sympathy") + (is (= 7 (core/hand-size state :runner)) "Runner hand size is 7") + (play-from-hand state :runner "Game Day") + (is (= 7 (count (:hand (get-runner)))) "Drew up to 7 cards"))) (deftest glut-cipher (do-game - (new-game (default-corp [(qty "Ice Wall" 3) (qty "Wraparound" 2) "Hedge Fund"]) - (default-runner [(qty "Glut Cipher" 3)])) + (new-game {:corp {:deck [(qty "Ice Wall" 3) (qty "Wraparound" 2) "Hedge Fund"]} + :runner {:deck [(qty "Glut Cipher" 3)]}}) (take-credits state :corp) (trash-from-hand state :corp "Ice Wall") (trash-from-hand state :corp "Ice Wall") @@ -1366,8 +1339,7 @@ (deftest guinea-pig ;; Guinea Pig (do-game - (new-game (default-corp) - (default-runner ["Guinea Pig" (qty "Sure Gamble" 3)])) + (new-game {:runner {:deck ["Guinea Pig" (qty "Sure Gamble" 3)]}}) (take-credits state :corp) (play-from-hand state :runner "Guinea Pig") (is (= 11 (:credit (get-runner))) "Gained +6 credits from playing Guinea Pig") @@ -1379,10 +1351,10 @@ ;; Trash a random card from corp hand while active ;; Make sure it is not active when hosted on Peddler (do-game - (new-game (default-corp [(qty "Jeeves Model Bioroids" 2) - (qty "Jackson Howard" 2)]) - (default-runner ["Street Peddler" - (qty "Hacktivist Meeting" 3)])) + (new-game {:corp {:deck [(qty "Jeeves Model Bioroids" 2) + (qty "Jackson Howard" 2)]} + :runner {:deck ["Street Peddler" + (qty "Hacktivist Meeting" 3)]}}) (take-credits state :corp) (starting-hand state :runner ["Street Peddler" "Hacktivist Meeting"]) (play-from-hand state :runner "Street Peddler") @@ -1401,8 +1373,8 @@ (deftest high-stakes-job ;; High Stakes Job - run on server with at least 1 piece of unrezzed ice, gains 12 credits if successful (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["High-Stakes Job"])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["High-Stakes Job"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) (core/gain state :runner :credit 1) @@ -1415,22 +1387,57 @@ (deftest hot-pursuit ;; Hot Pursuit (do-game - (new-game (default-corp) - (default-runner ["Hot Pursuit"])) + (new-game {:runner {:deck ["Hot Pursuit"]}}) (take-credits state :corp) (play-run-event state (first (:hand (get-runner))) :hq) (is (= (+ 5 -2 9) (:credit (get-runner))) "Gained 9 credits on successful run") (is (= 1 (count-tags state)) "Took 1 tag on successful run") (is (prompt-map :runner) "Still have access prompt"))) +(deftest i-ve-had-worse + ;; I've Had Worse - Draw 3 cards when lost to net/meat damage; don't trigger if flatlined + (testing "Basic test" + (do-game + (new-game {:corp {:deck [(qty "Scorched Earth" 3) (qty "Pup" 3)]} + :runner {:deck [(qty "I've Had Worse" 2) (qty "Sure Gamble" 3) (qty "Imp" 2)]}}) + (core/gain state :runner :tag 1) + (core/gain state :corp :credit 5) + (starting-hand state :runner ["I've Had Worse"]) + (play-from-hand state :corp "Pup" "HQ") + (core/rez state :corp (get-ice state :hq 0)) + (card-subroutine state :corp (get-ice state :hq 0) 0) + (is (= 1 (count (:discard (get-runner))))) + (is (= 3 (count (:hand (get-runner)))) "I've Had Worse triggered and drew 3 cards") + (starting-hand state :runner ["I've Had Worse" "Imp" "Imp"]) + (play-from-hand state :corp "Scorched Earth") + (is (zero? (count (:hand (get-runner)))) "Runner has 0 cards in hand") + (is (= :corp (:winner @state)) "Corp wins") + (is (= "Flatline" (:reason @state)) "Win condition reports flatline") + (is (= 4 (count (:discard (get-runner)))) "All 3 cards in Grip trashed by Scorched Earth") + (is (= 3 (count (:deck (get-runner)))) "No cards drawn from I've Had Worse"))) + (testing "Will save you if you apocalypse away a lot of cards vs Hostile Infrastructure" + (do-game + (new-game {:corp {:deck ["Hostile Infrastructure" (qty "Ice Wall" 2)]} + :runner {:deck [(qty "I've Had Worse" 3) (qty "Sure Gamble" 3) (qty "Apocalypse" 2)]}}) + (starting-hand state :runner ["I've Had Worse" "Apocalypse"]) + (starting-hand state :corp ["Hostile Infrastructure" "Ice Wall" "Ice Wall"]) + (play-from-hand state :corp "Hostile Infrastructure" "New remote") + (play-from-hand state :corp "Ice Wall" "New remote") + (play-from-hand state :corp "Ice Wall" "New remote") + (core/rez state :corp (get-content state :remote1 0)) + (take-credits state :corp) + (run-empty-server state "HQ") + (run-empty-server state "Archives") + (run-empty-server state "R&D") + (play-from-hand state :runner "Apocalypse") + (is (not (= "Flatline" (:reason @state))) "Win condition does not report flatline")))) + (deftest independent-thinking ;; Independent Thinking - Trash 2 installed cards, including a facedown directive, and draw 2 cards (do-game - (new-game - (default-corp) - (make-deck "Apex: Invasive Predator" - ["Neutralize All Threats" (qty "Independent Thinking" 2) - (qty "Fan Site" 3) (qty "Street Magic" 3)])) + (new-game {:runner {:id "Apex: Invasive Predator" + :deck ["Neutralize All Threats" (qty "Independent Thinking" 2) + (qty "Fan Site" 3) (qty "Street Magic" 3)]}}) (starting-hand state :runner ["Fan Site" "Fan Site" "Neutralize All Threats" "Independent Thinking" "Independent Thinking"]) (take-credits state :corp) @@ -1448,9 +1455,9 @@ (deftest indexing ;; Indexing - Full test (do-game - (new-game (default-corp ["Caprice Nisei" "Adonis Campaign" "Quandary" - "Jackson Howard" "Global Food Initiative"]) - (default-runner ["Indexing"])) + (new-game {:corp {:deck ["Caprice Nisei" "Adonis Campaign" "Quandary" + "Jackson Howard" "Global Food Initiative"]} + :runner {:deck ["Indexing"]}}) (dotimes [_ 5] (core/move state :corp (first (:hand (get-corp))) :deck)) (take-credits state :corp) (is (zero? (count (:hand (get-corp))))) @@ -1481,10 +1488,10 @@ (deftest information-sifting ;; Information Sifting - complicated interactions with damage prevention (do-game - (new-game (make-deck "Chronos Protocol: Selective Mind-mapping" - ["Snare!" "PAD Campaign" "Hostile Infrastructure" - "Braintrust" "Hedge Fund" "Power Shutdown"]) - (default-runner [(qty "Information Sifting" 2) (qty "Deus X" 2) "Sure Gamble"])) + (new-game {:corp {:id "Chronos Protocol: Selective Mind-mapping" + :deck ["Snare!" "PAD Campaign" "Hostile Infrastructure" + "Braintrust" "Hedge Fund" "Power Shutdown"]} + :runner {:deck [(qty "Information Sifting" 2) (qty "Deus X" 2) "Sure Gamble"]}}) (play-from-hand state :corp "Hostile Infrastructure" "New remote") (core/gain state :corp :credit 10) (core/rez state :corp (get-content state :remote1 0)) @@ -1537,8 +1544,7 @@ (deftest inject ;; Inject - Draw 4 cards from Stack and gain 1 credit per trashed program (do-game - (new-game (default-corp) - (default-runner ["Inject" (qty "Imp" 2) (qty "Sure Gamble" 2)])) + (new-game {:runner {:deck ["Inject" (qty "Imp" 2) (qty "Sure Gamble" 2)]}}) (take-credits state :corp) (core/move state :runner (find-card "Imp" (:hand (get-runner))) :deck) (core/move state :runner (find-card "Imp" (:hand (get-runner))) :deck) @@ -1555,8 +1561,8 @@ (deftest injection-attack ;; Injection Attack (do-game - (new-game (default-corp ["Paper Wall"]) - (default-runner ["Injection Attack" "Corroder"])) + (new-game {:corp {:deck ["Paper Wall"]} + :runner {:deck ["Injection Attack" "Corroder"]}}) (play-from-hand state :corp "Paper Wall" "Archives") (take-credits state :corp) (play-from-hand state :runner "Corroder") @@ -1574,9 +1580,9 @@ (deftest insight ;; Insight (do-game - (new-game (default-corp ["Caprice Nisei" "Elizabeth Mills" - "Jackson Howard" "Director Haas"]) - (default-runner ["Insight"])) + (new-game {:corp {:deck ["Caprice Nisei" "Elizabeth Mills" + "Jackson Howard" "Director Haas"]} + :runner {:deck ["Insight"]}}) (dotimes [_ 4] (core/move state :corp (first (:hand (get-corp))) :deck)) (take-credits state :corp) (is (zero? (count (:hand (get-corp))))) @@ -1597,9 +1603,9 @@ (deftest interdiction ;; Corp cannot rez non-ice cards during runner's turn (do-game - (new-game (default-corp ["Jeeves Model Bioroids" "Jackson Howard"]) - (default-runner ["Street Peddler" - (qty "Interdiction" 3)])) + (new-game {:corp {:deck ["Jeeves Model Bioroids" "Jackson Howard"]} + :runner {:deck ["Street Peddler" + (qty "Interdiction" 3)]}}) (starting-hand state :runner ["Street Peddler" "Interdiction"]) (play-from-hand state :corp "Jeeves Model Bioroids" "New remote") (play-from-hand state :corp "Jackson Howard" "New remote") @@ -1613,13 +1619,15 @@ (core/rez state :corp jackson) (is (not (:rezzed (refresh jackson))) "Jackson is not rezzed")))) -(deftest ^{:card-title "i've-had-worse"} - ive-had-worse +(deftest i-ve-had-worse ;; I've Had Worse - Draw 3 cards when lost to net/meat damage; don't trigger if flatlined (testing "Basic test" (do-game - (new-game (default-corp [(qty "Scorched Earth" 3) (qty "Pup" 3)]) - (default-runner [(qty "I've Had Worse" 2) (qty "Sure Gamble" 3) (qty "Imp" 2)])) + (new-game {:corp {:deck [(qty "Scorched Earth" 3) + (qty "Pup" 3)]}} + {:runner {:deck [(qty "I've Had Worse" 2) + (qty "Sure Gamble" 3) + (qty "Imp" 2)]}}) (core/gain-tags state :runner 1) (core/gain state :corp :credit 5) (starting-hand state :runner ["I've Had Worse"]) @@ -1637,8 +1645,11 @@ (is (= 3 (count (:deck (get-runner)))) "No cards drawn from I've Had Worse"))) (testing "Will save you if you apocalypse away a lot of cards vs Hostile Infrastructure" (do-game - (new-game (default-corp ["Hostile Infrastructure" (qty "Ice Wall" 2)]) - (default-runner [(qty "I've Had Worse" 3) (qty "Sure Gamble" 3) (qty "Apocalypse" 2)])) + (new-game {:corp {:deck ["Hostile Infrastructure" + (qty "Ice Wall" 2)]}} + {:runner {:deck [(qty "I've Had Worse" 3) + (qty "Sure Gamble" 3) + (qty "Apocalypse" 2)]}}) (starting-hand state :runner ["I've Had Worse" "Apocalypse"]) (starting-hand state :corp ["Hostile Infrastructure" "Ice Wall" "Ice Wall"]) (play-from-hand state :corp "Hostile Infrastructure" "New remote") @@ -1655,8 +1666,8 @@ (deftest knifed ;; Knifed - Make a run, trash a barrier if all subs broken (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Knifed"])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Knifed"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (core/rez state :corp (get-ice state :hq 0)) (take-credits state :corp) @@ -1667,8 +1678,7 @@ (deftest lawyer-up ;; Lawyer Up - Lose 2 tags and draw 3 cards (do-game - (new-game (default-corp) - (default-runner ["Lawyer Up" (qty "Sure Gamble" 3)])) + (new-game {:runner {:deck ["Lawyer Up" (qty "Sure Gamble" 3)]}}) (take-credits state :corp) (core/move state :runner (find-card "Sure Gamble" (:hand (get-runner))) :deck) (core/move state :runner (find-card "Sure Gamble" (:hand (get-runner))) :deck) @@ -1683,8 +1693,8 @@ ;; Leave No Trace should derez ICE that was rezzed during the run (testing "Basic test" (do-game - (new-game (default-corp [(qty "Ice Wall" 2)]) - (default-runner ["Leave No Trace"])) + (new-game {:corp {:deck [(qty "Ice Wall" 2)]} + :runner {:deck ["Leave No Trace"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (play-from-hand state :corp "Ice Wall" "HQ") (core/rez state :corp (get-ice state :hq 1)) @@ -1697,8 +1707,8 @@ (is (:rezzed (get-ice state :hq 1)) "Outer Ice Wall should be rezzed still"))) (testing "should not derez ICE that has changed during a run" (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Leave No Trace"])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Leave No Trace"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (core/rez state :corp (get-ice state :hq 0)) (take-credits state :corp) @@ -1713,8 +1723,8 @@ (deftest mad-dash ;; Mad Dash - Make a run. Move to score pile as 1 point if steal agenda. Take 1 meat if not (do-game - (new-game (default-corp ["Project Atlas"]) - (default-runner [(qty "Mad Dash" 3)])) + (new-game {:corp {:deck ["Project Atlas"]} + :runner {:deck [(qty "Mad Dash" 3)]}}) (take-credits state :corp) (play-from-hand state :runner "Mad Dash") (click-prompt state :runner "Archives") @@ -1730,9 +1740,8 @@ (deftest making-an-entrance ;; Making an Entrance - Full test (do-game - (new-game (default-corp) - (default-runner [(qty "Making an Entrance" 2) "Sure Gamble" "Desperado" - "Diesel" "Corroder" "Patron"])) + (new-game {:runner {:deck [(qty "Making an Entrance" 2) "Sure Gamble" "Desperado" + "Diesel" "Corroder" "Patron"]}}) (starting-hand state :runner ["Making an Entrance"]) (is (= 1 (count (:hand (get-runner))))) (take-credits state :corp) @@ -1768,9 +1777,8 @@ (deftest mars-for-martians ;; Mars for Martians - Full test (do-game - (new-game (default-corp) - (default-runner ["Mars for Martians" "Clan Vengeance" "Counter Surveillance" - "Jarogniew Mercs" (qty "Sure Gamble" 3)])) + (new-game {:runner {:deck ["Mars for Martians" "Clan Vengeance" "Counter Surveillance" + "Jarogniew Mercs" (qty "Sure Gamble" 3)]}}) (starting-hand state :runner ["Mars for Martians" "Clan Vengeance" "Counter Surveillance" "Jarogniew Mercs"]) (take-credits state :corp) (play-from-hand state :runner "Clan Vengeance") @@ -1791,9 +1799,7 @@ (deftest mobius ;; Mobius (do-game - (new-game - (default-corp) - (default-runner [(qty "Möbius" 3)])) + (new-game {:runner {:deck [(qty "Möbius" 3)]}}) (starting-hand state :corp ["Hedge Fund"]) (take-credits state :corp) (is (= 5 (:credit (get-runner)))) @@ -1817,11 +1823,10 @@ (deftest modded ;; Modded - Install a program or piece of hardware at a 3 credit discount (do-game - (new-game (default-corp) - (default-runner [(qty "Modded" 2) + (new-game {:runner {:deck [(qty "Modded" 2) "HQ Interface" "Nerve Agent" - "Earthrise Hotel"])) + "Earthrise Hotel"]}}) (take-credits state :corp) (play-from-hand state :runner "Modded") (click-card state :runner (find-card "Earthrise Hotel" (:hand (get-runner)))) @@ -1834,34 +1839,11 @@ (is (= 1 (count (get-program state))) "Installed Nerve Agent") (is (= 4 (:credit (get-runner))) "Paid 0 credits"))) -(deftest the-noble-path - ;; The Noble Path - Prevents damage during run - (do-game - (new-game (default-corp) (default-runner ["The Noble Path" (qty "Sure Gamble" 2)])) - (let [hand-count #(count (:hand (get-runner)))] - (starting-hand state :runner ["The Noble Path" "Sure Gamble"]) - (take-credits state :corp) - ;; Play The Noble Path and confirm it trashes remaining cards in hand - (is (= 2 (hand-count)) "Start with 2 cards") - (play-from-hand state :runner "The Noble Path") - (is (zero? (hand-count)) "Playing Noble Path trashes the remaining cards in hand") - ;; Put a card into hand so I can confirm it's not discarded by damage - ;; Don't want to dealing with checking damage on a zero card hand - (starting-hand state :runner ["Sure Gamble"]) - (core/damage state :runner :net 1) - (is (= 1 (hand-count)) "Damage was prevented") - ;; Finish the run and check that damage works again - (click-prompt state :runner "HQ") - (run-successful state) - (click-prompt state :runner "No action") - (core/damage state :runner :net 1) - (is (zero? (hand-count)) "Damage works again after run")))) - (deftest notoriety ;; Notoriety - Run all 3 central servers successfully and play to gain 1 agenda point (do-game - (new-game (default-corp ["Hedge Fund"]) - (default-runner ["Notoriety"])) + (new-game {:corp {:deck ["Hedge Fund"]} + :runner {:deck ["Notoriety"]}}) (play-from-hand state :corp "Hedge Fund") (take-credits state :corp) (run-empty-server state "Archives") @@ -1875,9 +1857,8 @@ ;; Office Supplies (letfn [(office-supplies-test [link] (do-game - (new-game (default-corp) - (default-runner [(qty "Office Supplies" 2) - (qty "Access to Globalsec" 100)])) + (new-game {:runner {:deck [(qty "Office Supplies" 2) + (qty "Access to Globalsec" 100)]}}) (take-credits state :corp) (core/gain state :runner :credit 1000 :click link) (starting-hand state :runner (concat (repeat 2 "Office Supplies") @@ -1900,8 +1881,8 @@ ;; On the Lam (testing "vs tags" (do-game - (new-game (default-corp ["SEA Source"]) - (default-runner ["Daily Casts" "On the Lam"])) + (new-game {:corp {:deck ["SEA Source"]} + :runner {:deck ["Daily Casts" "On the Lam"]}}) (take-credits state :corp) (core/gain state :runner :credit 10) (play-from-hand state :runner "Daily Casts") @@ -1918,8 +1899,8 @@ (is (= 1 (-> (get-runner) :discard count)) "Runner should have 1 card in Heap"))) (testing "vs damage" (do-game - (new-game (default-corp ["Show of Force"]) - (default-runner ["Daily Casts" "On the Lam"])) + (new-game {:corp {:deck ["Show of Force"]} + :runner {:deck ["Daily Casts" "On the Lam"]}}) (take-credits state :corp) (core/gain state :runner :credit 10) (play-from-hand state :runner "Daily Casts") @@ -1935,8 +1916,8 @@ (deftest out-of-the-ashes ;; Out of the Ashes - ensure card works when played/trashed/milled (do-game - (new-game (default-corp ["Kala Ghoda Real TV" "Underway Renovation"]) - (default-runner [(qty "Out of the Ashes" 6)])) + (new-game {:corp {:deck ["Kala Ghoda Real TV" "Underway Renovation"]} + :runner {:deck [(qty "Out of the Ashes" 6)]}}) (play-from-hand state :corp "Underway Renovation" "New remote") (take-credits state :corp) (play-from-hand state :runner "Out of the Ashes") @@ -1978,8 +1959,7 @@ (deftest peace-in-our-time ;; Peace in Our Time - runner gains 10, corp gains 5. No runs allowed during turn. (do-game - (new-game (default-corp) - (default-runner ["Peace in Our Time"])) + (new-game {:runner {:deck ["Peace in Our Time"]}}) (take-credits state :corp) (is (= 8 (:credit (get-corp))) "Corp starts with 8 credits") (is (= 5 (:credit (get-runner))) "Runner starts with 5 credits") @@ -1993,8 +1973,8 @@ ;; Political Graffiti - swapping with Turntable works / purging viruses restores points (testing "Basic test" (do-game - (new-game (default-corp ["Breaking News" "Chronos Project"]) - (default-runner ["Turntable" "Political Graffiti"])) + (new-game {:corp {:deck ["Breaking News" "Chronos Project"]} + :runner {:deck ["Turntable" "Political Graffiti"]}}) (play-from-hand state :corp "Breaking News" "New remote") (score-agenda state :corp (get-content state :remote1 0)) (is (= 1 (:agenda-point (get-corp)))) @@ -2019,8 +1999,8 @@ (is (= 1 (:agenda-point (get-runner))))))) (testing "Forfeiting agenda with Political Graffiti does not refund double points. Issue #2765" (do-game - (new-game (default-corp ["Project Kusanagi" "Corporate Town"]) - (default-runner ["Political Graffiti"])) + (new-game {:corp {:deck ["Project Kusanagi" "Corporate Town"]}} + {:runner {:deck ["Political Graffiti"]}}) (play-from-hand state :corp "Corporate Town" "New remote") (play-and-score state "Project Kusanagi") (is (zero? (:agenda-point (get-corp)))) @@ -2042,8 +2022,8 @@ (deftest power-to-the-people ;; Power to the People - Gain 7c the first time you access an agenda (do-game - (new-game (default-corp ["NAPD Contract" "Hostile Takeover"]) - (default-runner ["Power to the People"])) + (new-game {:corp {:deck ["NAPD Contract" "Hostile Takeover"]} + :runner {:deck ["Power to the People"]}}) (play-from-hand state :corp "NAPD Contract" "New remote") (take-credits state :corp) (core/lose state :runner :credit 2) @@ -2062,8 +2042,7 @@ ;; Push Your Luck (testing "Corp guesses correctly" (do-game - (new-game (default-corp) - (default-runner ["Push Your Luck"])) + (new-game {:runner {:deck ["Push Your Luck"]}}) (take-credits state :corp) (play-from-hand state :runner "Push Your Luck") (click-prompt state :corp "Odd") @@ -2071,8 +2050,7 @@ (is (zero? (:credit (get-runner))) "Corp guessed correctly"))) (testing "Corp guesses incorrectly" (do-game - (new-game (default-corp) - (default-runner ["Push Your Luck"])) + (new-game {:runner {:deck ["Push Your Luck"]}}) (take-credits state :corp) (play-from-hand state :runner "Push Your Luck") (click-prompt state :corp "Even") @@ -2082,8 +2060,7 @@ (deftest pushing-the-envelope ;; Run. Add 2 strength to each installer breaker. (do-game - (new-game (default-corp) - (default-runner [(qty "Pushing the Envelope" 3) (qty "Corroder" 2) "Atman"])) + (new-game {:runner {:deck [(qty "Pushing the Envelope" 3) (qty "Corroder" 2) "Atman"]}}) (take-credits state :corp) (core/gain state :runner :credit 20) (core/gain state :runner :click 10) @@ -2111,12 +2088,11 @@ (is (zero? (:current-strength (refresh atman))) "Atman 0 current strength") (is (= 2 (:current-strength (refresh corr))) "Corroder 2 current strength")))) -(deftest ^{:card-title "queen's-gambit"} - queens-gambit +(deftest queen-s-gambit ;; Check that Queen's Gambit prevents access of card #1542 (do-game - (new-game (default-corp [(qty "PAD Campaign" 2)]) - (default-runner ["Queen's Gambit"])) + (new-game {:corp {:deck [(qty "PAD Campaign" 2)]} + :runner {:deck ["Queen's Gambit"]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (play-from-hand state :corp "PAD Campaign" "New remote") (take-credits state :corp) @@ -2141,7 +2117,7 @@ (click-prompt state :runner "Pay 4 [Credits] to trash") (is (= (- runner-creds 4) (:credit (get-runner))) "Paid 4 credits to trash PAD Campaign")))) -;; Rebirth +;; rebirth (let [akiko "Akiko Nisei: Head Case" kate "Kate \"Mac\" McCaffrey: Digital Tinker" kit "Rielle \"Kit\" Peddler: Transhuman" @@ -2150,14 +2126,12 @@ chaos "Chaos Theory: Wünderkind" whizzard "Whizzard: Master Gamer" reina "Reina Roja: Freedom Fighter"] - (deftest rebirth ;; Rebirth - Kate's discount applies after rebirth (testing "Kate" (do-game - (new-game (default-corp) - (default-runner ["Magnum Opus" "Rebirth"]) - {:start-as :runner}) + (new-game {:runner {:deck ["Magnum Opus" "Rebirth"]} + :options {:start-as :runner}}) (play-from-hand state :runner "Rebirth") (is (= (first (prompt-titles :runner)) akiko) "List is sorted") (is (every? #(some #{%} (prompt-titles :runner)) @@ -2173,7 +2147,9 @@ (play-from-hand state :runner "Magnum Opus"))))) (testing "Whizzard works after rebirth" (do-game - (new-game (default-corp ["Ice Wall"]) (make-deck reina ["Rebirth"])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:id reina + :deck ["Rebirth"]}}) (play-from-hand state :corp "Ice Wall" "R&D") (take-credits state :corp) (play-from-hand state :runner "Rebirth") @@ -2185,9 +2161,9 @@ "Reina is no longer active"))) (testing "Lose link from ID" (do-game - (new-game (default-corp) - (make-deck kate ["Rebirth" "Access to Globalsec"]) - {:start-as :runner}) + (new-game {:runner {:id kate + :deck ["Rebirth" "Access to Globalsec"]} + :options {:start-as :runner}}) (play-from-hand state :runner "Access to Globalsec") (is (= 2 (:link (get-runner))) "2 link before rebirth") (play-from-hand state :runner "Rebirth") @@ -2195,9 +2171,8 @@ (is (= 1 (:link (get-runner))) "1 link after rebirth"))) (testing "Gain link from ID" (do-game - (new-game (default-corp) - (default-runner ["Rebirth" "Access to Globalsec"]) - {:start-as :runner}) + (new-game {:runner {:deck ["Rebirth" "Access to Globalsec"]} + :options {:start-as :runner}}) (play-from-hand state :runner "Access to Globalsec") (is (= 1 (:link (get-runner))) "1 link before rebirth") (play-from-hand state :runner "Rebirth") @@ -2205,19 +2180,17 @@ (is (= 2 (:link (get-runner))) "2 link after rebirth"))) (testing "Implementation notes are kept, regression test for #3722" (do-game - (new-game (default-corp) - (default-runner ["Rebirth"]) - {:start-as :runner}) + (new-game {:runner {:deck ["Rebirth"]} + :options {:start-as :runner}}) (play-from-hand state :runner "Rebirth") (click-prompt state :runner chaos) (is (= :full (get-in (get-runner) [:identity :implementation])) "Implementation note kept as `:full`")))) - (deftest rebirth-kate-twice + (testing "Rebirth into Kate twice" ;; Rebirth - Kate does not give discount after rebirth if Hardware or Program already installed (testing "Installing Hardware before does prevent discount" (do-game - (new-game (default-corp) - (default-runner ["Akamatsu Mem Chip" "Rebirth" "Clone Chip"]) - {:start-as :runner}) + (new-game {:runner {:deck ["Akamatsu Mem Chip" "Rebirth" "Clone Chip"]} + :options {:start-as :runner}}) (play-from-hand state :runner "Clone Chip") (play-from-hand state :runner "Rebirth") (click-prompt state :runner kate) @@ -2227,9 +2200,8 @@ "Discount not applied for 2nd install"))) (testing "Installing Resource before does not prevent discount" (do-game - (new-game (default-corp) - (default-runner ["Akamatsu Mem Chip" "Rebirth" "Same Old Thing"]) - {:start-as :runner}) + (new-game {:runner {:deck ["Akamatsu Mem Chip" "Rebirth" "Same Old Thing"]} + :options {:start-as :runner}}) (play-from-hand state :runner "Same Old Thing") (play-from-hand state :runner "Rebirth") (click-prompt state :runner kate) @@ -2237,12 +2209,13 @@ (is (changes-credits (get-runner) 0 (play-from-hand state :runner "Akamatsu Mem Chip")) "Discount is applied for 2nd install (since it is the first Hardware / Program)")))) - (deftest rebirth-reina-twice + (testing "Rebirth into Reina twice" ;; Rebirth - Reina does not increase rez cost after rebirth if Ice already rezzed (testing "Rezzing Ice before does prevent cost" (do-game - (new-game (default-corp [(qty "Ice Wall" 2)]) - (make-deck whizzard ["Rebirth"])) + (new-game {:corp {:deck [(qty "Ice Wall" 2)]} + :runner {:id whizzard + :deck ["Rebirth"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (play-from-hand state :corp "Ice Wall" "R&D") (take-credits state :corp) @@ -2257,9 +2230,9 @@ "Additional cost from Reina not applied for 2nd ice rez"))) (testing "Rezzing Asset before does not prevent additional cost" (do-game - (new-game (default-corp ["Ice Wall" "Mark Yale"]) - (make-deck whizzard ["Rebirth"])) - (println "Reina Rebirth twice test") + (new-game {:corp {:deck ["Ice Wall" "Mark Yale"]} + :runner {:id whizzard + :deck ["Rebirth"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (play-from-hand state :corp "Mark Yale" "New remote") (take-credits state :corp) @@ -2276,8 +2249,7 @@ (deftest reboot ;; Reboot - run on Archives, install 5 cards from head facedown (do-game - (new-game (default-corp) - (default-runner ["Reboot" "Sure Gamble" "Paperclip" "Clot"])) + (new-game {:runner {:deck ["Reboot" "Sure Gamble" "Paperclip" "Clot"]}}) (take-credits state :corp) (trash-from-hand state :runner "Sure Gamble") (trash-from-hand state :runner "Paperclip") @@ -2299,8 +2271,8 @@ (deftest reshape ;; Reshape - Swap 2 pieces of unrezzed ICE (do-game - (new-game (default-corp [(qty "Vanilla" 2) "Paper Wall"]) - (default-runner ["Reshape"])) + (new-game {:corp {:deck [(qty "Vanilla" 2) "Paper Wall"]} + :runner {:deck ["Reshape"]}}) (play-from-hand state :corp "Paper Wall" "R&D") (play-from-hand state :corp "Vanilla" "HQ") (play-from-hand state :corp "Vanilla" "HQ") @@ -2318,8 +2290,7 @@ (deftest retrieval-run ;; Retrieval Run - Run Archives successfully and install a program from Heap for free (do-game - (new-game (default-corp) - (default-runner ["Retrieval Run" "Morning Star"])) + (new-game {:runner {:deck ["Retrieval Run" "Morning Star"]}}) (take-credits state :corp) (trash-from-hand state :runner "Morning Star") (play-from-hand state :runner "Retrieval Run") @@ -2336,8 +2307,8 @@ (deftest rigged-results ;; Rigged Results - success and failure (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner [(qty "Rigged Results" 3)])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck [(qty "Rigged Results" 3)]}}) (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) (play-from-hand state :runner "Rigged Results") @@ -2356,8 +2327,8 @@ ;; Rip Deal - replaces number of HQ accesses with heap retrieval (testing "Basic test" (do-game - (new-game (default-corp [(qty "Crisium Grid" 2)(qty "Vanilla" 2)]) - (default-runner ["The Gauntlet" "Rip Deal" (qty "Easy Mark" 2)])) + (new-game {:corp {:deck [(qty "Crisium Grid" 2)(qty "Vanilla" 2)]} + :runner {:deck ["The Gauntlet" "Rip Deal" (qty "Easy Mark" 2)]}}) (trash-from-hand state :runner "Easy Mark") (trash-from-hand state :runner "Easy Mark") (take-credits state :corp) @@ -2367,8 +2338,8 @@ (is (= "Choose 1 card(s) to move from the Heap to your Grip" (-> (get-runner) :prompt first :msg))))) (testing "with Gauntlet #2942" (do-game - (new-game (default-corp [(qty "Crisium Grid" 2)(qty "Vanilla" 2)]) - (default-runner ["The Gauntlet" "Rip Deal" (qty "Easy Mark" 2)])) + (new-game {:corp {:deck [(qty "Crisium Grid" 2)(qty "Vanilla" 2)]} + :runner {:deck ["The Gauntlet" "Rip Deal" (qty "Easy Mark" 2)]}}) (trash-from-hand state :runner "Easy Mark") (trash-from-hand state :runner "Easy Mark") (play-from-hand state :corp "Vanilla" "HQ") @@ -2386,12 +2357,11 @@ ;; Rumor Mill - interactions with rez effects, additional costs, general event handlers, and trash-effects (testing "Full test" (do-game - (new-game - (default-corp [(qty "Project Atlas" 2) - "Caprice Nisei" "Chairman Hiro" "Cybernetics Court" - "Elizabeth Mills" "Ibrahim Salem" - "Housekeeping" "Director Haas" "Oberth Protocol"]) - (default-runner ["Rumor Mill"])) + (new-game {:corp {:deck [(qty "Project Atlas" 2) + "Caprice Nisei" "Chairman Hiro" "Cybernetics Court" + "Elizabeth Mills" "Ibrahim Salem" + "Housekeeping" "Director Haas" "Oberth Protocol"]} + :runner {:deck ["Rumor Mill"]}}) (core/gain state :corp :credit 100 :click 100 :bad-publicity 1) (core/draw state :corp 100) (play-from-hand state :corp "Caprice Nisei" "New remote") @@ -2451,8 +2421,8 @@ (is (:prompt (get-corp)) "Elizabeth Mills ability allowed"))) (testing "Make sure Rumor Mill is not active when hosted on Peddler" (do-game - (new-game (default-corp ["Jeeves Model Bioroids"]) - (default-runner ["Street Peddler" (qty "Rumor Mill" 3)])) + (new-game {:corp {:deck ["Jeeves Model Bioroids"]} + :runner {:deck ["Street Peddler" (qty "Rumor Mill" 3)]}}) (take-credits state :corp) (starting-hand state :runner ["Street Peddler"]) (play-from-hand state :runner "Street Peddler") @@ -2466,9 +2436,9 @@ (deftest scrubbed ;; First piece of ice encountered each turn has -2 Strength for remainder of the run (do-game - (new-game (default-corp ["Turing"]) - (default-runner ["Street Peddler" - (qty "Scrubbed" 3)])) + (new-game {:corp {:deck ["Turing"]} + :runner {:deck ["Street Peddler" + (qty "Scrubbed" 3)]}}) (starting-hand state :runner ["Street Peddler" "Scrubbed"]) (play-from-hand state :corp "Turing" "HQ") (take-credits state :corp) @@ -2488,10 +2458,10 @@ (deftest singularity ;; Singularity - Run a remote; if successful, trash all contents at no cost (do-game - (new-game (default-corp ["Caprice Nisei" + (new-game {:corp {:deck ["Caprice Nisei" "Breaker Bay Grid" - "Eve Campaign"]) - (default-runner ["Singularity"])) + "Eve Campaign"]} + :runner {:deck ["Singularity"]}}) (play-from-hand state :corp "Breaker Bay Grid" "New remote") (play-from-hand state :corp "Caprice Nisei" "Server 1") (play-from-hand state :corp "Eve Campaign" "Server 1") @@ -2508,8 +2478,8 @@ (deftest stimhack ;; Stimhack - Gain 9 temporary credits and take 1 brain damage after the run (do-game - (new-game (default-corp ["Eve Campaign"]) - (default-runner ["Stimhack" "Sure Gamble"])) + (new-game {:corp {:deck ["Eve Campaign"]} + :runner {:deck ["Stimhack" "Sure Gamble"]}}) (take-credits state :corp) (play-from-hand state :runner "Stimhack") (click-prompt state :runner "HQ") @@ -2529,7 +2499,7 @@ (deftest sure-gamble ;; Sure Gamble (do-game - (new-game (default-corp) (default-runner ["Sure Gamble"])) + (new-game {:runner {:deck ["Sure Gamble"]}}) (take-credits state :corp) (is (= 5 (:credit (get-runner)))) (play-from-hand state :runner "Sure Gamble") @@ -2539,8 +2509,7 @@ ;; Surge - Add counters if target is a virus and had a counter added this turn (testing "Valid target" (do-game - (new-game (default-corp) - (default-runner ["Imp" "Surge"])) + (new-game {:runner {:deck ["Imp" "Surge"]}}) (take-credits state :corp) (play-from-hand state :runner "Imp") (let [imp (get-program state 0)] @@ -2550,8 +2519,7 @@ (is (= 4 (get-counters (refresh imp) :virus)) "Imp has 4 counters after surge")))) (testing "Don't fire surge if target is not a virus" (do-game - (new-game (default-corp) - (default-runner ["Security Testing" "Surge"])) + (new-game {:runner {:deck ["Security Testing" "Surge"]}}) (take-credits state :corp) (play-from-hand state :runner "Security Testing") (let [st (get-resource state 0)] @@ -2560,8 +2528,7 @@ (is (not (contains? st :counter)) "Surge does not fire on Security Testing")))) (testing "Don't fire surge if target does not have virus counter flag set" (do-game - (new-game (default-corp) - (default-runner ["Imp" "Surge"])) + (new-game {:runner {:deck ["Imp" "Surge"]}}) (take-credits state :corp) (play-from-hand state :runner "Imp") (let [imp (get-program state 0)] @@ -2573,8 +2540,7 @@ (is (= 2 (get-counters (refresh imp) :virus)) "Surge does not fire on Imp turn after install")))) (testing "Don't allow surging Gorman Drip, since it happens on the corp turn" (do-game - (new-game (default-corp) - (default-runner ["Gorman Drip v1" "Surge"])) + (new-game {:runner {:deck ["Gorman Drip v1" "Surge"]}}) (take-credits state :corp) (play-from-hand state :runner "Gorman Drip v1") (let [gd (get-program state 0)] @@ -2590,9 +2556,9 @@ (deftest system-outage ;; When Corp draws 1+ cards, it loses 1 if it is not the first time he or she has drawn cards this turn (do-game - (new-game (default-corp [(qty "Turing" 10)]) - (default-runner ["Street Peddler" - (qty "System Outage" 3)])) + (new-game {:corp {:deck [(qty "Turing" 10)]} + :runner {:deck ["Street Peddler" + (qty "System Outage" 3)]}}) (starting-hand state :corp []) (starting-hand state :runner ["Street Peddler" "System Outage"]) (take-credits state :corp) ; corp at 8cr @@ -2614,8 +2580,8 @@ (deftest system-seizure ;; System Seizure - First icebreaker boosted keeps strength for remainder of that run. (do-game - (new-game (default-corp ["Wraparound"]) - (default-runner [(qty "Corroder" 2) "System Seizure"])) + (new-game {:corp {:deck ["Wraparound"]} + :runner {:deck [(qty "Corroder" 2) "System Seizure"]}}) (play-from-hand state :corp "Wraparound" "HQ") (take-credits state :corp) (core/gain state :runner :credit 3) @@ -2654,49 +2620,47 @@ (is (= 2 (core/breaker-strength state :runner (core/get-card state c2))) "Corroder 2 has 2 strength")))) (deftest test-run - ;; Test Run - Programs hosted after install get returned to Stack. Issue #1081 - (do-game - (new-game (default-corp ["Wraparound"]) - (default-runner [(qty "Test Run" 2) "Morning Star" - "Knight" "Leprechaun"])) - (play-from-hand state :corp "Wraparound" "HQ") - (let [wrap (get-ice state :hq 0)] - (core/rez state :corp wrap) + ;; Test Run + (testing "Programs hosted after install get returned to Stack. Issue #1081" + (do-game + (new-game {:corp {:deck ["Wraparound"]} + :runner {:deck [(qty "Test Run" 2) "Morning Star" + "Knight" "Leprechaun"]}}) + (play-from-hand state :corp "Wraparound" "HQ") + (let [wrap (get-ice state :hq 0)] + (core/rez state :corp wrap)) (take-credits state :corp) (core/gain state :runner :credit 5) - (core/move state :runner (find-card "Morning Star" (:hand (get-runner))) :discard) - (core/move state :runner (find-card "Knight" (:hand (get-runner))) :discard) + (trash-from-hand state :runner "Morning Star") + (trash-from-hand state :runner "Knight") (let [ms (find-card "Morning Star" (:discard (get-runner)))] (play-from-hand state :runner "Leprechaun") (play-from-hand state :runner "Test Run") (click-prompt state :runner "Heap") - (click-prompt state :runner ms) - (let [lep (get-program state 0) - ms (get-program state 1)] - (card-ability state :runner lep 1) - (click-card state :runner ms) - (is (= "Morning Star" (:title (first (:hosted (refresh lep))))) "Morning Star hosted on Lep") - (take-credits state :runner) - (is (= "Morning Star" (:title (first (:deck (get-runner))))) "Morning Star returned to Stack from host") - (take-credits state :corp) - (let [kn (find-card "Knight" (:discard (get-runner)))] - (play-from-hand state :runner "Test Run") - (click-prompt state :runner "Heap") - (click-prompt state :runner kn) - (let [kn (get-program state 1)] - (card-ability state :runner kn 0) - (click-card state :runner wrap) - (is (= "Knight" (:title (first (:hosted (refresh wrap))))) "Knight hosted on Wraparound") - (take-credits state :runner) - (is (= "Knight" (:title (first (:deck (get-runner))))) "Knight returned to Stack from host ICE")))))))) - -(deftest test-run - ;; Test Run + (click-prompt state :runner ms)) + (let [lep (get-program state 0) + ms (get-program state 1)] + (card-ability state :runner lep 1) + (click-card state :runner ms) + (is (= "Morning Star" (:title (first (:hosted (refresh lep))))) "Morning Star hosted on Lep")) + (take-credits state :runner) + (is (= "Morning Star" (:title (first (:deck (get-runner))))) "Morning Star returned to Stack from host") + (take-credits state :corp) + (let [kn (find-card "Knight" (:discard (get-runner)))] + (play-from-hand state :runner "Test Run") + (click-prompt state :runner "Heap") + (click-prompt state :runner kn)) + (let [wrap (get-ice state :hq 0) + kn (get-program state 1)] + (card-ability state :runner kn 0) + (click-card state :runner wrap) + (is (= "Knight" (:title (first (:hosted (refresh wrap))))) "Knight hosted on Wraparound") + (take-credits state :runner) + (is (= "Knight" (:title (first (:deck (get-runner))))) "Knight returned to Stack from host ICE")))) (testing "Make sure program remains installed if Scavenged" (do-game - (new-game (default-corp) - (default-runner ["Test Run" "Morning Star" - "Scavenge" "Inti"])) + (new-game {:runner {:deck ["Test Run" "Morning Star" + "Scavenge" "Inti"]}}) (take-credits state :corp) (core/move state :runner (find-card "Morning Star" (:hand (get-runner))) :discard) (play-from-hand state :runner "Test Run") @@ -2712,10 +2676,10 @@ (is (empty? (:deck (get-runner))) "Morning Star not returned to Stack") (is (= "Morning Star" (:title (get-program state 0))) "Morning Star still installed")))))) -(deftest the-maker's-eye +(deftest the-maker-s-eye (do-game - (new-game (default-corp [(qty "Quandary" 5)]) - (default-runner ["The Maker's Eye"])) + (new-game {:corp {:deck [(qty "Quandary" 5)]} + :runner {:deck ["The Maker's Eye"]}}) (dotimes [_ 5] (core/move state :corp (first (:hand (get-corp))) :deck)) (take-credits state :corp) (play-from-hand state :runner "The Maker's Eye") @@ -2732,11 +2696,34 @@ (click-prompt state :runner "No action") (is (not (:run @state))))) +(deftest the-noble-path + ;; The Noble Path - Prevents damage during run + (do-game + (new-game {:runner {:deck ["The Noble Path" (qty "Sure Gamble" 2)]}}) + (let [hand-count #(count (:hand (get-runner)))] + (starting-hand state :runner ["The Noble Path" "Sure Gamble"]) + (take-credits state :corp) + ;; Play The Noble Path and confirm it trashes remaining cards in hand + (is (= 2 (hand-count)) "Start with 2 cards") + (play-from-hand state :runner "The Noble Path") + (is (zero? (hand-count)) "Playing Noble Path trashes the remaining cards in hand") + ;; Put a card into hand so I can confirm it's not discarded by damage + ;; Don't want to dealing with checking damage on a zero card hand + (starting-hand state :runner ["Sure Gamble"]) + (core/damage state :runner :net 1) + (is (= 1 (hand-count)) "Damage was prevented") + ;; Finish the run and check that damage works again + (click-prompt state :runner "HQ") + (run-successful state) + (click-prompt state :runner "No action") + (core/damage state :runner :net 1) + (is (zero? (hand-count)) "Damage works again after run")))) + (deftest the-price-of-freedom ;; The Price of Freedom - A connection must be trashed, the card is removed from game, then the corp can't advance cards next turn (do-game - (new-game (default-corp ["NAPD Contract"]) - (default-runner ["Kati Jones" "The Price of Freedom"])) + (new-game {:corp {:deck ["NAPD Contract"]} + :runner {:deck ["Kati Jones" "The Price of Freedom"]}}) (play-from-hand state :corp "NAPD Contract" "New remote") (take-credits state :corp) (is (= 7 (:credit (get-corp))) "Corp has 7 credits (play NAPD + 2 clicks for credit") @@ -2766,9 +2753,8 @@ (deftest tinkering ;; Tinkering - Add subtypes to ice (do-game - (new-game - (default-corp ["Ice Wall"]) - (default-runner ["Tinkering"])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Tinkering"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) (play-from-hand state :runner "Tinkering") @@ -2790,15 +2776,12 @@ ;; Trade-in - trash an installed Hardware, gain credits equal to half of install cost, ;; search stack for Hardware and add to grip (do-game - (new-game - (default-corp) - (default-runner [(qty "Trade-In" 3) (qty "Astrolabe" 2) (qty "Sports Hopper" 2)]) - {:start-as :runner}) + (new-game {:runner {:deck [(qty "Trade-In" 3) (qty "Astrolabe" 2) (qty "Sports Hopper" 2)]} + :options {:start-as :runner}}) (starting-hand state :runner ["Trade-In" "Trade-In" "Astrolabe" "Sports Hopper"]) (core/gain state :runner :click 5 :credit 5) (play-from-hand state :runner "Astrolabe") (play-from-hand state :runner "Sports Hopper") - (testing "Trade-in works with Hardware costing 0 or 1 credits (issue #3750)" (let [runner-credits (:credit (get-runner))] (play-from-hand state :runner "Trade-In") @@ -2806,13 +2789,11 @@ (is (= 2 (count (:discard (get-runner)))) "Trade-In and Astrolabe in discard") (is (= (- runner-credits 1) (:credit (get-runner))) "Paid 1 credit to play Trade-In and gained 0 credits from trashing Astrolabe"))) - (testing "Trade-In lets runner search for Hardware and add it to Grip" (is (= 1 (count (:hand (get-runner)))) "Only 1 Trade-In in Grip") ;; Add sports hopper to hand (click-prompt state :runner (-> (get-runner) :prompt first :choices first)) (is (= 2 (count (:hand (get-runner)))) "Sports Hopper added to Grip")) - (testing "Gain credits when install cost is greater than 1" (let [runner-credits (:credit (get-runner))] (play-from-hand state :runner "Trade-In") @@ -2824,9 +2805,8 @@ (deftest traffic-jam ;; Traffic Jam - Increase adv requirement based on previously scored copies (do-game - (new-game - (default-corp [(qty "TGTBT" 3)]) - (default-runner ["Traffic Jam"])) + (new-game {:corp {:deck [(qty "TGTBT" 3)]} + :runner {:deck ["Traffic Jam"]}}) (play-from-hand state :corp "TGTBT" "New remote") (score-agenda state :corp (get-content state :remote1 0)) (play-from-hand state :corp "TGTBT" "New remote") @@ -2853,9 +2833,8 @@ (deftest unscheduled-maintenance ;; Unscheduled Maintenance - prevent Corp from installing more than 1 ICE per turn (do-game - (new-game - (default-corp [(qty "Vanilla" 2) "Breaking News"]) - (default-runner ["Unscheduled Maintenance"])) + (new-game {:corp {:deck [(qty "Vanilla" 2) "Breaking News"]} + :runner {:deck ["Unscheduled Maintenance"]}}) (play-from-hand state :corp "Breaking News" "New remote") (take-credits state :corp) (play-from-hand state :runner "Unscheduled Maintenance") @@ -2871,7 +2850,7 @@ (deftest vamp ;; Vamp - Run HQ and use replace access to pay credits to drain equal amount from Corp (do-game - (new-game (default-corp) (default-runner ["Vamp" (qty "Sure Gamble" 3)])) + (new-game {:runner {:deck ["Vamp" (qty "Sure Gamble" 3)]}}) (take-credits state :corp) (is (= 8 (:credit (get-corp)))) (play-from-hand state :runner "Sure Gamble") @@ -2884,45 +2863,11 @@ (is (= 5 (:credit (get-runner))) "Paid 8 credits") (is (zero? (:credit (get-corp))) "Corp lost all 8 credits"))) -(deftest ^:skip-card-coverage - virus-counter-flags - (testing "Set counter flag when virus card enters play with counters" - (do-game - (new-game (default-corp) - (default-runner ["Surge" "Imp" "Crypsis"])) - (take-credits state :corp) - (play-from-hand state :runner "Imp") - (let [imp (get-program state 0)] - (is (get-in imp [:added-virus-counter]) "Counter flag was set on Imp")))) - (testing "Set counter flag when add-prop is called on a virus" - (do-game - (new-game (default-corp) - (default-runner ["Crypsis"])) - (take-credits state :corp) - (play-from-hand state :runner "Crypsis") - (let [crypsis (get-program state 0)] - (card-ability state :runner crypsis 2) ;click to add a virus counter - (is (= 1 (get-counters (refresh crypsis) :virus)) "Crypsis added a virus token") - (is (get-in (refresh crypsis) [:added-virus-counter]) - "Counter flag was set on Crypsis")))) - (testing "Clear the virus counter flag at the end of each turn" - (do-game - (new-game (default-corp) - (default-runner ["Crypsis"])) - (take-credits state :corp) - (play-from-hand state :runner "Crypsis") - (let [crypsis (get-program state 0)] - (card-ability state :runner crypsis 2) ; click to add a virus counter - (take-credits state :runner 2) - (take-credits state :corp 1) - (is (not (get-in (refresh crypsis) [:added-virus-counter])) - "Counter flag was cleared on Crypsis"))))) - (deftest white-hat ;; White Hat (do-game - (new-game (default-corp ["Ice Wall" "Fire Wall" "Enigma"]) - (default-runner ["White Hat"])) + (new-game {:corp {:deck ["Ice Wall" "Fire Wall" "Enigma"]} + :runner {:deck ["White Hat"]}}) (take-credits state :corp) (run-empty-server state :rd) (play-from-hand state :runner "White Hat") diff --git a/test/clj/game_test/cards/hardware.clj b/test/clj/game_test/cards/hardware.clj index 7aead3ad70..f198962e7a 100644 --- a/test/clj/game_test/cards/hardware.clj +++ b/test/clj/game_test/cards/hardware.clj @@ -1,18 +1,16 @@ (ns game-test.cards.hardware (:require [game.core :as core] + [game.utils :as utils] [game-test.core :refer :all] [game-test.utils :refer :all] [game-test.macros :refer :all] [jinteki.utils :refer [count-tags]] [clojure.test :refer :all])) -(use-fixtures :once load-all-cards (partial reset-card-defs "hardware")) - (deftest acacia ;; Acacia - Optionally gain credits for number of virus tokens then trash (do-game - (new-game (default-corp) - (default-runner ["Acacia" "Virus Breeding Ground" "Datasucker"])) + (new-game {:runner {:deck ["Acacia" "Virus Breeding Ground" "Datasucker"]}}) (take-credits state :corp) (play-from-hand state :runner "Acacia") (play-from-hand state :runner "Virus Breeding Ground") @@ -29,8 +27,7 @@ (deftest akamatsu-mem-chip ;; Akamatsu Mem Chip - Gain 1 memory (do-game - (new-game (default-corp) - (default-runner [(qty "Akamatsu Mem Chip" 3)])) + (new-game {:runner {:deck [(qty "Akamatsu Mem Chip" 3)]}}) (take-credits state :corp) (play-from-hand state :runner "Akamatsu Mem Chip") (is (= 5 (core/available-mu state)) "Gain 1 memory"))) @@ -38,8 +35,8 @@ (deftest archives-interface ;; Archives Interface - Remove 1 card in Archives from the game instead of accessing it (do-game - (new-game (default-corp ["Shock!" "Launch Campaign"]) - (default-runner ["Archives Interface" "Imp"])) + (new-game {:corp {:deck ["Shock!" "Launch Campaign"]} + :runner {:deck ["Archives Interface" "Imp"]}}) (take-credits state :corp) (core/move state :corp (find-card "Shock!" (:hand (get-corp))) :discard) (core/move state :corp (find-card "Launch Campaign" (:hand (get-corp))) :discard) @@ -53,8 +50,8 @@ (deftest astrolabe ;; Astrolabe - Draw on new server install (do-game - (new-game (default-corp [(qty "Snare!" 3)]) - (default-runner [(qty "Astrolabe" 3) (qty "Sure Gamble" 3) "Cloak"])) + (new-game {:corp {:deck [(qty "Snare!" 3)]} + :runner {:deck [(qty "Astrolabe" 3) (qty "Sure Gamble" 3) "Cloak"]}}) (take-credits state :corp) (play-from-hand state :runner "Astrolabe") (is (= 5 (core/available-mu state)) "Gain 1 memory") @@ -71,9 +68,8 @@ ;; Autoscripter - gain 1 [Click] first time Runner installs program from Grip during their turn. ;; Trash if unsuccessful run (do-game - (new-game (default-corp) - (default-runner ["Autoscripter" (qty "Inti" 3) "Clone Chip"]) - {:start-as :runner}) + (new-game {:runner {:deck ["Autoscripter" (qty "Inti" 3) "Clone Chip"]} + :options {:start-as :runner}}) (testing "Gaining (and not gaining) clicks" (play-from-hand state :runner "Inti") (play-from-hand state :runner "Autoscripter") @@ -91,7 +87,6 @@ (click-card state :runner (first (:discard (get-runner)))) (is (= 3 (count (get-program state))) "Three Intis installed") (is (= 3 (:click (get-runner))) "Did not gain a click from installing a Program from heap")) - (testing "Trashing on unsuccessful run" (run-on state :hq) (run-jack-out state) @@ -100,54 +95,51 @@ (deftest blackguard ;; Blackguard - +2 MU, forced rez of exposed ice (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Blackguard" - "Snitch"])) - (play-from-hand state :corp "Ice Wall" "Archives") - (take-credits state :corp) - (core/gain state :runner :credit 100) - (play-from-hand state :runner "Blackguard") - (is (= 6 (core/available-mu state)) "Runner has 6 MU") - (play-from-hand state :runner "Snitch") - (let [snitch (get-program state 0) - iwall (get-ice state :archives 0)] - (run-on state :archives) - (card-ability state :runner snitch 0) - (is (:rezzed (refresh iwall)) "Ice Wall was rezzed")))) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Blackguard" + "Snitch"]}}) + (play-from-hand state :corp "Ice Wall" "Archives") + (take-credits state :corp) + (core/gain state :runner :credit 100) + (play-from-hand state :runner "Blackguard") + (is (= 6 (core/available-mu state)) "Runner has 6 MU") + (play-from-hand state :runner "Snitch") + (let [snitch (get-program state 0) + iwall (get-ice state :archives 0)] + (run-on state :archives) + (card-ability state :runner snitch 0) + (is (:rezzed (refresh iwall)) "Ice Wall was rezzed")))) (deftest box-e ;; Box-E - +2 MU, +2 max hand size (do-game - (new-game (default-corp) - (default-runner ["Box-E"])) - (take-credits state :corp) - (play-from-hand state :runner "Box-E") - (is (= 6 (core/available-mu state))) - (is (= 7 (core/hand-size state :runner))))) + (new-game {:runner {:deck ["Box-E"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Box-E") + (is (= 6 (core/available-mu state))) + (is (= 7 (core/hand-size state :runner))))) (deftest brain-chip ;; Brain Chip handsize and memory limit (do-game - (new-game (default-corp) - (default-runner ["Brain Chip"])) - (take-credits state :corp) - (play-from-hand state :runner "Brain Chip") - (swap! state assoc-in [:runner :agenda-point] -2) ; hard set ap - (is (= 5 (core/hand-size state :runner)) "Hand size unaffected") - (is (= 4 (core/available-mu state)) "Memory limit unaffected") - (swap! state assoc-in [:runner :agenda-point] 2) - (is (= 7 (core/hand-size state :runner)) "Hand size increased by 2") - (is (= 6 (core/available-mu state)) "Memory limit increased by 2") - (core/move state :runner (get-hardware state 0) :discard) - (is (= 5 (core/hand-size state :runner)) "Hand size reset") - (is (= 4 (core/available-mu state)) "Memory limit reset"))) + (new-game {:runner {:deck ["Brain Chip"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Brain Chip") + (swap! state assoc-in [:runner :agenda-point] -2) ; hard set ap + (is (= 5 (core/hand-size state :runner)) "Hand size unaffected") + (is (= 4 (core/available-mu state)) "Memory limit unaffected") + (swap! state assoc-in [:runner :agenda-point] 2) + (is (= 7 (core/hand-size state :runner)) "Hand size increased by 2") + (is (= 6 (core/available-mu state)) "Memory limit increased by 2") + (core/move state :runner (get-hardware state 0) :discard) + (is (= 5 (core/hand-size state :runner)) "Hand size reset") + (is (= 4 (core/available-mu state)) "Memory limit reset"))) (deftest clone-chip ;; Test clone chip usage- outside and during run (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner ["Datasucker" (qty "Clone Chip" 2)])) + (new-game {:runner {:deck ["Datasucker" (qty "Clone Chip" 2)]}}) (take-credits state :corp) (trash-from-hand state :runner "Datasucker") (play-from-hand state :runner "Clone Chip") @@ -159,8 +151,7 @@ (is (= (:title ds) "Datasucker")))))) (testing "don't show inavalid choices" (do-game - (new-game (default-corp) - (default-runner ["Inti" "Magnum Opus" "Clone Chip"])) + (new-game {:runner {:deck ["Inti" "Magnum Opus" "Clone Chip"]}}) (take-credits state :corp) (trash-from-hand state :runner "Inti") (trash-from-hand state :runner "Magnum Opus") @@ -183,8 +174,7 @@ (deftest comet ;; Comet - Play event without spending a click after first event played (do-game - (new-game (default-corp) - (default-runner [(qty "Comet" 3) (qty "Easy Mark" 2)])) + (new-game {:runner {:deck [(qty "Comet" 3) (qty "Easy Mark" 2)]}}) (take-credits state :corp) (play-from-hand state :runner "Comet") (let [comet (get-hardware state 0)] @@ -200,8 +190,8 @@ (deftest cortez-chip ;; Cortez Chip - Trash to add 2 credits to rez cost of an ICE until end of turn (do-game - (new-game (default-corp ["Quandary"]) - (default-runner ["Cortez Chip"])) + (new-game {:corp {:deck ["Quandary"]} + :runner {:deck ["Cortez Chip"]}}) (play-from-hand state :corp "Quandary" "R&D") (take-credits state :corp) (play-from-hand state :runner "Cortez Chip") @@ -216,8 +206,7 @@ (deftest cybersolutions-mem-chip ;; CyberSolutions Mem Chip- Gain 2 memory (do-game - (new-game (default-corp) - (default-runner [(qty "CyberSolutions Mem Chip" 3)])) + (new-game {:runner {:deck [(qty "CyberSolutions Mem Chip" 3)]}}) (take-credits state :corp) (play-from-hand state :runner "CyberSolutions Mem Chip") (is (= 6 (core/available-mu state)) "Gain 2 memory"))) @@ -225,8 +214,8 @@ (deftest daredevil ;; Daredevil (do-game - (new-game (default-corp [(qty "Ice Wall" 2)]) - (default-runner ["Daredevil" (qty "Sure Gamble" 3) (qty "Easy Mark" 2)])) + (new-game {:corp {:deck [(qty "Ice Wall" 2)]} + :runner {:deck ["Daredevil" (qty "Sure Gamble" 3) (qty "Easy Mark" 2)]}}) (starting-hand state :runner ["Daredevil"]) (play-from-hand state :corp "Ice Wall" "Archives") (play-from-hand state :corp "Ice Wall" "Archives") @@ -245,8 +234,7 @@ (deftest desperado ;; Desperado - Gain 1 MU and gain 1 credit on successful run (do-game - (new-game (default-corp) - (default-runner [(qty "Desperado" 3)])) + (new-game {:runner {:deck [(qty "Desperado" 3)]}}) (take-credits state :corp) (play-from-hand state :runner "Desperado") (run-empty-server state :archives) @@ -257,8 +245,7 @@ ;; Dinosaurus (testing "Hosting a breaker with strength based on unused MU should calculate correctly" (do-game - (new-game (default-corp) - (default-runner ["Adept" "Dinosaurus"])) + (new-game {:runner {:deck ["Adept" "Dinosaurus"]}}) (take-credits state :corp) (core/gain state :runner :credit 5) (play-from-hand state :runner "Dinosaurus") @@ -274,8 +261,7 @@ (is (= 8 (:current-strength (refresh hosted-adpt))) "Adept at 8 strength hosted"))))) (testing "Boost strength of hosted icebreaker; keep MU the same when hosting or trashing hosted breaker" (do-game - (new-game (default-corp) - (default-runner ["Dinosaurus" "Battering Ram"])) + (new-game {:runner {:deck ["Dinosaurus" "Battering Ram"]}}) (take-credits state :corp) (core/gain state :runner :credit 5) (play-from-hand state :runner "Dinosaurus") @@ -296,8 +282,7 @@ (deftest doppelganger ;; Doppelgänger - run again when successful (do-game - (new-game (default-corp) - (default-runner ["Doppelgänger"])) + (new-game {:runner {:deck ["Doppelgänger"]}}) (core/gain state :corp :bad-publicity 1) (take-credits state :corp) (play-from-hand state :runner "Doppelgänger") @@ -313,8 +298,8 @@ (deftest dorm-computer ;; make a run and avoid all tags for the remainder of the run (do-game - (new-game (default-corp ["Snare!"]) - (default-runner ["Dorm Computer"])) + (new-game {:corp {:deck ["Snare!"]} + :runner {:deck ["Dorm Computer"]}}) (play-from-hand state :corp "Snare!" "New remote") (take-credits state :corp) (play-from-hand state :runner "Dorm Computer") @@ -332,10 +317,10 @@ (deftest feedback-filter ;; Feedback Filter - Prevent net and brain damage (do-game - (new-game (default-corp ["Data Mine" + (new-game {:corp {:deck ["Data Mine" "Cerebral Overwriter" - "Mushin No Shin"]) - (default-runner [(qty "Feedback Filter" 2) (qty "Sure Gamble" 3)])) + "Mushin No Shin"]} + :runner {:deck [(qty "Feedback Filter" 2) (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Mushin No Shin") (click-card state :corp (find-card "Cerebral Overwriter" (:hand (get-corp)))) (play-from-hand state :corp "Data Mine" "Server 1") @@ -361,15 +346,13 @@ (click-prompt state :runner "Pay 0 [Credits] to trash") ; trash Overwriter for 0 (is (= 1 (:brain-damage (get-runner))) "2 of the 3 brain damage prevented") (is (= 2 (count (:hand (get-runner))))) - (is (empty? (get-hardware state)) "Feedback Filter trashed") - )))) + (is (empty? (get-hardware state)) "Feedback Filter trashed"))))) (deftest flame-out ;; Flame-out - start with 9 credits, use for hosted program, trash hosted program at end of turn when credits used (testing "Basic behavior" (do-game - (new-game (default-corp) - (default-runner ["Flame-out" "Mimic"])) + (new-game {:runner {:deck ["Flame-out" "Mimic"]}}) (take-credits state :corp) (play-from-hand state :runner "Flame-out") (let [fo (get-hardware state 0)] @@ -387,8 +370,7 @@ (is (= 1 (count (:discard (get-runner)))) "Mimic in trash")))) (testing "Corp turn usage" (do-game - (new-game (default-corp) - (default-runner ["Flame-out" "Mimic"])) + (new-game {:runner {:deck ["Flame-out" "Mimic"]}}) (take-credits state :corp) (play-from-hand state :runner "Flame-out") (let [fo (get-hardware state 0)] @@ -407,8 +389,8 @@ (deftest friday-chip ;; Friday Chip - gain counters for trashing cards, move a counter on turn start (do-game - (new-game (default-corp ["Adonis Campaign" "Hedge Fund"]) - (default-runner ["Friday Chip" "Aumakua"])) + (new-game {:corp {:deck ["Adonis Campaign" "Hedge Fund"]} + :runner {:deck ["Friday Chip" "Aumakua"]}}) (play-from-hand state :corp "Adonis Campaign" "New remote") (take-credits state :corp) (core/gain state :runner :credit 20) @@ -438,8 +420,7 @@ (deftest grimoire ;; Grimoire - Gain 2 MU, add a free virus counter to installed virus programs (do-game - (new-game (default-corp) - (default-runner ["Grimoire" "Imp"])) + (new-game {:runner {:deck ["Grimoire" "Imp"]}}) (take-credits state :corp) (play-from-hand state :runner "Grimoire") (is (= 6 (core/available-mu state)) "Gained 2 MU") @@ -450,8 +431,9 @@ (deftest heartbeat ;; Heartbeat - +1 MU, trash installed card to prevent 1 damage (do-game - (new-game (default-corp ["Pup" "Neural Katana"]) - (make-deck "Apex: Invasive Predator" [(qty "Heartbeat" 2) (qty "Sure Gamble" 2) "Cache"])) + (new-game {:corp {:deck ["Pup" "Neural Katana"]} + :runner {:id "Apex: Invasive Predator" + :deck [(qty "Heartbeat" 2) (qty "Sure Gamble" 2) "Cache"]}}) (play-from-hand state :corp "Pup" "HQ") (play-from-hand state :corp "Neural Katana" "R&D") (take-credits state :corp) @@ -483,8 +465,7 @@ ;; Hijacked Router (testing "Run on Archives" (do-game - (new-game (default-corp) - (default-runner ["Hijacked Router"])) + (new-game {:runner {:deck ["Hijacked Router"]}}) (take-credits state :corp) (is (= 8 (:credit (get-corp))) "Corp ends turn with 8 credits") (play-from-hand state :runner "Hijacked Router") @@ -498,8 +479,7 @@ (is (not (:run @state)) "Run is finished"))) (testing "Run on HQ" (do-game - (new-game (default-corp) - (default-runner ["Hijacked Router"])) + (new-game {:runner {:deck ["Hijacked Router"]}}) (take-credits state :corp) (is (= 8 (:credit (get-corp))) "Corp ends turn with 8 credits") (play-from-hand state :runner "Hijacked Router") @@ -511,8 +491,8 @@ (is (= 8 (:credit (get-corp))) "Corp has not lost 3 credits"))) (testing "Credit loss on server creation" (do-game - (new-game (default-corp ["Elective Upgrade"]) - (default-runner ["Hijacked Router"])) + (new-game {:corp {:deck ["Elective Upgrade"]} + :runner {:deck ["Hijacked Router"]}}) (take-credits state :corp) (play-from-hand state :runner "Hijacked Router") (take-credits state :runner) @@ -524,8 +504,7 @@ ;; Hippo - remove from game to trash outermost piece of ice if all subs broken (testing "No ice" (do-game - (new-game (default-corp) - (default-runner ["Hippo"])) + (new-game {:runner {:deck ["Hippo"]}}) (take-credits state :corp) (play-from-hand state :runner "Hippo") (run-on state "HQ") @@ -535,8 +514,8 @@ (is (not-empty (get-hardware state)) "Hippo still installed"))) (testing "Single ice" (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Hippo"])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Hippo"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (core/rez state :corp (get-ice state :hq 0)) (take-credits state :corp) @@ -551,8 +530,8 @@ (is (empty? (get-hardware state)) "Hippo removed"))) (testing "Multiple ice" (do-game - (new-game (default-corp ["Ice Wall" "Enigma"]) - (default-runner ["Hippo"])) + (new-game {:corp {:deck ["Ice Wall" "Enigma"]} + :runner {:deck ["Hippo"]}}) (play-from-hand state :corp "Enigma" "HQ") (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) @@ -573,8 +552,7 @@ (deftest knobkierie ;; Knobkierie - first successful run, place a virus counter on a virus program (do-game - (new-game (default-corp) - (default-runner ["Knobkierie" "Hivemind" "Eater"])) + (new-game {:runner {:deck ["Knobkierie" "Hivemind" "Eater"]}}) (core/gain state :runner :credit 20) (take-credits state :corp) (play-from-hand state :runner "Knobkierie") @@ -603,8 +581,7 @@ (deftest llds-processor ;; LLDS Processor - Add 1 strength until end of turn to an icebreaker upon install (do-game - (new-game (default-corp) - (default-runner [(qty "LLDS Processor" 2) "Inti" "Passport"])) + (new-game {:runner {:deck [(qty "LLDS Processor" 2) "Inti" "Passport"]}}) (take-credits state :corp) (play-from-hand state :runner "LLDS Processor") (play-from-hand state :runner "Inti") @@ -618,13 +595,12 @@ (is (= 1 (:current-strength (refresh inti))) "Strength reduced to default") (is (= 2 (:current-strength (refresh pass))) "Strength reduced to default")))) -(deftest ^{:card-title "mâché"} - mache +(deftest mache ;; Mâché (testing "Basic test" (do-game - (new-game (default-corp ["Ice Wall" "PAD Campaign"]) - (default-runner ["Imp" "Mâché" "Cache"])) + (new-game {:corp {:deck ["Ice Wall" "PAD Campaign"]} + :runner {:deck ["Imp" "Mâché" "Cache"]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (take-credits state :corp) (core/gain state :runner :credit 10) @@ -646,8 +622,8 @@ (is (= 1 (get-counters (refresh mache) :power)) "Mache ability should cost 3 counters")))) (testing "with Political Operative" (do-game - (new-game (default-corp ["Ice Wall" "PAD Campaign"]) - (default-runner ["Mâché" "Political Operative" "Cache"])) + (new-game {:corp {:deck ["Ice Wall" "PAD Campaign"]} + :runner {:deck ["Mâché" "Political Operative" "Cache"]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (core/rez state :corp (get-content state :remote1 0)) (take-credits state :corp) @@ -669,8 +645,8 @@ ;; Maw - Once per turn, first time runner declines to steal or trash, trash a HQ card at random (testing "Basic test" (do-game - (new-game (default-corp [(qty "BOOM!" 5)]) - (default-runner ["Maw"])) + (new-game {:corp {:deck [(qty "BOOM!" 5)]} + :runner {:deck ["Maw"]}}) (take-credits state :corp) (core/gain state :runner :credit 20) (run-empty-server state :hq) @@ -691,8 +667,8 @@ (testing "Check trashed card is trashed face-up if it's the card that is accessed, issue #2695" ;; Also checks Maw auto-trashes on Operation with no trash cost (do-game - (new-game (default-corp ["Hedge Fund"]) - (default-runner ["Maw"])) + (new-game {:corp {:deck ["Hedge Fund"]} + :runner {:deck ["Maw"]}}) (take-credits state :corp) (core/gain state :runner :credit 20) (play-from-hand state :runner "Maw") @@ -703,8 +679,8 @@ (is (:seen (first (:discard (get-corp)))) "Trashed card is registered as seen since it was accessed"))) (testing "with Hiro in hand - Hiro not moved to runner scored area on trash decline. #2638" (do-game - (new-game (default-corp ["Chairman Hiro"]) - (default-runner ["Maw"])) + (new-game {:corp {:deck ["Chairman Hiro"]} + :runner {:deck ["Maw"]}}) (take-credits state :corp) (core/gain state :runner :credit 20) (play-from-hand state :runner "Maw") @@ -714,9 +690,9 @@ (is (= 1 (count (:discard (get-corp)))) "Hiro trashed by Maw"))) (testing "Maw shouldn't trigger on stolen agenda. #3433" (do-game - (new-game (default-corp ["Hostile Takeover" - (qty "Ice Wall" 5)]) - (default-runner ["Maw"])) + (new-game {:corp {:deck ["Hostile Takeover" + (qty "Ice Wall" 5)]} + :runner {:deck ["Maw"]}}) (play-from-hand state :corp "Hostile Takeover" "New remote") (take-credits state :corp) (core/gain state :runner :credit 20) @@ -726,8 +702,9 @@ (is (zero? (count (:discard (get-corp)))) "No HQ card in discard as agenda was stolen"))) (testing "Maw shouldn't trigger when accessing a card in archives. #3388" (do-game - (new-game (default-corp ["Rashida Jaheem" "Cyberdex Virus Suite" (qty "Ice Wall" 4)]) - (make-deck "Alice Merchant: Clan Agitator" ["Maw" "Imp"])) + (new-game {:corp {:deck ["Rashida Jaheem" "Cyberdex Virus Suite" (qty "Ice Wall" 4)]} + :runner {:id "Alice Merchant: Clan Agitator" + :deck ["Maw" "Imp"]}}) (core/move state :corp (find-card "Rashida Jaheem" (:hand (get-corp))) :deck) (trash-from-hand state :corp "Cyberdex Virus Suite") (take-credits state :corp) @@ -742,10 +719,11 @@ (click-prompt state :runner "Pay 1 [Credits] to trash") (is (= 3 (count (:discard (get-corp)))) "Ice Wall, CVS, and Rashida") (is (empty? (:prompt (get-runner))) "No more prompts for runner"))) - (testing "Maw should trigger when declining to steal. #3388" + (testing "Maw should trigger when declining to steal. #3388" (do-game - (new-game (default-corp [(qty "Obokata Protocol" 2) (qty "Ice Wall" 4)]) - (make-deck "Alice Merchant: Clan Agitator" ["Maw" "Archives Interface"])) + (new-game {:corp {:deck [(qty "Obokata Protocol" 2) (qty "Ice Wall" 4)]} + :runner {:id "Alice Merchant: Clan Agitator" + :deck ["Maw" "Archives Interface"]}}) (trash-from-hand state :corp "Ice Wall") (starting-hand state :corp ["Obokata Protocol" "Obokata Protocol"]) (take-credits state :corp) @@ -765,8 +743,8 @@ ;; Maya - Move accessed card to bottom of R&D (testing "Basic test" (do-game - (new-game (default-corp [(qty "Hedge Fund" 2) (qty "Snare!" 2) "Hostile Takeover" "Scorched Earth"]) - (default-runner ["Maya" (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Hedge Fund" 2) (qty "Snare!" 2) "Hostile Takeover" "Scorched Earth"]} + :runner {:deck ["Maya" (qty "Sure Gamble" 3)]}}) (core/move state :corp (find-card "Hostile Takeover" (:hand (get-corp))) :deck) (core/move state :corp (find-card "Snare!" (:hand (get-corp))) :deck) (take-credits state :corp) @@ -795,8 +773,8 @@ (is (= (:cid accessed) (:cid (last (:deck (get-corp))))) "Maya moved the accessed card to the bottom of R&D"))))) (testing "Does not interrupt multi-access" (do-game - (new-game (default-corp [(qty "Hedge Fund" 2) (qty "Scorched Earth" 2) (qty "Snare!" 2)]) - (default-runner ["Maya" (qty "Sure Gamble" 3) "R&D Interface"])) + (new-game {:corp {:deck [(qty "Hedge Fund" 2) (qty "Scorched Earth" 2) (qty "Snare!" 2)]} + :runner {:deck ["Maya" (qty "Sure Gamble" 3) "R&D Interface"]}}) (core/move state :corp (find-card "Scorched Earth" (:hand (get-corp))) :deck) (core/move state :corp (find-card "Snare!" (:hand (get-corp))) :deck) (take-credits state :corp) @@ -812,38 +790,37 @@ (is (= (:cid accessed) (:cid (last (:deck (get-corp))))) "Maya moved the accessed card to the bottom of R&D") (is (:prompt (get-runner)) "Runner has next access prompt"))))) -(deftest minds-eye +(deftest mind-s-eye ;; Mind's Eye - Gain power tokens on R&D runs, and for 3 tokens and a click, access the top card of R&D (testing "Interaction with RDI + Aeneas" (do-game - (new-game (default-corp [(qty "Jackson Howard" 2)]) - (default-runner ["Mind's Eye" "R&D Interface" "Aeneas Informant"])) - (dotimes [_ 2] - (core/move state :corp (find-card "Jackson Howard" (:hand (get-corp))) :deck)) - (take-credits state :corp) - (core/gain state :runner :credit 10 :click 20) - (play-from-hand state :runner "Mind's Eye") - (let [eye (get-hardware state 0)] - (is (= 0 (get-counters (refresh eye) :power)) "0 counters on install") - (dotimes [_ 3] - (run-empty-server state :rd) - (click-prompt state :runner "No action")) - (is (= 3 (get-counters (refresh eye) :power)) "3 counters after 3 runs") - (play-from-hand state :runner "R&D Interface") - (play-from-hand state :runner "Aeneas Informant") - (card-ability state :runner (refresh eye) 0) - (let [num-creds (:credit (get-runner))] - (dotimes [_ 2] - (click-prompt state :runner "Card from deck") - (click-prompt state :runner "No action") - (click-prompt state :runner "Yes")) ;Aeneas - (is (= (+ num-creds 2) (:credit (get-runner))) "Runner has gained 2 from Aeneas")))))) + (new-game {:corp {:deck [(qty "Jackson Howard" 2)]} + :runner {:deck ["Mind's Eye" "R&D Interface" "Aeneas Informant"]}}) + (dotimes [_ 2] + (core/move state :corp (find-card "Jackson Howard" (:hand (get-corp))) :deck)) + (take-credits state :corp) + (core/gain state :runner :credit 10 :click 20) + (play-from-hand state :runner "Mind's Eye") + (let [eye (get-hardware state 0)] + (is (= 0 (get-counters (refresh eye) :power)) "0 counters on install") + (dotimes [_ 3] + (run-empty-server state :rd) + (click-prompt state :runner "No action")) + (is (= 3 (get-counters (refresh eye) :power)) "3 counters after 3 runs") + (play-from-hand state :runner "R&D Interface") + (play-from-hand state :runner "Aeneas Informant") + (card-ability state :runner (refresh eye) 0) + (let [num-creds (:credit (get-runner))] + (dotimes [_ 2] + (click-prompt state :runner "Card from deck") + (click-prompt state :runner "No action") + (click-prompt state :runner "Yes")) ;Aeneas + (is (= (+ num-creds 2) (:credit (get-runner))) "Runner has gained 2 from Aeneas")))))) (deftest net-ready-eyes ;; Net-Ready Eyes (do-game - (new-game (default-corp) - (default-runner [(qty "Sure Gamble" 3) "Net-Ready Eyes" "Peacock"])) + (new-game {:runner {:deck [(qty "Sure Gamble" 3) "Net-Ready Eyes" "Peacock"]}}) (take-credits state :corp) (play-from-hand state :runner "Sure Gamble") (play-from-hand state :runner "Peacock") @@ -862,9 +839,8 @@ ;; Obelus - Increase max hand size with tags, draw cards on first successful HQ/R&D run (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner ["Obelus" "Nerve Agent" - (qty "Sure Gamble" 3) (qty "Cache" 3)])) + (new-game {:runner {:deck ["Obelus" "Nerve Agent" + (qty "Sure Gamble" 3) (qty "Cache" 3)]}}) (take-credits state :corp) (starting-hand state :runner ["Obelus" "Nerve Agent"]) (core/gain state :runner :credit 10 :click 3) @@ -900,8 +876,8 @@ (is (= 3 (count (:hand (get-runner)))) "Obelus drew 3 cards")))) (testing "running and trashing Crisium Grid makes run neither successful/unsuccessful" (do-game - (new-game (default-corp ["Hedge Fund" "Crisium Grid"]) - (default-runner ["Obelus" (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Hedge Fund" "Crisium Grid"]} + :runner {:deck ["Obelus" (qty "Sure Gamble" 3)]}}) (starting-hand state :corp ["Crisium Grid"]) (play-from-hand state :corp "Crisium Grid" "R&D") (core/rez state :corp (get-content state :rd 0)) @@ -921,9 +897,9 @@ (is (= 1 (count (:hand (get-runner)))) "Obelus drew a card on first successful run"))) (testing "using Hades Shard during run to increase draw" (do-game - (new-game (default-corp [(qty "Hedge Fund" 3) (qty "Restructure" 3)]) - (default-runner ["Obelus" "Hades Shard" - (qty "Sure Gamble" 3) (qty "Cache" 3)])) + (new-game {:corp {:deck [(qty "Hedge Fund" 3) (qty "Restructure" 3)]} + :runner {:deck ["Obelus" "Hades Shard" + (qty "Sure Gamble" 3) (qty "Cache" 3)]}}) (starting-hand state :corp ["Hedge Fund" "Hedge Fund"]) (trash-from-hand state :corp "Hedge Fund") (trash-from-hand state :corp "Hedge Fund") @@ -938,8 +914,8 @@ (is (= 3 (count (:hand (get-runner)))) "Obelus drew 3 cards"))) (testing "running a remote server first doesn't block card draw" (do-game - (new-game (default-corp ["Urban Renewal" "Hedge Fund"]) - (default-runner ["Obelus" (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Urban Renewal" "Hedge Fund"]} + :runner {:deck ["Obelus" (qty "Sure Gamble" 3)]}}) (starting-hand state :corp ["Urban Renewal"]) (play-from-hand state :corp "Urban Renewal" "New remote") (take-credits state :corp) @@ -955,8 +931,7 @@ (deftest paragon ;; Paragon - Gain 1 credit and may look at and move top card of Stack to bottom (do-game - (new-game (default-corp) - (default-runner ["Paragon" "Easy Mark" "Sure Gamble"])) + (new-game {:runner {:deck ["Paragon" "Easy Mark" "Sure Gamble"]}}) (starting-hand state :runner ["Paragon"]) (take-credits state :corp) (play-from-hand state :runner "Paragon") @@ -975,8 +950,7 @@ ;; Patchwork (testing "Play event" (do-game - (new-game (default-corp) - (default-runner ["Patchwork" (qty "Sure Gamble" 2) "Easy Mark"])) + (new-game {:runner {:deck ["Patchwork" (qty "Sure Gamble" 2) "Easy Mark"]}}) (take-credits state :corp) (core/gain state :runner :credit 4) (play-from-hand state :runner "Patchwork") @@ -991,8 +965,7 @@ (is (= 15 (:credit (get-runner))) "Patchwork is once-per-turn"))) (testing "Install a card" (do-game - (new-game (default-corp) - (default-runner ["Patchwork" "Easy Mark" "Cyberfeeder"])) + (new-game {:runner {:deck ["Patchwork" "Easy Mark" "Cyberfeeder"]}}) (take-credits state :corp) (core/gain state :runner :credit 4) (play-from-hand state :runner "Patchwork") @@ -1003,12 +976,11 @@ (click-card state :runner (find-card "Easy Mark" (:hand (get-runner)))) (is (= 5 (:credit (get-runner))) "Runner was charged 0 credits to play Cyberfeeder")))) - (deftest plascrete-carapace ;; Plascrete Carapace - Prevent meat damage (do-game - (new-game (default-corp ["Scorched Earth"]) - (default-runner ["Plascrete Carapace" "Sure Gamble"])) + (new-game {:corp {:deck ["Scorched Earth"]} + :runner {:deck ["Plascrete Carapace" "Sure Gamble"]}}) (take-credits state :corp) (play-from-hand state :runner "Plascrete Carapace") (let [plas (get-hardware state 0)] @@ -1027,8 +999,7 @@ (deftest rabbit-hole ;; Rabbit Hole - +1 link, optionally search Stack to install more copies (do-game - (new-game (default-corp) - (default-runner ["Sure Gamble" (qty "Rabbit Hole" 3)])) + (new-game {:runner {:deck ["Sure Gamble" (qty "Rabbit Hole" 3)]}}) (take-credits state :corp) (core/move state :runner (find-card "Rabbit Hole" (:hand (get-runner))) :deck) (core/move state :runner (find-card "Rabbit Hole" (:hand (get-runner))) :deck) @@ -1046,9 +1017,9 @@ ;; Prevent up to X net or brain damage. (testing "Basic test" (do-game - (new-game (default-corp ["Data Mine" "Snare!"]) - (default-runner [(qty "Ramujan-reliant 550 BMI" 4) - (qty "Sure Gamble" 6)])) + (new-game {:corp {:deck ["Data Mine" "Snare!"]} + :runner {:deck [(qty "Ramujan-reliant 550 BMI" 4) + (qty "Sure Gamble" 6)]}}) (starting-hand state :runner ["Ramujan-reliant 550 BMI" "Ramujan-reliant 550 BMI" "Ramujan-reliant 550 BMI" "Ramujan-reliant 550 BMI" "Sure Gamble"]) (play-from-hand state :corp "Data Mine" "Server 1") @@ -1083,8 +1054,8 @@ (is (= 1 (count (:hand (get-runner)))) "3 net damage prevented"))))) (testing "Prevent up to X net or brain damage. Empty stack" (do-game - (new-game (default-corp ["Data Mine"]) - (default-runner ["Ramujan-reliant 550 BMI" "Sure Gamble"])) + (new-game {:corp {:deck ["Data Mine"]} + :runner {:deck ["Ramujan-reliant 550 BMI" "Sure Gamble"]}}) (play-from-hand state :corp "Data Mine" "Server 1") (let [dm (get-ice state :remote1 0)] (take-credits state :corp) @@ -1100,9 +1071,9 @@ (deftest recon-drone ;; trash and pay X to prevent that much damage from a card you are accessing (do-game - (new-game (default-corp ["Snare!" "House of Knives" - "Prisec" "Cerebral Overwriter"]) - (default-runner [(qty "Recon Drone" 10)])) + (new-game {:corp {:deck ["Snare!" "House of Knives" + "Prisec" "Cerebral Overwriter"]} + :runner {:deck [(qty "Recon Drone" 10)]}}) (core/gain state :corp :click 10) (core/gain state :corp :credit 100) (play-from-hand state :corp "House of Knives" "New remote") @@ -1180,8 +1151,7 @@ ;; Replicator (testing "interaction with Bazaar. Issue #1511" (do-game - (new-game (default-corp) - (default-runner ["Replicator" "Bazaar" (qty "Spy Camera" 6)])) + (new-game {:runner {:deck ["Replicator" "Bazaar" (qty "Spy Camera" 6)]}}) (letfn [(count-spy [n] (= n (count (filter #(= "Spy Camera" (:title %)) (-> (get-runner) :rig :hardware)))))] (take-credits state :corp) (starting-hand state :runner ["Replicator" "Bazaar" "Spy Camera"]) @@ -1208,8 +1178,7 @@ (deftest respirocytes (testing "Should draw multiple cards when multiple respirocytes are in play" (do-game - (new-game (default-corp) - (default-runner [(qty "Respirocytes" 3) (qty "Sure Gamble" 3)])) + (new-game {:runner {:deck [(qty "Respirocytes" 3) (qty "Sure Gamble" 3)]}}) (take-credits state :corp) (starting-hand state :runner ["Respirocytes" "Respirocytes" "Respirocytes" "Sure Gamble"]) (dotimes [_ 2] @@ -1218,9 +1187,7 @@ (is (= 2 (count (:hand (get-runner)))) "Drew 2 cards"))) (testing "Respirocytes should not trigger after being trashed (issue #3699)" (do-game - (new-game (default-corp) - (default-runner ["Respirocytes" (qty "Sure Gamble" 20)])) - + (new-game {:runner {:deck ["Respirocytes" (qty "Sure Gamble" 20)]}}) (starting-hand state :runner ["Respirocytes" "Sure Gamble"]) (take-credits state :corp) (play-from-hand state :runner "Respirocytes") @@ -1248,31 +1215,31 @@ (deftest rubicon-switch ;; Rubicon Switch (do-game - (new-game (default-corp ["Ice Wall" "Pachinko"]) - (default-runner ["Rubicon Switch"])) - (play-from-hand state :corp "Ice Wall" "HQ") - (play-from-hand state :corp "Pachinko" "R&D") - (let [iw (get-ice state :hq 0) - pach (get-ice state :rd 0)] - (core/rez state :corp iw) - (take-credits state :corp) - (play-from-hand state :runner "Rubicon Switch") - (core/rez state :corp pach) - (let [rs (get-hardware state 0)] - (card-ability state :runner rs 0) - (click-prompt state :runner "1") - (click-card state :runner "Ice Wall") - (is (:rezzed (refresh iw)) "Ice Wall rezzed last turn can't be targeted") - (click-card state :runner "Pachinko") - (is (not (:rezzed (refresh pach))) "Pachinko derezzed") - (is (= 2 (:click (get-runner))) "Spent 1 click") - (is (= 1 (:credit (get-runner))) "Spent 1c"))))) + (new-game {:corp {:deck ["Ice Wall" "Pachinko"]} + :runner {:deck ["Rubicon Switch"]}}) + (play-from-hand state :corp "Ice Wall" "HQ") + (play-from-hand state :corp "Pachinko" "R&D") + (let [iw (get-ice state :hq 0) + pach (get-ice state :rd 0)] + (core/rez state :corp iw) + (take-credits state :corp) + (play-from-hand state :runner "Rubicon Switch") + (core/rez state :corp pach) + (let [rs (get-hardware state 0)] + (card-ability state :runner rs 0) + (click-prompt state :runner "1") + (click-card state :runner "Ice Wall") + (is (:rezzed (refresh iw)) "Ice Wall rezzed last turn can't be targeted") + (click-card state :runner "Pachinko") + (is (not (:rezzed (refresh pach))) "Pachinko derezzed") + (is (= 2 (:click (get-runner))) "Spent 1 click") + (is (= 1 (:credit (get-runner))) "Spent 1c"))))) (deftest security-nexus ;; Security Nexus (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Security Nexus"])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Security Nexus"]}}) (play-from-hand state :corp "Ice Wall" "R&D") (take-credits state :corp) (core/gain state :runner :credit 100) @@ -1298,8 +1265,8 @@ ;; Sifr - Once per turn drop encountered ICE to zero strenght ;; Also handle archangel then re-install sifr should not break the game #2576 (do-game - (new-game (default-corp ["Archangel" "IP Block" "Hedge Fund"]) - (default-runner ["Modded" "Clone Chip" "Şifr" "Parasite"])) + (new-game {:corp {:deck ["Archangel" "IP Block" "Hedge Fund"]} + :runner {:deck ["Modded" "Clone Chip" "Şifr" "Parasite"]}}) (core/gain state :corp :credit 100) (core/gain state :runner :credit 100) (play-from-hand state :corp "Archangel" "HQ") @@ -1350,8 +1317,8 @@ (deftest spinal-modem ;; Spinal Modem - +1 MU, 2 recurring credits, take 1 brain damage on successful trace during run (do-game - (new-game (default-corp ["Caduceus"]) - (default-runner ["Spinal Modem" "Sure Gamble"])) + (new-game {:corp {:deck ["Caduceus"]} + :runner {:deck ["Spinal Modem" "Sure Gamble"]}}) (play-from-hand state :corp "Caduceus" "HQ") (take-credits state :corp) (play-from-hand state :runner "Spinal Modem") @@ -1371,8 +1338,7 @@ (deftest sports-hopper ;; Sports Hopper (do-game - (new-game (default-corp) - (default-runner [(qty "Sports Hopper" 3) (qty "Sure Gamble" 3)])) + (new-game {:runner {:deck [(qty "Sports Hopper" 3) (qty "Sure Gamble" 3)]}}) (starting-hand state :runner ["Sports Hopper"]) (take-credits state :corp) (play-from-hand state :runner "Sports Hopper") @@ -1385,9 +1351,8 @@ (deftest spy-camera ;; Spy Camera - Full test (do-game - (new-game (default-corp) - (default-runner [(qty "Spy Camera" 6) "Sure Gamble" "Desperado" - "Diesel" "Corroder" "Patron" "Kati Jones"])) + (new-game {:runner {:deck [(qty "Spy Camera" 6) "Sure Gamble" "Desperado" + "Diesel" "Corroder" "Patron" "Kati Jones"]}}) (starting-hand state :runner ["Spy Camera" "Spy Camera" "Spy Camera" "Spy Camera" "Spy Camera" "Spy Camera"]) (is (= 6 (count (:hand (get-runner))))) @@ -1428,10 +1393,10 @@ (deftest the-gauntlet (testing "Access additional cards on run on HQ, not with Gang Sign. Issue #2749" (do-game - (new-game (default-corp ["Hostile Takeover" - (qty "Hedge Fund" 3)]) - (default-runner ["The Gauntlet" - "Gang Sign"])) + (new-game {:corp {:deck ["Hostile Takeover" + (qty "Hedge Fund" 3)]} + :runner {:deck ["The Gauntlet" + "Gang Sign"]}}) (take-credits state :corp) (core/gain state :runner :credit 5) (play-from-hand state :runner "Gang Sign") @@ -1448,10 +1413,9 @@ (deftest the-personal-touch ;; The Personal Touch - Give +1 strength to an icebreaker (do-game - (new-game (default-corp) - (default-runner ["The Personal Touch" + (new-game {:runner {:deck ["The Personal Touch" "Paricia" - "Faerie"])) + "Faerie"]}}) (take-credits state :corp) (play-from-hand state :runner "Paricia") (play-from-hand state :runner "Faerie") @@ -1468,10 +1432,11 @@ (deftest titanium-ribs ;; Titanium Ribs - Choose cards lost to damage, but not on Corp turn against Chronos Protocol (do-game - (new-game (make-deck "Chronos Protocol: Selective Mind-mapping" ["Pup" "Viktor 1.0" - "Neural EMP"]) - (default-runner [(qty "Titanium Ribs" 2) "Sure Gamble" - "Fall Guy" "Kati Jones"])) + (new-game {:corp {:id "Chronos Protocol: Selective Mind-mapping" + :deck ["Pup" "Viktor 1.0" + "Neural EMP"]} + :runner {:deck [(qty "Titanium Ribs" 2) "Sure Gamble" + "Fall Guy" "Kati Jones"]}}) (play-from-hand state :corp "Pup" "HQ") (play-from-hand state :corp "Viktor 1.0" "R&D") (take-credits state :corp) @@ -1501,8 +1466,8 @@ ;; Turntable - Swap a stolen agenda for a scored agenda (testing "Basic test" (do-game - (new-game (default-corp ["Domestic Sleepers" "Project Vitruvius"]) - (default-runner ["Turntable"])) + (new-game {:corp {:deck ["Domestic Sleepers" "Project Vitruvius"]} + :runner {:deck ["Turntable"]}}) (play-from-hand state :corp "Project Vitruvius" "New remote") (let [ag1 (get-content state :remote1 0)] (score-agenda state :corp ag1) @@ -1522,8 +1487,8 @@ ;; Turntable - Swap a Mandatory Upgrades away from the Corp reduces Corp clicks per turn ;; - Corp doesn't gain a click on the Runner's turn when it receives a Mandatory Upgrades (do-game - (new-game (default-corp [(qty "Mandatory Upgrades" 2) "Project Vitruvius"]) - (default-runner ["Turntable"])) + (new-game {:corp {:deck [(qty "Mandatory Upgrades" 2) "Project Vitruvius"]} + :runner {:deck ["Turntable"]}}) (score-agenda state :corp (find-card "Mandatory Upgrades" (:hand (get-corp)))) (is (= 4 (:click-per-turn (get-corp))) "Up to 4 clicks per turn") (take-credits state :corp) @@ -1546,8 +1511,8 @@ (deftest vigil ;; Vigil - Draw 1 card when turn begins if Corp HQ is filled to max hand size (do-game - (new-game (default-corp [(qty "Hedge Fund" 3) (qty "PAD Campaign" 2)]) - (default-runner ["Vigil" (qty "Sure Gamble" 2)])) + (new-game {:corp {:deck [(qty "Hedge Fund" 3) (qty "PAD Campaign" 2)]} + :runner {:deck ["Vigil" (qty "Sure Gamble" 2)]}}) (take-credits state :corp) (play-from-hand state :runner "Vigil") (is (= 5 (core/available-mu state))) @@ -1567,28 +1532,27 @@ (deftest zamba ;; Zamba - Whenever corp card is exposed you may gain 1 credit (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Zamba" (qty "Infiltration" 2)])) - (play-from-hand state :corp "Ice Wall" "Archives") - (take-credits state :corp) - (play-from-hand state :runner "Zamba") - (is (= 6 (core/available-mu state)) "Gain 2 memory") - (is (= 1 (:credit (get-runner))) "At 1 credit") - (play-from-hand state :runner "Infiltration") - (click-prompt state :runner "Expose a card") - (click-card state :runner (get-ice state :archives 0)) - (is (= 2 (:credit (get-runner))) "Gained 1 credit from exposing") - (play-from-hand state :runner "Infiltration") - (click-prompt state :runner "Expose a card") - (click-card state :runner (get-ice state :archives 0)) - (is (= 3 (:credit (get-runner))) "Gained 1 more credit from exposing"))) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Zamba" (qty "Infiltration" 2)]}}) + (play-from-hand state :corp "Ice Wall" "Archives") + (take-credits state :corp) + (play-from-hand state :runner "Zamba") + (is (= 6 (core/available-mu state)) "Gain 2 memory") + (is (= 1 (:credit (get-runner))) "At 1 credit") + (play-from-hand state :runner "Infiltration") + (click-prompt state :runner "Expose a card") + (click-card state :runner (get-ice state :archives 0)) + (is (= 2 (:credit (get-runner))) "Gained 1 credit from exposing") + (play-from-hand state :runner "Infiltration") + (click-prompt state :runner "Expose a card") + (click-card state :runner (get-ice state :archives 0)) + (is (= 3 (:credit (get-runner))) "Gained 1 more credit from exposing"))) (deftest zer0 ;; Zer0 (testing "Basic ability" (do-game - (new-game (default-corp) - (default-runner ["Zer0" "Corroder" (qty "Sure Gamble" 2)])) + (new-game {:runner {:deck ["Zer0" "Corroder" (qty "Sure Gamble" 2)]}}) (starting-hand state :runner ["Zer0" "Corroder"]) (take-credits state :corp) (play-from-hand state :runner "Zer0") @@ -1600,8 +1564,7 @@ (is (find-card "Corroder" (:discard (get-runner))) "Corroder is in heap")))) (testing "With Titanium Ribs" (do-game - (new-game (default-corp) - (default-runner ["Zer0" "Titanium Ribs" (qty "Sure Gamble" 5)])) + (new-game {:runner {:deck ["Zer0" "Titanium Ribs" (qty "Sure Gamble" 5)]}}) (starting-hand state :runner ["Zer0" "Titanium Ribs" "Sure Gamble" "Sure Gamble" "Sure Gamble"]) (take-credits state :corp) (play-from-hand state :runner "Zer0") @@ -1618,8 +1581,7 @@ (is (= 2 (count (:hand (get-runner)))) "Runner has 2 cards")))) (testing "With Respirocytes" (do-game - (new-game (default-corp) - (default-runner ["Zer0" "Titanium Ribs" "Respirocytes"(qty "Sure Gamble" 7)])) + (new-game {:runner {:deck ["Zer0" "Titanium Ribs" "Respirocytes"(qty "Sure Gamble" 7)]}}) (starting-hand state :runner ["Zer0" "Titanium Ribs" "Respirocytes" "Sure Gamble" "Sure Gamble" "Sure Gamble" "Sure Gamble"]) (take-credits state :corp) (play-from-hand state :runner "Zer0") diff --git a/test/clj/game_test/cards/ice.clj b/test/clj/game_test/cards/ice.clj index c579c795d6..d417ee7636 100644 --- a/test/clj/game_test/cards/ice.clj +++ b/test/clj/game_test/cards/ice.clj @@ -1,35 +1,17 @@ (ns game-test.cards.ice (:require [game.core :as core] - [game.utils :refer [has?]] + [game.utils :as utils] [game-test.core :refer :all] [game-test.utils :refer :all] [game-test.macros :refer :all] [jinteki.utils :refer [count-tags is-tagged?]] [clojure.test :refer :all])) -(use-fixtures :once load-all-cards (partial reset-card-defs "ice")) - -(deftest ^:skip-card-coverage - end-the-run-test - ;; Since all ETR ice share a common ability, we only need one test - (do-game - (new-game (default-corp [(qty "Ice Wall" 3) (qty "Hedge Fund" 3) (qty "Restructure" 2)]) - (default-runner)) - (play-from-hand state :corp "Ice Wall" "HQ") - (take-credits state :corp 2) - (run-on state "HQ") - (is (= [:hq] (get-in @state [:run :server]))) - (let [iwall (get-ice state :hq 0)] - (core/rez state :corp iwall) - (card-subroutine state :corp iwall 0) - (is (not (:run @state)) "Run is ended") - (is (get-in @state [:runner :register :unsuccessful-run]) "Run was unsuccessful")))) - (deftest aimor ;; Aimor - trash the top 3 cards of the stack, trash Aimor (do-game - (new-game (default-corp ["Aimor"]) - (default-runner [(qty "Sure Gamble" 2) "Desperado" "Corroder" "Patron"])) + (new-game {:corp {:deck ["Aimor"]} + :runner {:deck [(qty "Sure Gamble" 2) "Desperado" "Corroder" "Patron"]}}) (starting-hand state :runner ["Sure Gamble"]) ;move all other cards to stack (play-from-hand state :corp "Aimor" "HQ") (is (= 1 (count (get-in @state [:corp :servers :hq :ices]))) "Aimor installed") @@ -45,8 +27,8 @@ (deftest archangel ;; Archangel - accessing from R&D does not cause run to hang. (do-game - (new-game (default-corp ["Archangel" "Hedge Fund"]) - (default-runner ["Bank Job"])) + (new-game {:corp {:deck ["Archangel" "Hedge Fund"]} + :runner {:deck ["Bank Job"]}}) (starting-hand state :corp ["Hedge Fund"]) (take-credits state :corp) (play-from-hand state :runner "Bank Job") @@ -62,8 +44,7 @@ (deftest architect (testing "Architect is untrashable while installed and rezzed, but trashable if derezzed or from HQ" (do-game - (new-game (default-corp [(qty "Architect" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Architect" 3)]}}) (play-from-hand state :corp "Architect" "HQ") (let [architect (get-ice state :hq 0)] (core/rez state :corp architect) @@ -79,8 +60,7 @@ (deftest asteroid-belt ;; Asteroid Belt - Space ICE rez cost reduced by 3 credits per advancement (do-game - (new-game (default-corp ["Asteroid Belt"]) - (default-runner)) + (new-game {:corp {:deck ["Asteroid Belt"]}}) (core/gain state :corp :credit 5) (play-from-hand state :corp "Asteroid Belt" "HQ") (let [ab (get-ice state :hq 0)] @@ -94,8 +74,7 @@ (deftest bandwidth ;; Bandwidth - Give the Runner 1 tag; remove 1 tag if the run is successful (do-game - (new-game (default-corp ["Bandwidth"]) - (default-runner)) + (new-game {:corp {:deck ["Bandwidth"]}}) (play-from-hand state :corp "Bandwidth" "Archives") (let [bw (get-ice state :archives 0)] (take-credits state :corp) @@ -113,8 +92,7 @@ (deftest blockchain (do-game - (new-game (default-corp ["Blockchain" (qty "Beanstalk Royalties" 5)]) - (default-runner)) + (new-game {:corp {:deck ["Blockchain" (qty "Beanstalk Royalties" 5)]}}) (core/gain state :corp :credit 2 :click 5) (play-from-hand state :corp "Blockchain" "HQ") (let [bc (get-ice state :hq 0)] @@ -133,7 +111,6 @@ (play-from-hand state :corp "Beanstalk Royalties") (card-ability state :corp bc 0) (is (last-log-contains? state "uses Blockchain to gain 2 subroutines") "2 subroutines gained because 4 Transactions are in Archives") - (is (= 12 (:credit (get-corp))) "Corp has 12 credits from four Beanstalks") (card-subroutine state :corp bc 0) (is (= 13 (:credit (get-corp))) "Corp gained 1 credit from Blockchain") @@ -142,8 +119,7 @@ (deftest bullfrog ;; Bullfrog - Win psi to move to outermost position of another server and continue run there (do-game - (new-game (default-corp ["Bullfrog" (qty "Pup" 2)]) - (default-runner)) + (new-game {:corp {:deck ["Bullfrog" (qty "Pup" 2)]}}) (play-from-hand state :corp "Bullfrog" "HQ") (play-from-hand state :corp "Pup" "R&D") (play-from-hand state :corp "Pup" "R&D") @@ -163,8 +139,7 @@ (deftest cell-portal ;; Cell Portal - Bounce Runner to outermost position and derez itself (do-game - (new-game (default-corp ["Cell Portal" (qty "Paper Wall" 2)]) - (default-runner)) + (new-game {:corp {:deck ["Cell Portal" (qty "Paper Wall" 2)]}}) (core/gain state :corp :credit 5) (play-from-hand state :corp "Cell Portal" "HQ") (play-from-hand state :corp "Paper Wall" "HQ") @@ -183,8 +158,7 @@ (deftest chimera ;; Chimera - Gains chosen subtype (do-game - (new-game (default-corp ["Chimera"]) - (default-runner)) + (new-game {:corp {:deck ["Chimera"]}}) (play-from-hand state :corp "Chimera" "HQ") (let [ch (get-ice state :hq 0)] (core/rez state :corp ch) @@ -196,8 +170,8 @@ (deftest cortex-lock ;; Cortex Lock - Do net damage equal to Runner's unused memory (do-game - (new-game (default-corp ["Cortex Lock"]) - (default-runner [(qty "Corroder" 2) (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Cortex Lock"]} + :runner {:deck [(qty "Corroder" 2) (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Cortex Lock" "HQ") (take-credits state :corp) (let [cort (get-ice state :hq 0)] @@ -211,8 +185,7 @@ (deftest crick ;; Crick - Strength boost when protecting Archives; installs a card from Archives (do-game - (new-game (default-corp [(qty "Crick" 2) "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Crick" 2) "Ice Wall"]}}) (play-from-hand state :corp "Crick" "HQ") (play-from-hand state :corp "Crick" "Archives") (core/move state :corp (find-card "Ice Wall" (:hand (get-corp))) :discard) @@ -231,8 +204,7 @@ (deftest curtain-wall ;; Curtain Wall - Strength boost when outermost ICE (do-game - (new-game (default-corp ["Curtain Wall" "Paper Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Curtain Wall" "Paper Wall"]}}) (core/gain state :corp :credit 10) (play-from-hand state :corp "Curtain Wall" "HQ") (let [curt (get-ice state :hq 0)] @@ -247,9 +219,9 @@ (deftest data-hound ;; Data Hound - Full test (do-game - (new-game (default-corp ["Data Hound"]) - (default-runner [(qty "Sure Gamble" 2) "Desperado" - "Corroder" "Patron"])) + (new-game {:corp {:deck ["Data Hound"]} + :runner {:deck [(qty "Sure Gamble" 2) "Desperado" + "Corroder" "Patron"]}}) (starting-hand state :runner ["Sure Gamble"]) ;move all other cards to stack (play-from-hand state :corp "Data Hound" "HQ") (take-credits state :corp) @@ -286,8 +258,7 @@ (deftest data-mine ;; Data Mine - do one net and trash (do-game - (new-game (default-corp ["Data Mine"]) - (default-runner)) + (new-game {:corp {:deck ["Data Mine"]}}) (play-from-hand state :corp "Data Mine" "Server 1") (take-credits state :corp) (let [dm (get-ice state :remote1 0)] @@ -299,8 +270,7 @@ (deftest draco ;; Dracō - Pay credits when rezzed to increase strength; trace to give 1 tag and end the run (do-game - (new-game (default-corp ["Dracō"]) - (default-runner)) + (new-game {:corp {:deck ["Dracō"]}}) (play-from-hand state :corp "Dracō" "HQ") (take-credits state :corp) (let [drac (get-ice state :hq 0)] @@ -318,8 +288,7 @@ (deftest enigma ;; Enigma - Force Runner to lose 1 click if able (do-game - (new-game (default-corp ["Enigma"]) - (default-runner)) + (new-game {:corp {:deck ["Enigma"]}}) (play-from-hand state :corp "Enigma" "HQ") (take-credits state :corp) (let [enig (get-ice state :hq 0)] @@ -332,8 +301,7 @@ (deftest envelope ;; Envelope - do 1 net damage, end the run (do-game - (new-game (default-corp ["Envelope"]) - (default-runner)) + (new-game {:corp {:deck ["Envelope"]}}) (play-from-hand state :corp "Envelope" "HQ") (take-credits state :corp) (let [envl (get-ice state :hq 0)] @@ -349,8 +317,8 @@ (deftest excalibur ;; Excalibur - Prevent Runner from making another run this turn (do-game - (new-game (default-corp ["Excalibur"]) - (default-runner ["Stimhack"])) + (new-game {:corp {:deck ["Excalibur"]} + :runner {:deck ["Stimhack"]}}) (play-from-hand state :corp "Excalibur" "HQ") (take-credits state :corp) (let [excal (get-ice state :hq 0)] @@ -375,8 +343,7 @@ (deftest fenris ;; Fenris - Illicit ICE give Corp 1 bad publicity when rezzed (do-game - (new-game (default-corp ["Fenris"]) - (default-runner)) + (new-game {:corp {:deck ["Fenris"]}}) (play-from-hand state :corp "Fenris" "HQ") (take-credits state :corp) (let [fen (get-ice state :hq 0)] @@ -391,8 +358,8 @@ (deftest flare ;; Flare - Trash 1 program, do 2 unpreventable meat damage, and end the run (do-game - (new-game (default-corp ["Flare"]) - (default-runner ["Plascrete Carapace" "Clone Chip" (qty "Cache" 3)])) + (new-game {:corp {:deck ["Flare"]} + :runner {:deck ["Plascrete Carapace" "Clone Chip" (qty "Cache" 3)]}}) (play-from-hand state :corp "Flare" "HQ") (core/gain state :corp :credit 2) (take-credits state :corp) @@ -416,64 +383,62 @@ ;; Formicary - when approaching server, may rez and move to innermost (testing "Verifies basic functionality and that First Responders may trigger" (do-game - (new-game (default-corp [(qty "Ice Wall" 2) (qty "Formicary" 3)]) - (default-runner [(qty "First Responders" 6)])) - (play-from-hand state :corp "Ice Wall" "HQ") - (play-from-hand state :corp "Formicary" "Archives") - (play-from-hand state :corp "Formicary" "R&D") - (take-credits state :corp) - (play-from-hand state :runner "First Responders") - (let [iw (get-ice state :hq 0) - form1 (get-ice state :rd 0) - form2 (get-ice state :archives 0) - responders (get-resource state 0)] - (run-on state "HQ") - (run-continue state) ; pass the first ice - (is (= 0 (get-in @state [:run :position])) "Now approaching server") - (core/rez state :corp form1) - (click-prompt state :corp "Yes") ; Move Formicary - (is (= 2 (count (get-in @state [:corp :servers :hq :ices]))) "2 ICE protecting HQ") - (is (= 1 (get-in @state [:run :position])) "Now approaching Formicary") - (card-subroutine state :corp (get-ice state :hq 0) 0) - (click-prompt state :runner "Yes") ; take 2 net - (is (= 2 (count (:discard (get-runner)))) "Did 2 net damage") - (run-jack-out state) - (let [cards-in-hand (count (:hand (get-runner)))] - (card-ability state :runner responders 0) - (is (= (inc cards-in-hand) (count (:hand (get-runner)))) "First Responders was able to trigger")) - (run-on state "Archives") - (run-continue state) - (core/rez state :corp form2) - (click-prompt state :corp "Yes") ; Move Formicary - (is (= 1 (get-in @state [:run :position])) "Now approaching Formicary") - (card-subroutine state :corp (refresh form2) 0) - (click-prompt state :runner "No") ; ETR - (is (not (get-in @state [:run])) "Formicary ended the run")))) + (new-game {:corp {:deck [(qty "Ice Wall" 2) (qty "Formicary" 3)]} + :runner {:deck [(qty "First Responders" 6)]}}) + (play-from-hand state :corp "Ice Wall" "HQ") + (play-from-hand state :corp "Formicary" "Archives") + (play-from-hand state :corp "Formicary" "R&D") + (take-credits state :corp) + (play-from-hand state :runner "First Responders") + (let [iw (get-ice state :hq 0) + form1 (get-ice state :rd 0) + form2 (get-ice state :archives 0) + responders (get-resource state 0)] + (run-on state "HQ") + (run-continue state) ; pass the first ice + (is (= 0 (get-in @state [:run :position])) "Now approaching server") + (core/rez state :corp form1) + (click-prompt state :corp "Yes") ; Move Formicary + (is (= 2 (count (get-in @state [:corp :servers :hq :ices]))) "2 ICE protecting HQ") + (is (= 1 (get-in @state [:run :position])) "Now approaching Formicary") + (card-subroutine state :corp (get-ice state :hq 0) 0) + (click-prompt state :runner "Yes") ; take 2 net + (is (= 2 (count (:discard (get-runner)))) "Did 2 net damage") + (run-jack-out state) + (let [cards-in-hand (count (:hand (get-runner)))] + (card-ability state :runner responders 0) + (is (= (inc cards-in-hand) (count (:hand (get-runner)))) "First Responders was able to trigger")) + (run-on state "Archives") + (run-continue state) + (core/rez state :corp form2) + (click-prompt state :corp "Yes") ; Move Formicary + (is (= 1 (get-in @state [:run :position])) "Now approaching Formicary") + (card-subroutine state :corp (refresh form2) 0) + (click-prompt state :runner "No") ; ETR + (is (not (get-in @state [:run])) "Formicary ended the run")))) (testing "Verifies that Formicary can be moved to the innermost positon of its own server" (do-game - (new-game (default-corp ["Ice Wall" "Formicary"]) - (default-runner)) - (play-from-hand state :corp "Ice Wall" "HQ") - (play-from-hand state :corp "Formicary" "HQ") - (take-credits state :corp) - (let [form (get-ice state :hq 1)] - (run-on state "HQ") - (run-continue state) ; pass the first ice - (run-continue state) ; pass the second ice - (is (= 0 (get-in @state [:run :position])) "Now approaching server") - (core/rez state :corp form) - (is (= "Ice Wall" (:title (get-ice state :hq 0))) "Ice Wall is the innermost piece of ice before swap") - (is (= "Formicary" (:title (get-ice state :hq 1))) "Formicary is the outermost piece of ice before swap") - (click-prompt state :corp "Yes") ; Move Formicary - (is (= 1 (get-in @state [:run :position])) "Now approaching the innermost piece of ice") - (is (= "Formicary" (:title (get-ice state :hq 0))) "Formicary is the innermost piece of ice after swap") - (is (= "Ice Wall" (:title (get-ice state :hq 1))) "Ice Wall is the outermost piece of ice after swap"))))) + (new-game {:corp {:deck ["Ice Wall" "Formicary"]}}) + (play-from-hand state :corp "Ice Wall" "HQ") + (play-from-hand state :corp "Formicary" "HQ") + (take-credits state :corp) + (let [form (get-ice state :hq 1)] + (run-on state "HQ") + (run-continue state) ; pass the first ice + (run-continue state) ; pass the second ice + (is (= 0 (get-in @state [:run :position])) "Now approaching server") + (core/rez state :corp form) + (is (= "Ice Wall" (:title (get-ice state :hq 0))) "Ice Wall is the innermost piece of ice before swap") + (is (= "Formicary" (:title (get-ice state :hq 1))) "Formicary is the outermost piece of ice before swap") + (click-prompt state :corp "Yes") ; Move Formicary + (is (= 1 (get-in @state [:run :position])) "Now approaching the innermost piece of ice") + (is (= "Formicary" (:title (get-ice state :hq 0))) "Formicary is the innermost piece of ice after swap") + (is (= "Ice Wall" (:title (get-ice state :hq 1))) "Ice Wall is the outermost piece of ice after swap"))))) (deftest free-lunch ;; Free Lunch - Spend 1 power counter to make Runner lose 1c (do-game - (new-game (default-corp ["Free Lunch"]) - (default-runner)) + (new-game {:corp {:deck ["Free Lunch"]}}) (play-from-hand state :corp "Free Lunch" "HQ") (let [fl (get-ice state :hq 0)] (core/rez state :corp fl) @@ -489,9 +454,8 @@ (deftest gatekeeper ;; Gatekeeper (do-game - (new-game (default-corp ["Gatekeeper" "Posted Bounty" - (qty "Hostile Takeover" 2) (qty "Ice Wall" 10)]) - (default-runner)) + (new-game {:corp {:deck ["Gatekeeper" "Posted Bounty" + (qty "Hostile Takeover" 2) (qty "Ice Wall" 10)]}}) ;; Set up (starting-hand state :corp ["Gatekeeper" "Ice Wall" "Ice Wall" "Posted Bounty" "Hostile Takeover" "Hostile Takeover"]) @@ -529,8 +493,8 @@ ;; Gemini - Successfully trace to do 1 net damage; do 1 net damage if trace strength is 5 or more regardless of success (testing "Basic test" (do-game - (new-game (default-corp ["Gemini" (qty "Hedge Fund" 2)]) - (default-runner [(qty "Sure Gamble" 3) (qty "Dirty Laundry" 2)])) + (new-game {:corp {:deck ["Gemini" (qty "Hedge Fund" 2)]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Dirty Laundry" 2)]}}) (play-from-hand state :corp "Gemini" "HQ") (play-from-hand state :corp "Hedge Fund") (play-from-hand state :corp "Hedge Fund") @@ -548,8 +512,9 @@ (is (= 3 (count (:discard (get-runner)))) "Did only 1 net damage for having trace strength 5 or more")))) (testing "Interaction with Chronos Protocol and kicker" (do-game - (new-game (make-deck "Chronos Protocol: Selective Mind-mapping" ["Gemini" (qty "Hedge Fund" 2)]) - (default-runner ["Sure Gamble" (qty "Dirty Laundry" 2)])) + (new-game {:corp {:id "Chronos Protocol: Selective Mind-mapping" + :deck ["Gemini" (qty "Hedge Fund" 2)]} + :runner {:deck ["Sure Gamble" (qty "Dirty Laundry" 2)]}}) (play-from-hand state :corp "Gemini" "HQ") (play-from-hand state :corp "Hedge Fund") (play-from-hand state :corp "Hedge Fund") @@ -567,8 +532,8 @@ (deftest holmegaard ;; Holmegaard - Stop Runner from accessing cards if win trace (do-game - (new-game (default-corp ["Holmegaard" "Hostile Takeover"]) - (default-runner ["Cache" "Inti"])) + (new-game {:corp {:deck ["Holmegaard" "Hostile Takeover"]} + :runner {:deck ["Cache" "Inti"]}}) (core/gain state :corp :credit 10) (play-from-hand state :corp "Holmegaard" "HQ") (let [holm (get-ice state :hq 0)] @@ -594,8 +559,7 @@ (deftest hydra ;; Hydra - do an effect Runner is tagged, otherwise give Runner 1 tag (do-game - (new-game (default-corp ["Hydra"]) - (default-runner)) + (new-game {:corp {:deck ["Hydra"]}}) (play-from-hand state :corp "Hydra" "HQ") (take-credits state :corp) (core/gain-credits state :corp 10) @@ -605,25 +569,20 @@ (core/rez state :corp hydra) (is (= (- corp-creds 10) (:credit (get-corp))) "Cost 10 credits to rez Hydra") (is (not (is-tagged? state)) "Runner is not tagged approaching Hydra") - (testing "Hydra subroutines give tags if Runner is not tagged" (doseq [n (range 3)] (card-subroutine state :corp hydra n) (is (= 1 (count-tags state)) (str "Hydra sub " (inc n) " gave Runner 1 tag")) (core/lose-tags state :runner 1))) - (testing "Hydra subroutines do their effect if the Runner is tagged" ;; Gain 1 tag to turn on main effect of subroutines (core/gain-tags state :runner 1) (is (is-tagged? state) "Runner is tagged") - (is (= 3 (count (:hand (get-runner)))) "3 cards in Runner grip before Hydra damage") (card-subroutine state :corp hydra 0) (is (= 0 (count (:hand (get-runner)))) "Hydra sub 1 did 3 damage when Runner is tagged") - (card-subroutine state :corp hydra 1) (is (= (- corp-creds 5) (:credit (get-corp))) "Hydra sub 2 gave 5 credits to Corp when Runner is tagged") - (is (:run @state) "Still a run going on before resolving last subroutine") (card-subroutine state :corp hydra 2) (is (not (:run @state)) "Hydra sub 3 ended the run when Runner is tagged"))))) @@ -631,8 +590,7 @@ (deftest iq ;; IQ - Rez cost and strength equal to cards in HQ (do-game - (new-game (default-corp [(qty "IQ" 3) (qty "Hedge Fund" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "IQ" 3) (qty "Hedge Fund" 3)]}}) (play-from-hand state :corp "Hedge Fund") (play-from-hand state :corp "IQ" "R&D") (let [iq1 (get-ice state :rd 0)] @@ -648,12 +606,11 @@ (= 3 (:current-strength (refresh iq2))) (= 2 (:credit (get-corp)))) "3 cards in HQ: paid 3 to rez, both have 3 strength"))))) -(deftest ^{:card-title "it's-a-trap!"} - its-a-trap +(deftest it-s-a-trap ;; It's a Trap! - 2 net dmg on expose, self-trash and make Runner trash installed card (do-game - (new-game (default-corp ["It's a Trap!"]) - (default-runner [(qty "Cache" 3) (qty "Infiltration" 2)])) + (new-game {:corp {:deck ["It's a Trap!"]} + :runner {:deck [(qty "Cache" 3) (qty "Infiltration" 2)]}}) (play-from-hand state :corp "It's a Trap!" "Archives") (let [iat (get-ice state :archives 0)] (take-credits state :corp) @@ -673,8 +630,8 @@ ;; Jua (testing "Encounter effect - Prevent Runner from installing cards for the rest of the turn" (do-game - (new-game (default-corp ["Jua"]) - (default-runner ["Desperado" "Sure Gamble"])) + (new-game {:corp {:deck ["Jua"]} + :runner {:deck ["Desperado" "Sure Gamble"]}}) (play-from-hand state :corp "Jua" "HQ") (take-credits state :corp) (let [jua (get-ice state :hq 0)] @@ -694,8 +651,8 @@ (is (zero? (count (:hand (get-runner)))) "Card installed")))) (testing "Subroutine effect - Select 2 runner cards, runner moves one to the stack" (do-game - (new-game (default-corp ["Jua"]) - (default-runner ["Desperado" "Gordian Blade"])) + (new-game {:corp {:deck ["Jua"]} + :runner {:deck ["Desperado" "Gordian Blade"]}}) (play-from-hand state :corp "Jua" "HQ") (take-credits state :corp) (let [jua (get-ice state :hq 0)] @@ -714,10 +671,11 @@ (click-prompt state :runner (get-program state 0)) (is (nil? (get-program state 0)) "Card is uninstalled") (is (= 1 (count (:deck (get-runner)))) "Runner puts card in deck")))) - (testing "Should only lock installing for Runner, not for both sides" + (testing "Should only lock installing for Runner, not for both sides" (do-game - (new-game (make-deck "Mti Mwekundu: Life Improved" ["Jua" "Kakugo"]) - (default-runner ["Paperclip"])) + (new-game {:corp {:id "Mti Mwekundu: Life Improved" + :deck ["Jua" "Kakugo"]} + :runner {:deck ["Paperclip"]}}) (play-from-hand state :corp "Jua" "HQ") (let [mti (get-in @state [:corp :identity]) jua (get-ice state :hq 0)] @@ -743,9 +701,8 @@ ;; Kakugo (testing "ability continues to work when ice is swapped" (do-game - (new-game (default-corp ["Kakugo" - "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Kakugo" + "Ice Wall"]}}) (play-from-hand state :corp "Kakugo" "R&D") (play-from-hand state :corp "Ice Wall" "Archives") (take-credits state :corp) @@ -763,8 +720,8 @@ (is (= 1 (count (:hand (get-runner)))) "Runner took damage after swap")))) (testing "After wrassling, Kakugo should still do damage despite temporary card change") (do-game - (new-game (default-corp ["Kakugo"]) - (default-runner ["Engolo" (qty "Sure Gamble" 2)])) + (new-game {:corp {:deck ["Kakugo"]} + :runner {:deck ["Engolo" (qty "Sure Gamble" 2)]}}) (play-from-hand state :corp "Kakugo" "R&D") (take-credits state :corp) ;; This also ends the corps turn. (play-from-hand state :runner "Sure Gamble") ;; Needed to ensure that we can pay for Kakugo + ability @@ -780,42 +737,41 @@ (run-continue state) (empty? (:hand (get-runner)))) "Runner took damage passing kakugo")) -(deftest kamali-1.0 +(deftest kamali-1-0 ;; Kamali 1.0 (do-game - (new-game (default-corp ["Kamali 1.0"]) - (default-runner ["Astrolabe" "Decoy" - "Cache" "Hedge Fund"])) + (new-game {:corp {:deck ["Kamali 1.0"]} + :runner {:deck ["Astrolabe" "Decoy" + "Cache" "Hedge Fund"]}}) (play-from-hand state :corp "Kamali 1.0" "HQ") (take-credits state :corp) (play-from-hand state :runner "Astrolabe") (play-from-hand state :runner "Decoy") (play-from-hand state :runner "Cache") - (let [kamali (get-ice state :hq 0)] - (run-on state "HQ") - (core/rez state :corp kamali) - (card-subroutine state :corp kamali 0) - (is (zero? (:brain-damage (get-runner))) "Runner starts with 0 brain damage") - (click-prompt state :runner "Take 1 brain damage") - (is (= 1 (:brain-damage (get-runner))) "Runner took 1 brain damage") - (card-subroutine state :corp kamali 1) - (is (empty? (:discard (get-runner))) "Runner starts with no discarded cards") - (click-prompt state :runner "Trash an installed piece of hardware") - (click-card state :runner (get-hardware state 0)) - (is (empty? (get-hardware state)) "Astrolabe trashed") - (is (= 1 (count (:discard (get-runner)))) "Runner trashed 1 card") - (card-subroutine state :corp kamali 2) - (is (= 1 (count (:discard (get-runner)))) "Runner starts with 1 discarded card") - (click-prompt state :runner "Trash an installed program") - (click-card state :runner (get-program state 0)) - (is (empty? (get-program state)) "Cache trashed") - (is (= 2 (count (:discard (get-runner)))) "Runner trashed 1 card")))) + (let [kamali (get-ice state :hq 0)] + (run-on state "HQ") + (core/rez state :corp kamali) + (card-subroutine state :corp kamali 0) + (is (zero? (:brain-damage (get-runner))) "Runner starts with 0 brain damage") + (click-prompt state :runner "Take 1 brain damage") + (is (= 1 (:brain-damage (get-runner))) "Runner took 1 brain damage") + (card-subroutine state :corp kamali 1) + (is (empty? (:discard (get-runner))) "Runner starts with no discarded cards") + (click-prompt state :runner "Trash an installed piece of hardware") + (click-card state :runner (get-hardware state 0)) + (is (empty? (get-hardware state)) "Astrolabe trashed") + (is (= 1 (count (:discard (get-runner)))) "Runner trashed 1 card") + (card-subroutine state :corp kamali 2) + (is (= 1 (count (:discard (get-runner)))) "Runner starts with 1 discarded card") + (click-prompt state :runner "Trash an installed program") + (click-card state :runner (get-program state 0)) + (is (empty? (get-program state)) "Cache trashed") + (is (= 2 (count (:discard (get-runner)))) "Runner trashed 1 card")))) (deftest kitsune (testing "Kitsune - Corp choices card for Runner to access" (do-game - (new-game (default-corp ["Kitsune" "Snare!"]) - (default-runner)) + (new-game {:corp {:deck ["Kitsune" "Snare!"]}}) (play-from-hand state :corp "Kitsune" "R&D") (take-credits state :corp) (run-on state "R&D") @@ -832,8 +788,8 @@ (deftest lockdown ;; Lockdown - Prevent Runner from drawing cards for the rest of the turn (do-game - (new-game (default-corp ["Lockdown"]) - (default-runner [(qty "Diesel" 2) (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Lockdown"]} + :runner {:deck [(qty "Diesel" 2) (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Lockdown" "R&D") (take-credits state :corp) (core/move state :runner (find-card "Sure Gamble" (:hand (get-runner))) :deck) @@ -855,8 +811,8 @@ (deftest lotus-field ;; Lotus Field strength cannot be lowered (do-game - (new-game (default-corp ["Lotus Field" "Lag Time"]) - (default-runner ["Ice Carver" "Parasite"])) + (new-game {:corp {:deck ["Lotus Field" "Lag Time"]} + :runner {:deck ["Ice Carver" "Parasite"]}}) (play-from-hand state :corp "Lotus Field" "Archives") (take-credits state :corp 2) (let [lotus (get-ice state :archives 0)] @@ -883,8 +839,8 @@ ;; Magnet - host program when rezzed (testing "Faceup ice" (do-game - (new-game (default-corp ["Magnet" "Enigma"]) - (default-runner ["Parasite"])) + (new-game {:corp {:deck ["Magnet" "Enigma"]} + :runner {:deck ["Parasite"]}}) (play-from-hand state :corp "Magnet" "HQ") (play-from-hand state :corp "Enigma" "R&D") (core/rez state :corp (get-ice state :rd 0)) @@ -906,8 +862,8 @@ "Parasite does not gain a virus counter")))) (testing "Facedown ice" (do-game - (new-game (default-corp ["Magnet" "Enigma"]) - (default-runner ["Trypano"])) + (new-game {:corp {:deck ["Magnet" "Enigma"]} + :runner {:deck ["Trypano"]}}) (play-from-hand state :corp "Magnet" "HQ") (play-from-hand state :corp "Enigma" "R&D") (take-credits state :corp) @@ -929,8 +885,8 @@ "Trypano does not gain a virus counter")))) (testing "Derezzed ice" (do-game - (new-game (default-corp ["Magnet" "Enigma"]) - (default-runner [(qty "Parasite" 2)])) + (new-game {:corp {:deck ["Magnet" "Enigma"]} + :runner {:deck [(qty "Parasite" 2)]}}) (play-from-hand state :corp "Magnet" "HQ") (play-from-hand state :corp "Enigma" "R&D") (core/rez state :corp (get-ice state :rd 0)) @@ -978,11 +934,24 @@ (is (= 1 (core/get-virus-counters state (second (:hosted (refresh m))))) "Second parasite gains a virus counter on rezzed Magnet"))))) +(deftest masvingo + (do-game + (new-game {:corp {:deck ["Masvingo"]}}) + (play-from-hand state :corp "Masvingo" "HQ") + (let [mas (get-ice state :hq 0)] + (is (zero? (get-counters (refresh mas) :advancement)) "Should install with 0 counter") + (core/rez state :corp (refresh mas)) + (is (= 1 (get-counters (refresh mas) :advancement)) "Should rez with 1 counter") + (take-credits state :corp) + (run-on state :hq) + (card-subroutine state :corp mas 0) + (is (not (:run @state)) "Run is ended")))) + (deftest mausolus ;; Mausolus - 3 adv tokens change the subroutines (do-game - (new-game (default-corp ["Mausolus"]) - (default-runner [(qty "NetChip" 5)])) + (new-game {:corp {:deck ["Mausolus"]} + :runner {:deck [(qty "NetChip" 5)]}}) (play-from-hand state :corp "Mausolus" "HQ") (let [mau (get-ice state :hq 0)] (core/rez state :corp mau) @@ -1015,25 +984,10 @@ (is (not (:run @state)) "Run is ended") (is (get-in @state [:runner :register :unsuccessful-run]) "Run was unsuccessful")))) -(deftest masvingo - (do-game - (new-game (default-corp ["Masvingo"]) - (default-runner)) - (play-from-hand state :corp "Masvingo" "HQ") - (let [mas (get-ice state :hq 0)] - (is (zero? (get-counters (refresh mas) :advancement)) "Should install with 0 counter") - (core/rez state :corp (refresh mas)) - (is (= 1 (get-counters (refresh mas) :advancement)) "Should rez with 1 counter") - (take-credits state :corp) - (run-on state :hq) - (card-subroutine state :corp mas 0) - (is (not (:run @state)) "Run is ended")))) - (deftest meridian (testing "ETR" (do-game - (new-game (default-corp ["Meridian"]) - (default-runner)) + (new-game {:corp {:deck ["Meridian"]}}) (play-from-hand state :corp "Meridian" "HQ") (take-credits state :corp) (let [mer (get-ice state :hq 0)] @@ -1046,8 +1000,7 @@ (is (= 1 (count (get-ice state :hq))) "ICE still installed")))) (testing "Score as -1 point agenda" (do-game - (new-game (default-corp ["Meridian"]) - (default-runner)) + (new-game {:corp {:deck ["Meridian"]}}) (play-from-hand state :corp "Meridian" "HQ") (take-credits state :corp) (let [mer (get-ice state :hq 0)] @@ -1062,8 +1015,7 @@ (deftest meru-mati (do-game - (new-game (default-corp [(qty "Meru Mati" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Meru Mati" 2)]}}) (play-from-hand state :corp "Meru Mati" "HQ") (play-from-hand state :corp "Meru Mati" "R&D") (core/rez state :corp (get-ice state :hq 0)) @@ -1074,8 +1026,7 @@ (deftest mind-game ;; Mind game - PSI redirect to different server (do-game - (new-game (default-corp ["Mind Game"]) - (default-runner)) + (new-game {:corp {:deck ["Mind Game"]}}) (play-from-hand state :corp "Mind Game" "HQ") (take-credits state :corp) (run-on state :hq) @@ -1091,8 +1042,7 @@ (deftest minelayer ;; Minelayer - Install a piece of ICE in outermost position of Minelayer's server at no cost (do-game - (new-game (default-corp ["Minelayer" "Fire Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Minelayer" "Fire Wall"]}}) (play-from-hand state :corp "Minelayer" "HQ") (take-credits state :corp) (run-on state :hq) @@ -1106,8 +1056,8 @@ (deftest mlinzi ;; Mlinzi - take X net damage or trash the top X+1 cards from the Stack (do-game - (new-game (default-corp ["Mlinzi"]) - (default-runner [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Mlinzi"]} + :runner {:deck [(qty "Sure Gamble" 3)]}}) (starting-hand state :runner ["Sure Gamble"]) (play-from-hand state :corp "Mlinzi" "HQ") (take-credits state :corp) @@ -1128,8 +1078,7 @@ (deftest mother-goddess ;; Mother Goddess - Gains other ice subtypes (do-game - (new-game (default-corp ["Mother Goddess" "NEXT Bronze"]) - (default-runner)) + (new-game {:corp {:deck ["Mother Goddess" "NEXT Bronze"]}}) (core/gain state :corp :credit 1) (play-from-hand state :corp "Mother Goddess" "HQ") (play-from-hand state :corp "NEXT Bronze" "R&D") @@ -1147,8 +1096,7 @@ (deftest next-bronze ;; NEXT Bronze - Add 1 strength for every rezzed NEXT ice (do-game - (new-game (default-corp [(qty "NEXT Bronze" 2) "NEXT Silver"]) - (default-runner)) + (new-game {:corp {:deck [(qty "NEXT Bronze" 2) "NEXT Silver"]}}) (core/gain state :corp :credit 2) (play-from-hand state :corp "NEXT Bronze" "HQ") (play-from-hand state :corp "NEXT Bronze" "R&D") @@ -1174,8 +1122,7 @@ ;; NEXT Diamond - Rez cost is lowered by 1 for each rezzed NEXT ice (testing "Base rez cost" (do-game - (new-game (default-corp ["NEXT Diamond"]) - (default-runner)) + (new-game {:corp {:deck ["NEXT Diamond"]}}) (core/gain state :corp :credit 5) (is (= 10 (:credit (get-corp))) "Corp starts with 10 credits") (play-from-hand state :corp "NEXT Diamond" "HQ") @@ -1183,8 +1130,7 @@ (is (zero? (:credit (get-corp))) "Corp spends 10 credits to rez"))) (testing "Lowered rez cost" (do-game - (new-game (default-corp ["NEXT Diamond" "NEXT Opal" "NEXT Bronze" "Kakugo"]) - (default-runner)) + (new-game {:corp {:deck ["NEXT Diamond" "NEXT Opal" "NEXT Bronze" "Kakugo"]}}) (core/gain state :corp :credit 13 :click 1) (play-from-hand state :corp "NEXT Diamond" "HQ") (play-from-hand state :corp "NEXT Opal" "HQ") @@ -1200,8 +1146,7 @@ ;; NEXT Sapphire (testing "Basic test" (do-game - (new-game (default-corp ["NEXT Bronze" "NEXT Sapphire" (qty "Ice Wall" 100)]) - (default-runner)) + (new-game {:corp {:deck ["NEXT Bronze" "NEXT Sapphire" (qty "Ice Wall" 100)]}}) (starting-hand state :corp ["NEXT Bronze" "NEXT Sapphire" "Ice Wall" "Ice Wall"]) (dotimes [_ 5] (core/move state :corp (find-card "Ice Wall" (:deck (get-corp))) :discard)) @@ -1239,8 +1184,7 @@ (is (= 2 (-> (get-corp) :prompt first :choices :number)) "2 rezzed NEXT ice increases choice total")))) (testing "Should shuffle even when choosing 0" (do-game - (new-game (default-corp ["NEXT Sapphire" (qty "Ice Wall" 100)]) - (default-runner)) + (new-game {:corp {:deck ["NEXT Sapphire" (qty "Ice Wall" 100)]}}) (starting-hand state :corp ["NEXT Sapphire" "Ice Wall"]) (play-from-hand state :corp "NEXT Sapphire" "HQ") (take-credits state :corp) @@ -1260,8 +1204,7 @@ (deftest nightdancer ;; Nightdancer - Runner loses a click if able, corp gains a click on next turn (do-game - (new-game (default-corp ["Nightdancer"]) - (default-runner)) + (new-game {:corp {:deck ["Nightdancer"]}}) (play-from-hand state :corp "Nightdancer" "HQ") (take-credits state :corp) (let [nd (get-ice state :hq 0)] @@ -1280,8 +1223,7 @@ ;; Oduduwa - Gain 1 advancement token when encountered. ;; May placed x advancement tokens on another ice where x is the number of counters on Oduduwa already. (do-game - (new-game (default-corp ["Oduduwa" "Enigma"]) - (default-runner)) + (new-game {:corp {:deck ["Oduduwa" "Enigma"]}}) (play-from-hand state :corp "Oduduwa" "HQ") (play-from-hand state :corp "Enigma" "R&D") (let [odu (get-ice state :hq 0) @@ -1317,8 +1259,7 @@ (deftest otoroshi ;; Otoroshi (do-game - (new-game (default-corp ["Otoroshi" "Project Junebug" (qty "Ice Wall" 100)]) - (default-runner)) + (new-game {:corp {:deck ["Otoroshi" "Project Junebug" (qty "Ice Wall" 100)]}}) (starting-hand state :corp ["Otoroshi" "Project Junebug"]) (play-from-hand state :corp "Otoroshi" "New remote") (play-from-hand state :corp "Project Junebug" "New remote") @@ -1348,8 +1289,8 @@ (deftest peeping-tom ;;Peeping Tom - Counts # of chosen card type in Runner grip (do-game - (new-game (default-corp ["Peeping Tom"]) - (default-runner [(qty "Sure Gamble" 5)])) + (new-game {:corp {:deck ["Peeping Tom"]} + :runner {:deck [(qty "Sure Gamble" 5)]}}) (play-from-hand state :corp "Peeping Tom" "HQ") (take-credits state :corp) (run-on state "HQ") @@ -1374,8 +1315,7 @@ (deftest resistor ;; Resistor - Strength equal to Runner tags, lose strength when Runner removes a tag (do-game - (new-game (default-corp ["Resistor"]) - (default-runner)) + (new-game {:corp {:deck ["Resistor"]}}) (play-from-hand state :corp "Resistor" "HQ") (let [resistor (get-ice state :hq 0)] (core/rez state :corp resistor) @@ -1391,8 +1331,7 @@ ;; Sadaka (testing "Sub 1 - Look at the top 3 cards of R&D, arrange those or shuffle R&D. You may draw 1 card" (do-game - (new-game (default-corp ["Sadaka" (qty "Enigma" 3)]) - (default-runner)) + (new-game {:corp {:deck ["Sadaka" (qty "Enigma" 3)]}}) (starting-hand state :corp ["Sadaka"]) (play-from-hand state :corp "Sadaka" "Archives") (let [sadaka (get-ice state :archives 0)] @@ -1410,8 +1349,8 @@ (is (= 1 (count (:hand (get-corp)))) "Corp doesn't draw a card")))) (testing "Sub 2 - You may trash 1 card in HQ. If you do, trash 1 resource. Trash Sadaka." (do-game - (new-game (default-corp [(qty "Sadaka" 2) (qty "Enigma" 3)]) - (default-runner ["Bank Job"])) + (new-game {:corp {:deck [(qty "Sadaka" 2) (qty "Enigma" 3)]} + :runner {:deck ["Bank Job"]}}) (play-from-hand state :corp "Sadaka" "Archives") (play-from-hand state :corp "Sadaka" "HQ") (let [sadaka (get-ice state :archives 0) @@ -1442,11 +1381,25 @@ (is (= 1 (count (:discard (get-runner)))) "Runner resource trashed") (is (= 4 (count (:discard (get-corp)))) "sadakaHQ trashed"))))) +(deftest sand-storm + ;; Sand Storm should not end the run if protecting an otherwise empty/naked server + (do-game + (new-game {:corp {:deck ["Sand Storm" "PAD Campaign"]}}) + (play-from-hand state :corp "Sand Storm" "New remote") + (play-from-hand state :corp "PAD Campaign" "New remote") + (take-credits state :corp) + (run-on state "Server 1") + (let [sand-storm (get-ice state :remote1 0)] + (core/rez state :corp sand-storm) + (card-subroutine state :corp sand-storm 0) + (click-prompt state :corp "Server 2") + (is (= (first (get-in @state [:run :server])) :remote2) "Is running on server 2")))) + (deftest sandman ;; Sandman - add an installed runner card to the grip (do-game - (new-game (default-corp ["Sandman"]) - (default-runner ["Inti" "Scrubber"])) + (new-game {:corp {:deck ["Sandman"]} + :runner {:deck ["Inti" "Scrubber"]}}) (play-from-hand state :corp "Sandman" "HQ") (take-credits state :corp) (play-from-hand state :runner "Inti") @@ -1467,8 +1420,7 @@ (deftest searchlight ;; Searchlight - Trace bace equal to advancement counters (do-game - (new-game (default-corp ["Searchlight"]) - (default-runner)) + (new-game {:corp {:deck ["Searchlight"]}}) (play-from-hand state :corp "Searchlight" "HQ") (let [searchlight (get-ice state :hq 0)] (core/rez state :corp searchlight) @@ -1485,8 +1437,7 @@ (deftest seidr-adaptive-barrier ;; Seidr Adaptive Barrier - +1 strength for every ice protecting its server (do-game - (new-game (default-corp ["Seidr Adaptive Barrier" (qty "Ice Wall" 2)]) - (default-runner)) + (new-game {:corp {:deck ["Seidr Adaptive Barrier" (qty "Ice Wall" 2)]}}) (core/gain state :corp :credit 10) (play-from-hand state :corp "Seidr Adaptive Barrier" "HQ") (let [sab (get-ice state :hq 0)] @@ -1502,8 +1453,8 @@ (deftest self-adapting-code-wall ;; Self-Adapting Code Wall (do-game - (new-game (default-corp ["Self-Adapting Code Wall" "Lag Time"]) - (default-runner ["Ice Carver" "Parasite"])) + (new-game {:corp {:deck ["Self-Adapting Code Wall" "Lag Time"]} + :runner {:deck ["Ice Carver" "Parasite"]}}) (play-from-hand state :corp "Self-Adapting Code Wall" "Archives") (take-credits state :corp 2) (let [sacw (get-ice state :archives 0)] @@ -1526,11 +1477,11 @@ (take-credits state :corp 2) (is (= 2 (:current-strength (refresh sacw))) "Self-Adapting Code Wall strength increased")))) -(deftest sherlock-1.0 +(deftest sherlock-1-0 ;; Sherlock 1.0 - Trace to add an installed program to the top of Runner's Stack (do-game - (new-game (default-corp ["Sherlock 1.0"]) - (default-runner [(qty "Gordian Blade" 3) (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Sherlock 1.0"]} + :runner {:deck [(qty "Gordian Blade" 3) (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Sherlock 1.0" "HQ") (take-credits state :corp) (let [sherlock (get-ice state :hq 0)] @@ -1544,11 +1495,11 @@ (is (empty? (get-program state)) "Gordian uninstalled") (is (= "Gordian Blade" (:title (first (:deck (get-runner))))) "Gordian on top of Stack")))) -(deftest sherlock-2.0 +(deftest sherlock-2-0 ;; Sherlock 2.0 - Trace to add an installed program to the bottom of Runner's Stack (do-game - (new-game (default-corp [(qty "Sherlock 2.0" 1)]) - (default-runner [(qty "Gordian Blade" 3) (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Sherlock 2.0" 1)]} + :runner {:deck [(qty "Gordian Blade" 3) (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Sherlock 2.0" "HQ") (take-credits state :corp) (let [sherlock (get-ice state :hq 0)] @@ -1566,9 +1517,9 @@ ;; Shiro (testing "Full test" (do-game - (new-game (default-corp ["Shiro" "Caprice Nisei" - "Quandary" "Jackson Howard"]) - (default-runner ["R&D Interface"])) + (new-game {:corp {:deck ["Shiro" "Caprice Nisei" + "Quandary" "Jackson Howard"]} + :runner {:deck ["R&D Interface"]}}) (starting-hand state :corp ["Shiro"]) (play-from-hand state :corp "Shiro" "HQ") (take-credits state :corp) @@ -1599,9 +1550,9 @@ (:cid (:card (first (:prompt (get-runner)))))) "Access another card due to R&D Interface")))) (testing "with Mwanza City Grid, should access additional 3 cards" (do-game - (new-game (default-corp ["Shiro" "Mwanza City Grid" - (qty "Ice Wall" 10)]) - (default-runner ["R&D Interface"])) + (new-game {:corp {:deck ["Shiro" "Mwanza City Grid" + (qty "Ice Wall" 10)]} + :runner {:deck ["R&D Interface"]}}) (starting-hand state :corp ["Shiro" "Mwanza City Grid"]) (play-from-hand state :corp "Mwanza City Grid" "R&D") (play-from-hand state :corp "Shiro" "R&D") @@ -1625,8 +1576,7 @@ (deftest snowflake ;; Snowflake - Win a psi game to end the run (do-game - (new-game (default-corp ["Snowflake"]) - (default-runner)) + (new-game {:corp {:deck ["Snowflake"]}}) (play-from-hand state :corp "Snowflake" "HQ") (take-credits state :corp) (run-on state :hq) @@ -1644,8 +1594,7 @@ (deftest special-offer ;; Special Offer trashes itself and updates the run position (do-game - (new-game (default-corp ["Ice Wall" "Special Offer"]) - (default-runner)) + (new-game {:corp {:deck ["Ice Wall" "Special Offer"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (play-from-hand state :corp "Special Offer" "HQ") (take-credits state :corp 1) @@ -1659,26 +1608,10 @@ (is (= 1 (:position (get-in @state [:run]))) "Run position updated; now approaching Ice Wall")))) -(deftest sand-storm - ;; Sand Storm should not end the run if protecting an otherwise empty/naked server - (do-game - (new-game (default-corp ["Sand Storm" "PAD Campaign"]) - (default-runner)) - (play-from-hand state :corp "Sand Storm" "New remote") - (play-from-hand state :corp "PAD Campaign" "New remote") - (take-credits state :corp) - (run-on state "Server 1") - (let [sand-storm (get-ice state :remote1 0)] - (core/rez state :corp sand-storm) - (card-subroutine state :corp sand-storm 0) - (click-prompt state :corp "Server 2") - (is (= (first (get-in @state [:run :server])) :remote2) "Is running on server 2")))) - (deftest surveyor ;; Surveyor ice strength (do-game - (new-game (default-corp [(qty "Surveyor" 1) (qty "Ice Wall" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Surveyor" 1) (qty "Ice Wall" 2)]}}) (core/gain state :corp :credit 10) (core/gain state :runner :credit 10) (play-from-hand state :corp "Surveyor" "HQ") @@ -1706,8 +1639,7 @@ (deftest thimblerig (testing "Thimblerig does not flag phase 1.2 if it's the only piece of ice" (do-game - (new-game (default-corp ["Thimblerig" "Guard"]) - (default-runner)) + (new-game {:corp {:deck ["Thimblerig" "Guard"]}}) (play-from-hand state :corp "Thimblerig" "HQ") (core/rez state :corp (get-ice state :hq 0)) (take-credits state :corp) @@ -1719,8 +1651,7 @@ (is (:corp-phase-12 @state) "Corp in phase 1.2 when there are 2 pieces of ice"))) (testing "Basic of swap ability - usable both during and outside runs" (do-game - (new-game (default-corp ["Vanilla" "Pup" "Thimblerig"]) - (default-runner)) + (new-game {:corp {:deck ["Vanilla" "Pup" "Thimblerig"]}}) (play-from-hand state :corp "Thimblerig" "HQ") (play-from-hand state :corp "Pup" "HQ") (play-from-hand state :corp "Vanilla" "New remote") @@ -1748,8 +1679,8 @@ ;; Forfeit option as rez cost, can have hosted condition counters (testing "Basic test" (do-game - (new-game (default-corp ["Hostile Takeover" "Tithonium" "Patch"]) - (default-runner ["Pawn" "Wasteland"])) + (new-game {:corp {:deck ["Hostile Takeover" "Tithonium" "Patch"]} + :runner {:deck ["Pawn" "Wasteland"]}}) (core/gain state :corp :click 10) (play-from-hand state :corp "Hostile Takeover" "New remote") (play-from-hand state :corp "Tithonium" "HQ") @@ -1791,8 +1722,7 @@ (is (not (:run @state)) "Run ended"))))) (testing "Do not prompt for alt cost #2734" (do-game - (new-game (default-corp ["Hostile Takeover" "Oversight AI" "Tithonium"]) - (default-runner)) + (new-game {:corp {:deck ["Hostile Takeover" "Oversight AI" "Tithonium"]}}) (play-from-hand state :corp "Hostile Takeover" "New remote") (play-from-hand state :corp "Tithonium" "R&D") (let [ht (get-content state :remote1 0) @@ -1808,8 +1738,7 @@ ;; TMI (testing "Basic test" (do-game - (new-game (default-corp ["TMI"]) - (default-runner)) + (new-game {:corp {:deck ["TMI"]}}) (play-from-hand state :corp "TMI" "HQ") (let [tmi (get-ice state :hq 0)] (core/rez state :corp tmi) @@ -1818,8 +1747,9 @@ (is (:rezzed (refresh tmi)))))) (testing "Losing trace derezzes TMI" (do-game - (new-game (default-corp ["TMI"]) - (make-deck "Sunny Lebeau: Security Specialist" [(qty "Blackmail" 3)])) + (new-game {:corp {:deck ["TMI"]} + :runner {:id "Sunny Lebeau: Security Specialist" + :deck [(qty "Blackmail" 3)]}}) (play-from-hand state :corp "TMI" "HQ") (let [tmi (get-ice state :hq 0)] (core/rez state :corp tmi) @@ -1831,8 +1761,7 @@ ;; Troll (testing "Giving the runner a choice on successful trace shouldn't make runner pay trace first. #5335" (do-game - (new-game (default-corp ["Troll"]) - (default-runner)) + (new-game {:corp {:deck ["Troll"]}}) (play-from-hand state :corp "Troll" "HQ") (take-credits state :corp) (let [troll (get-ice state :hq 0)] @@ -1848,8 +1777,7 @@ (deftest turing ;; Turing - Strength boosted when protecting a remote server (do-game - (new-game (default-corp [(qty "Turing" 2) "Hedge Fund"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Turing" 2) "Hedge Fund"]}}) (play-from-hand state :corp "Hedge Fund") (play-from-hand state :corp "Turing" "HQ") (play-from-hand state :corp "Turing" "New remote") @@ -1865,8 +1793,8 @@ (deftest waiver ;; Waiver - Trash Runner cards in grip with play/install cost <= trace exceed (do-game - (new-game (default-corp ["Waiver"]) - (default-runner ["Corroder" "Dean Lister" "Ubax" "Caldera"])) + (new-game {:corp {:deck ["Waiver"]} + :runner {:deck ["Corroder" "Dean Lister" "Ubax" "Caldera"]}}) (play-from-hand state :corp "Waiver" "HQ") (let [waiv (get-ice state :hq 0)] (core/rez state :corp waiv) @@ -1880,9 +1808,8 @@ (deftest wendigo ;; Morph ice gain and lose subtypes from normal advancements and placed advancements (do-game - (new-game (default-corp ["Wendigo" "Shipment from SanSan" - "Superior Cyberwalls"]) - (default-runner)) + (new-game {:corp {:deck ["Wendigo" "Shipment from SanSan" + "Superior Cyberwalls"]}}) (core/gain state :corp :click 2) (play-from-hand state :corp "Superior Cyberwalls" "New remote") (let [sc (get-content state :remote1 0)] @@ -1892,21 +1819,21 @@ (core/rez state :corp wend) (is (= 4 (:current-strength (refresh wend))) "Wendigo at normal 4 strength") (core/advance state :corp {:card (refresh wend)}) - (is (= true (has? (refresh wend) :subtype "Barrier")) "Wendigo gained Barrier") - (is (= false (has? (refresh wend) :subtype "Code Gate")) "Wendigo lost Code Gate") + (is (= true (utils/has? (refresh wend) :subtype "Barrier")) "Wendigo gained Barrier") + (is (= false (utils/has? (refresh wend) :subtype "Code Gate")) "Wendigo lost Code Gate") (is (= 5 (:current-strength (refresh wend))) "Wendigo boosted to 5 strength by scored Superior Cyberwalls") (play-from-hand state :corp "Shipment from SanSan") (click-prompt state :corp "1") (click-card state :corp wend) - (is (= false (has? (refresh wend) :subtype "Barrier")) "Wendigo lost Barrier") - (is (= true (has? (refresh wend) :subtype "Code Gate")) "Wendigo gained Code Gate") + (is (= false (utils/has? (refresh wend) :subtype "Barrier")) "Wendigo lost Barrier") + (is (= true (utils/has? (refresh wend) :subtype "Code Gate")) "Wendigo gained Code Gate") (is (= 4 (:current-strength (refresh wend))) "Wendigo returned to normal 4 strength"))))) (deftest wraparound ;; Wraparound - Strength boosted when no fracter is installed (do-game - (new-game (default-corp ["Wraparound"]) - (default-runner ["Corroder"])) + (new-game {:corp {:deck ["Wraparound"]} + :runner {:deck ["Corroder"]}}) (play-from-hand state :corp "Wraparound" "HQ") (let [wrap (get-ice state :hq 0)] (core/rez state :corp wrap) diff --git a/test/clj/game_test/cards/icebreakers.clj b/test/clj/game_test/cards/icebreakers.clj index cc6cbedf99..6247411be6 100644 --- a/test/clj/game_test/cards/icebreakers.clj +++ b/test/clj/game_test/cards/icebreakers.clj @@ -1,53 +1,16 @@ (ns game-test.cards.icebreakers (:require [game.core :as core] + [game.utils :as utils] [game-test.core :refer :all] [game-test.utils :refer :all] [game-test.macros :refer :all] [jinteki.utils :refer [count-tags]] [clojure.test :refer :all])) -(use-fixtures :once load-all-cards (partial reset-card-defs "icebreakers")) - -(deftest ^:skip-card-coverage - auto-pump-breakers - ;; Breaker get a dynamic ability that matches the strength of the encountered ice - (testing "Single pump" - (do-game - (new-game (default-corp ["Masvingo"]) - (default-runner ["Laamb"])) - (play-from-hand state :corp "Masvingo" "HQ") - (core/rez state :corp (get-ice state :hq 0)) - (take-credits state :corp) - (core/gain state :runner :credit 5) - (play-from-hand state :runner "Laamb") - (run-on state "HQ") - (let [laamb (get-program state 0)] - (is (= 2 (:current-strength (refresh laamb))) "Laamb starts at 2 strength") - (is (= 6 (:credit (get-runner))) "Spent 4 to install") - (core/play-dynamic-ability state :runner {:dynamic "auto-pump" :card (refresh laamb)}) - (is (= 8 (:current-strength (refresh laamb))) "Laamb is at 8 strength") - (is (= 3 (:credit (get-runner))) "Spent 3 to pump")))) - (testing "Multi pump" - (do-game - (new-game (default-corp ["Masvingo"]) - (default-runner ["Ankusa"])) - (play-from-hand state :corp "Masvingo" "HQ") - (core/rez state :corp (get-ice state :hq 0)) - (take-credits state :corp) - (core/gain state :runner :credit 5) - (play-from-hand state :runner "Ankusa") - (run-on state "HQ") - (let [ank (get-program state 0)] - (is (zero? (:current-strength (refresh ank))) "Ankusa starts at 1 strength") - (is (= 4 (:credit (get-runner))) "Spent 6 to install") - (core/play-dynamic-ability state :runner {:dynamic "auto-pump" :card (refresh ank)}) - (is (= 3 (:current-strength (refresh ank))) "Ankusa is at 3 strength") - (is (= 1 (:credit (get-runner))) "Spent 3 to pump"))))) - (deftest adept ;; Adept - +1 str for each unused MU (do-game - (new-game (default-corp) (default-runner ["Adept" "Box-E"])) + (new-game {:runner {:deck ["Adept" "Box-E"]}}) (take-credits state :corp) (core/gain state :runner :credit 10) (play-from-hand state :runner "Adept") @@ -62,7 +25,7 @@ ;; Atman (testing "Installing with 0 power counters" (do-game - (new-game (default-corp) (default-runner ["Atman"])) + (new-game {:runner {:deck ["Atman"]}}) (take-credits state :corp) (play-from-hand state :runner "Atman") (click-prompt state :runner "0") @@ -72,8 +35,7 @@ (is (zero? (:current-strength atman)) "0 current strength")))) (testing "Installing with 2 power counters" (do-game - (new-game (default-corp) - (default-runner ["Atman"])) + (new-game {:runner {:deck ["Atman"]}}) (take-credits state :corp) (play-from-hand state :runner "Atman") (click-prompt state :runner "2") @@ -86,8 +48,8 @@ ;; Aumakua - Gain credit on no-trash (testing "Gain counter on no trash" (do-game - (new-game (default-corp [(qty "PAD Campaign" 3)]) - (default-runner ["Aumakua"])) + (new-game {:corp {:deck [(qty "PAD Campaign" 3)]} + :runner {:deck ["Aumakua"]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (take-credits state :corp) (play-from-hand state :runner "Aumakua") @@ -100,16 +62,15 @@ (is (= 1 (get-counters (get-program state 0) :virus)) "Aumakua does not gain virus counter from trash"))) (testing "Gain counters on empty archives" (do-game - (new-game (default-corp) - (default-runner ["Aumakua"]) - {:start-as :runner}) + (new-game {:runner {:deck ["Aumakua"]} + :options {:start-as :runner}}) (play-from-hand state :runner "Aumakua") (run-empty-server state :archives) (is (= 1 (get-counters (get-program state 0) :virus)) "Aumakua gains virus counter from accessing empty Archives"))) (testing "Neutralize All Threats interaction" (do-game - (new-game (default-corp [(qty "PAD Campaign" 3)]) - (default-runner ["Aumakua" "Neutralize All Threats"])) + (new-game {:corp {:deck [(qty "PAD Campaign" 3)]} + :runner {:deck ["Aumakua" "Neutralize All Threats"]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (take-credits state :corp) (play-from-hand state :runner "Aumakua") @@ -121,9 +82,7 @@ (deftest baba-yaga ;; Baba Yaga (do-game - (new-game - (default-corp) - (default-runner ["Baba Yaga" "Faerie" "Yog.0" "Sharpshooter"])) + (new-game {:runner {:deck ["Baba Yaga" "Faerie" "Yog.0" "Sharpshooter"]}}) (take-credits state :corp) (core/gain state :runner :credit 10) (play-from-hand state :runner "Baba Yaga") @@ -144,31 +103,29 @@ (is (= 1 (core/available-mu state)) "1 MU left with 2 breakers on Baba Yaga") (is (= 4 (:credit (get-runner))) "-5 from Baba, -1 from Sharpshooter played into Rig, -5 from Yog")))) -(deftest ^{:card-title "cerberus-\"rex\"-h2"} - cerberus-rex-h2 +(deftest cerberus-rex-h2 ;; Cerberus "Rex" H2 - boost 1 for 1 cred, break for 1 counter (do-game - (new-game (default-corp) - (default-runner ["Cerberus \"Rex\" H2"])) - (take-credits state :corp) - (play-from-hand state :runner "Cerberus \"Rex\" H2") - (is (= 2 (:credit (get-runner))) "2 credits left after install") - (let [rex (get-program state 0)] - (is (= 4 (get-counters rex :power)) "Start with 4 counters") - ;; boost strength - (card-ability state :runner rex 1) - (is (= 1 (:credit (get-runner))) "Spend 1 credit to boost") - (is (= 2 (:current-strength (refresh rex))) "At strength 2 after boost") - ;; break - (card-ability state :runner rex 0) - (is (= 1 (:credit (get-runner))) "No credits spent to break") - (is (= 3 (get-counters (refresh rex) :power)) "One counter used to break")))) + (new-game {:runner {:deck ["Cerberus \"Rex\" H2"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Cerberus \"Rex\" H2") + (is (= 2 (:credit (get-runner))) "2 credits left after install") + (let [rex (get-program state 0)] + (is (= 4 (get-counters rex :power)) "Start with 4 counters") + ;; boost strength + (card-ability state :runner rex 1) + (is (= 1 (:credit (get-runner))) "Spend 1 credit to boost") + (is (= 2 (:current-strength (refresh rex))) "At strength 2 after boost") + ;; break + (card-ability state :runner rex 0) + (is (= 1 (:credit (get-runner))) "No credits spent to break") + (is (= 3 (get-counters (refresh rex) :power)) "One counter used to break")))) (deftest chameleon ;; Chameleon - Install on corp turn, only returns to hand at end of runner's turn (testing "with Clone Chip" (do-game - (new-game (default-corp) (default-runner ["Chameleon" "Clone Chip"])) + (new-game {:runner {:deck ["Chameleon" "Clone Chip"]}}) (take-credits state :corp) (play-from-hand state :runner "Clone Chip") (core/move state :runner (find-card "Chameleon" (:hand (get-runner))) :discard) @@ -186,7 +143,7 @@ (is (= 1 (count (:hand (get-runner)))) "Chameleon returned to hand at end of runner's turn"))) (testing "Returns to hand after hosting. #977" (do-game - (new-game (default-corp) (default-runner [(qty "Chameleon" 2) "Scheherazade"])) + (new-game {:runner {:deck [(qty "Chameleon" 2) "Scheherazade"]}}) (take-credits state :corp) (play-from-hand state :runner "Chameleon") (click-prompt state :runner "Barrier") @@ -210,8 +167,8 @@ (deftest cradle ;; Cradle (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Cradle" (qty "Cache" 100)])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Cradle" (qty "Cache" 100)]}}) (starting-hand state :runner ["Cradle"]) (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) @@ -234,8 +191,8 @@ (deftest crypsis ;; Crypsis - Loses a virus counter after encountering ice it broke (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner [(qty "Crypsis" 2)])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck [(qty "Crypsis" 2)]}}) (play-from-hand state :corp "Ice Wall" "Archives") (take-credits state :corp) (core/gain state :runner :credit 100) @@ -280,25 +237,23 @@ (deftest darwin ;; Darwin - starts at 0 strength (do-game - (new-game (default-corp) - (default-runner ["Darwin"])) + (new-game {:runner {:deck ["Darwin"]}}) (take-credits state :corp) (play-from-hand state :runner "Darwin") (let [darwin (get-program state 0)] (is (zero? (get-counters (refresh darwin) :virus)) "Darwin starts with 0 virus counters") - (is (zero? (:current-strength (refresh darwin ))) "Darwin starts at 0 strength") + (is (zero? (:current-strength (refresh darwin))) "Darwin starts at 0 strength") (take-credits state :runner) (take-credits state :corp) (card-ability state :runner (refresh darwin) 1) ; add counter (is (= 1 (get-counters (refresh darwin) :virus)) "Darwin gains 1 virus counter") - (is (= 1 (:current-strength (refresh darwin ))) "Darwin is at 1 strength")))) + (is (= 1 (:current-strength (refresh darwin))) "Darwin is at 1 strength")))) (deftest deus-x (testing "vs Multiple Hostile Infrastructure" (do-game - (new-game - (default-corp [(qty "Hostile Infrastructure" 3)]) - (default-runner [(qty "Deus X" 3) (qty "Sure Gamble" 2)])) + (new-game {:corp {:deck [(qty "Hostile Infrastructure" 3)]} + :runner {:deck [(qty "Deus X" 3) (qty "Sure Gamble" 2)]}}) (play-from-hand state :corp "Hostile Infrastructure" "New remote") (play-from-hand state :corp "Hostile Infrastructure" "New remote") (play-from-hand state :corp "Hostile Infrastructure" "New remote") @@ -317,9 +272,9 @@ (is (= 2 (count (:hand (get-runner)))) "Deus X prevented one Hostile net damage")))) (testing "vs Multiple sources of net damage" (do-game - (new-game - (make-deck "Jinteki: Personal Evolution" [(qty "Fetal AI" 6)]) - (default-runner [(qty "Deus X" 3) (qty "Sure Gamble" 2)])) + (new-game {:corp {:id "Jinteki: Personal Evolution" + :deck [(qty "Fetal AI" 6)]} + :runner {:deck [(qty "Deus X" 3) (qty "Sure Gamble" 2)]}}) (play-from-hand state :corp "Fetal AI" "New remote") (take-credits state :corp) (core/gain state :runner :credit 10) @@ -335,9 +290,8 @@ (deftest faerie ;; Faerie - trash after encounter is over, not before. (do-game - (new-game - (default-corp ["Caduceus"]) - (default-runner ["Faerie"])) + (new-game {:corp {:deck ["Caduceus"]} + :runner {:deck ["Faerie"]}}) (play-from-hand state :corp "Caduceus" "Archives") (take-credits state :corp) (play-from-hand state :runner "Faerie") @@ -352,8 +306,7 @@ (deftest faust (testing "Basic test: Pump by discarding" (do-game - (new-game (default-corp) - (default-runner ["Faust" (qty "Sure Gamble" 3)])) + (new-game {:runner {:deck ["Faust" (qty "Sure Gamble" 3)]}}) (take-credits state :corp) (play-from-hand state :runner "Faust") (let [faust (get-program state 0)] @@ -363,13 +316,12 @@ (is (= 1 (count (:discard (get-runner)))) "1 card trashed")))) (testing "Pump does not trigger trash prevention. #760" (do-game - (new-game (default-corp) - (default-runner ["Faust" + (new-game {:runner {:deck ["Faust" "Sacrificial Construct" "Fall Guy" "Astrolabe" "Gordian Blade" - "Armitage Codebusting"])) + "Armitage Codebusting"]}}) (take-credits state :corp) (core/draw state :runner 1) (play-from-hand state :runner "Faust") @@ -390,48 +342,46 @@ (deftest femme-fatale ;; Femme Fatale counter test (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner [(qty "Femme Fatale" 2)])) - (play-from-hand state :corp "Ice Wall" "HQ") - (take-credits state :corp) - (core/gain state :runner :credit 18) - (let [iw (get-ice state :hq 0)] - (play-from-hand state :runner "Femme Fatale") - (click-card state :runner iw) - (is (:icon (refresh iw)) "Ice Wall has an icon") - (core/trash state :runner (get-program state 0)) - (is (not (:icon (refresh iw))) "Ice Wall does not have an icon after Femme trashed") - (play-from-hand state :runner "Femme Fatale") - (click-card state :runner iw) - (is (:icon (refresh iw)) "Ice Wall has an icon") - (core/trash state :corp iw) - (is (not (:icon (refresh iw))) "Ice Wall does not have an icon after itself trashed")))) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck [(qty "Femme Fatale" 2)]}}) + (play-from-hand state :corp "Ice Wall" "HQ") + (take-credits state :corp) + (core/gain state :runner :credit 18) + (let [iw (get-ice state :hq 0)] + (play-from-hand state :runner "Femme Fatale") + (click-card state :runner iw) + (is (:icon (refresh iw)) "Ice Wall has an icon") + (core/trash state :runner (get-program state 0)) + (is (not (:icon (refresh iw))) "Ice Wall does not have an icon after Femme trashed") + (play-from-hand state :runner "Femme Fatale") + (click-card state :runner iw) + (is (:icon (refresh iw)) "Ice Wall has an icon") + (core/trash state :corp iw) + (is (not (:icon (refresh iw))) "Ice Wall does not have an icon after itself trashed")))) (deftest god-of-war ;; God of War - Take 1 tag to place 2 virus counters (do-game - (new-game (default-corp) - (default-runner ["God of War"])) - (take-credits state :corp) - (play-from-hand state :runner "God of War") - (take-credits state :runner) - (take-credits state :corp) - (let [gow (get-program state 0)] - (card-ability state :runner gow 2) - (is (= 1 (count-tags state))) - (is (= 2 (get-counters (refresh gow) :virus)) "God of War has 2 virus counters")))) + (new-game {:runner {:deck ["God of War"]}}) + (take-credits state :corp) + (play-from-hand state :runner "God of War") + (take-credits state :runner) + (take-credits state :corp) + (let [gow (get-program state 0)] + (card-ability state :runner gow 2) + (is (= 1 (count-tags state))) + (is (= 2 (get-counters (refresh gow) :virus)) "God of War has 2 virus counters")))) (deftest ika ;; Ika (testing "Can be hosted on both rezzed/unrezzed ice, respects no-host, is blanked by Magnet" (do-game - (new-game (default-corp ["Tithonium" "Enigma" "Magnet"]) - (default-runner ["Ika"])) + (new-game {:corp {:deck ["Tithonium" "Enigma" "Magnet"]} + :runner {:deck ["Ika"]}}) (play-from-hand state :corp "Enigma" "HQ") (play-from-hand state :corp "Tithonium" "Archives") (play-from-hand state :corp "Magnet" "R&D") (take-credits state :corp) - (play-from-hand state :runner "Ika") (core/gain state :runner :credit 100) (core/gain state :corp :credit 100) @@ -442,14 +392,14 @@ (let [creds (:credit (get-runner))] (card-ability state :runner ika 2) ; host on a piece of ice (click-card state :runner tithonium) - (is (game.utils/same-card? ika (first (:hosted (refresh tithonium)))) "Ika was rehosted") + (is (utils/same-card? ika (first (:hosted (refresh tithonium)))) "Ika was rehosted") (is (= (- creds 2) (:credit (get-runner))) "Rehosting from rig cost 2 creds")) (run-on state :archives) (let [creds (:credit (get-runner)) ika (first (:hosted (refresh tithonium)))] (card-ability state :runner ika 2) (click-card state :runner enigma) - (is (game.utils/same-card? ika (first (:hosted (refresh enigma)))) "Ika was rehosted") + (is (utils/same-card? ika (first (:hosted (refresh enigma)))) "Ika was rehosted") (is (= (- creds 2) (:credit (get-runner))) "Rehosting from ice during run cost 2 creds")) (core/rez state :corp tithonium) (let [creds (:credit (get-runner)) @@ -469,8 +419,8 @@ (deftest inversificator ;; Inversificator shouldn't hook up events for unrezzed ice (do-game - (new-game (default-corp ["Turing" "Kakugo"]) - (default-runner ["Inversificator" "Sure Gamble"])) + (new-game {:corp {:deck ["Turing" "Kakugo"]} + :runner {:deck ["Inversificator" "Sure Gamble"]}}) (play-from-hand state :corp "Kakugo" "HQ") (play-from-hand state :corp "Turing" "HQ") (take-credits state :corp) @@ -494,25 +444,24 @@ (deftest mammon ;; Mammon - Pay to add X power counters at start of turn, all removed at end of turn (do-game - (new-game (default-corp) - (default-runner ["Mammon"])) - (take-credits state :corp) - (play-from-hand state :runner "Mammon") - (take-credits state :runner) - (take-credits state :corp) - (let [mam (get-program state 0)] - (card-ability state :runner mam 0) - (click-prompt state :runner "3") - (is (= 2 (:credit (get-runner))) "Spent 3 credits") - (is (= 3 (get-counters (refresh mam) :power)) "Mammon has 3 power counters") - (take-credits state :runner) - (is (zero? (get-counters (refresh mam) :power)) "All power counters removed")))) + (new-game {:runner {:deck ["Mammon"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Mammon") + (take-credits state :runner) + (take-credits state :corp) + (let [mam (get-program state 0)] + (card-ability state :runner mam 0) + (click-prompt state :runner "3") + (is (= 2 (:credit (get-runner))) "Spent 3 credits") + (is (= 3 (get-counters (refresh mam) :power)) "Mammon has 3 power counters") + (take-credits state :runner) + (is (zero? (get-counters (refresh mam) :power)) "All power counters removed")))) (deftest musaazi ;; Musaazi gains virus counters on successful runs and can spend virus counters from any installed card (do-game - (new-game (default-corp ["Lancelot"]) - (default-runner ["Musaazi" "Imp"])) + (new-game {:corp {:deck ["Lancelot"]} + :runner {:deck ["Musaazi" "Imp"]}}) (play-from-hand state :corp "Lancelot" "HQ") (take-credits state :corp) (play-from-hand state :runner "Musaazi") @@ -538,12 +487,12 @@ (is (= 0 (get-counters (refresh imp) :virus)) "Imp lost its final virus counter") (is (= 0 (get-counters (refresh imp) :virus)) "Musaazi lost its virus counter")))) -(deftest na'not'k +(deftest na-not-k ;; Na'Not'K - Strength adjusts accordingly when ice installed during run (testing "Basic test" (do-game - (new-game (default-corp ["Architect" "Eli 1.0"]) - (default-runner ["Na'Not'K"])) + (new-game {:corp {:deck ["Architect" "Eli 1.0"]} + :runner {:deck ["Na'Not'K"]}}) (play-from-hand state :corp "Architect" "HQ") (take-credits state :corp) (play-from-hand state :runner "Na'Not'K") @@ -561,8 +510,8 @@ (is (= 1 (:current-strength (refresh nanotk))) "Back to default strength")))) (testing "Strength adjusts accordingly when run redirected to another server" (do-game - (new-game (default-corp ["Susanoo-no-Mikoto" "Crick" "Cortex Lock"]) - (default-runner ["Na'Not'K"])) + (new-game {:corp {:deck ["Susanoo-no-Mikoto" "Crick" "Cortex Lock"]} + :runner {:deck ["Na'Not'K"]}}) (play-from-hand state :corp "Cortex Lock" "HQ") (play-from-hand state :corp "Susanoo-no-Mikoto" "HQ") (play-from-hand state :corp "Crick" "Archives") @@ -582,8 +531,7 @@ (deftest overmind ;; Overmind - Start with counters equal to unused MU (do-game - (new-game (default-corp) - (default-runner ["Overmind" (qty "Akamatsu Mem Chip" 2)])) + (new-game {:runner {:deck ["Overmind" (qty "Akamatsu Mem Chip" 2)]}}) (take-credits state :corp) (take-credits state :runner 1) (play-from-hand state :runner "Akamatsu Mem Chip") @@ -598,8 +546,8 @@ ;; Paperclip - prompt to install on encounter, but not if another is installed (testing "Basic test" (do-game - (new-game (default-corp ["Vanilla"]) - (default-runner [(qty "Paperclip" 2)])) + (new-game {:corp {:deck ["Vanilla"]} + :runner {:deck [(qty "Paperclip" 2)]}}) (play-from-hand state :corp "Vanilla" "Archives") (take-credits state :corp) (trash-from-hand state :runner "Paperclip") @@ -614,8 +562,8 @@ (is (empty? (:prompt (get-runner))) "No prompt to install second Paperclip"))) (testing "firing on facedown ice shouldn't crash" (do-game - (new-game (default-corp ["Vanilla"]) - (default-runner ["Paperclip"])) + (new-game {:corp {:deck ["Vanilla"]} + :runner {:deck ["Paperclip"]}}) (play-from-hand state :corp "Vanilla" "Archives") (take-credits state :corp) (play-from-hand state :runner "Paperclip") @@ -624,8 +572,8 @@ (click-prompt state :runner "0"))) (testing "do not show a second install prompt if user said No to first, when multiple are in heap" (do-game - (new-game (default-corp [(qty "Vanilla" 2)]) - (default-runner [(qty "Paperclip" 3)])) + (new-game {:corp {:deck [(qty "Vanilla" 2)]} + :runner {:deck [(qty "Paperclip" 3)]}}) (play-from-hand state :corp "Vanilla" "Archives") (play-from-hand state :corp "Vanilla" "Archives") (take-credits state :corp) @@ -650,8 +598,8 @@ (deftest peregrine ;; Peregrine - 2c to return to grip and derez an encountered code gate (do-game - (new-game (default-corp ["Paper Wall" (qty "Bandwidth" 2)]) - (default-runner ["Peregrine"])) + (new-game {:corp {:deck ["Paper Wall" (qty "Bandwidth" 2)]} + :runner {:deck ["Peregrine"]}}) (play-from-hand state :corp "Bandwidth" "Archives") (play-from-hand state :corp "Bandwidth" "Archives") (play-from-hand state :corp "Paper Wall" "Archives") @@ -679,9 +627,8 @@ ;; Persephone's ability trashes cards from R&D, triggering AR-Enhanced Security ;; See #3187 (do-game - (new-game - (default-corp ["Zed 1.0" (qty "Zed 2.0" 3) "AR-Enhanced Security"]) - (default-runner [(qty "Persephone" 10)])) + (new-game {:corp {:deck ["Zed 1.0" (qty "Zed 2.0" 3) "AR-Enhanced Security"]} + :runner {:deck [(qty "Persephone" 10)]}}) (core/move state :corp (find-card "Zed 2.0" (:hand (get-corp))) :deck) (core/move state :corp (find-card "Zed 2.0" (:hand (get-corp))) :deck) (play-from-hand state :corp "AR-Enhanced Security" "New remote") @@ -709,10 +656,9 @@ (deftest shiv ;; Shiv - Gain 1 strength for each installed breaker; no MU cost when 2+ link (do-game - (new-game - (default-corp) - (make-deck "Nasir Meidan: Cyber Explorer" ["Shiv" (qty "Inti" 2) - "Access to Globalsec"])) + (new-game {:runner {:id "Nasir Meidan: Cyber Explorer" + :deck ["Shiv" (qty "Inti" 2) + "Access to Globalsec"]}}) (is (= 1 (:link (get-runner))) "1 link") (take-credits state :corp) (play-from-hand state :runner "Shiv") @@ -730,60 +676,59 @@ (deftest snowball ;; Snowball - Strength boost until end of run when used to break a subroutine (do-game - (new-game (default-corp ["Spiderweb" "Fire Wall" "Hedge Fund"]) - (default-runner ["Snowball"])) - (play-from-hand state :corp "Hedge Fund") - (play-from-hand state :corp "Fire Wall" "HQ") - (play-from-hand state :corp "Spiderweb" "HQ") - (take-credits state :corp) - (core/gain state :runner :credit 10) - (play-from-hand state :runner "Snowball") - (let [sp (get-ice state :hq 1) - fw (get-ice state :hq 0) - snow (get-program state 0)] - (run-on state "HQ") - (core/rez state :corp sp) - (core/rez state :corp fw) - (card-ability state :runner snow 1) ; match strength - (is (= 2 (:current-strength (refresh snow)))) - (card-ability state :runner snow 0) ; strength matched, break a sub - (card-ability state :runner snow 0) ; break a sub - (is (= 4 (:current-strength (refresh snow))) "Broke 2 subs, gained 2 more strength") - (run-continue state) - (is (= 3 (:current-strength (refresh snow))) "Has +2 strength until end of run; lost 1 per-encounter boost") - (card-ability state :runner snow 1) - (card-ability state :runner snow 1) ; match strength - (is (= 5 (:current-strength (refresh snow))) "Matched strength, gained 2") - (card-ability state :runner snow 0) ; strength matched, break a sub - (is (= 6 (:current-strength (refresh snow))) "Broke 1 sub, gained 1 more strength") - (run-continue state) - (is (= 4 (:current-strength (refresh snow))) "+3 until-end-of-run strength") - (run-jack-out state) - (is (= 1 (:current-strength (refresh snow))) "Back to default strength")))) + (new-game {:corp {:deck ["Spiderweb" "Fire Wall" "Hedge Fund"]} + :runner {:deck ["Snowball"]}}) + (play-from-hand state :corp "Hedge Fund") + (play-from-hand state :corp "Fire Wall" "HQ") + (play-from-hand state :corp "Spiderweb" "HQ") + (take-credits state :corp) + (core/gain state :runner :credit 10) + (play-from-hand state :runner "Snowball") + (let [sp (get-ice state :hq 1) + fw (get-ice state :hq 0) + snow (get-program state 0)] + (run-on state "HQ") + (core/rez state :corp sp) + (core/rez state :corp fw) + (card-ability state :runner snow 1) ; match strength + (is (= 2 (:current-strength (refresh snow)))) + (card-ability state :runner snow 0) ; strength matched, break a sub + (card-ability state :runner snow 0) ; break a sub + (is (= 4 (:current-strength (refresh snow))) "Broke 2 subs, gained 2 more strength") + (run-continue state) + (is (= 3 (:current-strength (refresh snow))) "Has +2 strength until end of run; lost 1 per-encounter boost") + (card-ability state :runner snow 1) + (card-ability state :runner snow 1) ; match strength + (is (= 5 (:current-strength (refresh snow))) "Matched strength, gained 2") + (card-ability state :runner snow 0) ; strength matched, break a sub + (is (= 6 (:current-strength (refresh snow))) "Broke 1 sub, gained 1 more strength") + (run-continue state) + (is (= 4 (:current-strength (refresh snow))) "+3 until-end-of-run strength") + (run-jack-out state) + (is (= 1 (:current-strength (refresh snow))) "Back to default strength")))) (deftest study-guide ;; Study Guide - 2c to add a power counter; +1 strength per counter (do-game - (new-game (default-corp) - (default-runner ["Study Guide" "Sure Gamble"])) - (take-credits state :corp) - (play-from-hand state :runner "Sure Gamble") - (play-from-hand state :runner "Study Guide") - (let [sg (get-program state 0)] - (card-ability state :runner sg 1) - (is (= 4 (:credit (get-runner))) "Paid 2c") - (is (= 1 (get-counters (refresh sg) :power)) "Has 1 power counter") - (is (= 1 (:current-strength (refresh sg))) "1 strength") - (card-ability state :runner sg 1) - (is (= 2 (:credit (get-runner))) "Paid 2c") - (is (= 2 (get-counters (refresh sg) :power)) "Has 2 power counters") - (is (= 2 (:current-strength (refresh sg))) "2 strength")))) + (new-game {:runner {:deck ["Study Guide" "Sure Gamble"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Sure Gamble") + (play-from-hand state :runner "Study Guide") + (let [sg (get-program state 0)] + (card-ability state :runner sg 1) + (is (= 4 (:credit (get-runner))) "Paid 2c") + (is (= 1 (get-counters (refresh sg) :power)) "Has 1 power counter") + (is (= 1 (:current-strength (refresh sg))) "1 strength") + (card-ability state :runner sg 1) + (is (= 2 (:credit (get-runner))) "Paid 2c") + (is (= 2 (get-counters (refresh sg) :power)) "Has 2 power counters") + (is (= 2 (:current-strength (refresh sg))) "2 strength")))) (deftest tycoon ;; Tycoon (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Tycoon"])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Tycoon"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (core/rez state state :corp (get-ice state :hq 0)) (take-credits state :corp) @@ -799,25 +744,25 @@ (deftest wyrm ;; Wyrm reduces strength of ice (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Wyrm"])) - (play-from-hand state :corp "Ice Wall" "HQ") - (take-credits state :corp) - (play-from-hand state :runner "Wyrm") - (run-on state "HQ") - (let [ice-wall (get-ice state :hq 0) - wyrm (get-program state 0)] - (core/rez state :corp ice-wall) - (card-ability state :runner wyrm 1) - (is (zero? (:current-strength (refresh ice-wall))) "Strength of Ice Wall reduced to 0") - (card-ability state :runner wyrm 1) - (is (= -1 (:current-strength (refresh ice-wall))) "Strength of Ice Wall reduced to -1")))) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Wyrm"]}}) + (play-from-hand state :corp "Ice Wall" "HQ") + (take-credits state :corp) + (play-from-hand state :runner "Wyrm") + (run-on state "HQ") + (let [ice-wall (get-ice state :hq 0) + wyrm (get-program state 0)] + (core/rez state :corp ice-wall) + (card-ability state :runner wyrm 1) + (is (zero? (:current-strength (refresh ice-wall))) "Strength of Ice Wall reduced to 0") + (card-ability state :runner wyrm 1) + (is (= -1 (:current-strength (refresh ice-wall))) "Strength of Ice Wall reduced to -1")))) (deftest yusuf ;; Yusuf gains virus counters on successful runs and can spend virus counters from any installed card (do-game - (new-game (default-corp ["Fire Wall"]) - (default-runner ["Yusuf" "Cache"])) + (new-game {:corp {:deck ["Fire Wall"]} + :runner {:deck ["Yusuf" "Cache"]}}) (play-from-hand state :corp "Fire Wall" "HQ") (take-credits state :corp) (play-from-hand state :runner "Yusuf") diff --git a/test/clj/game_test/cards/identities.clj b/test/clj/game_test/cards/identities.clj index 3da7100965..a612a88078 100644 --- a/test/clj/game_test/cards/identities.clj +++ b/test/clj/game_test/cards/identities.clj @@ -1,22 +1,20 @@ (ns game-test.cards.identities (:require [game.core :as core] + [game.utils :as utils] [game-test.core :refer :all] [game-test.utils :refer :all] [game-test.macros :refer :all] [jinteki.utils :refer [count-tags is-tagged?]] [clojure.test :refer :all])) -(use-fixtures :once load-all-cards (partial reset-card-defs "identities")) - -(deftest ^{:card-title "419:-amoral-scammer"} +(deftest ^{:card-title "419-amoral-scammer"} FourHundredAndNineTeen-amoral-scammer ;; 419 (testing "basic test: Amoral Scammer - expose first installed card unless corp pays 1 credit" (do-game - (new-game - (make-deck "Weyland Consortium: Builder of Nations" - ["PAD Campaign" "The Cleaners" (qty "Pup" 3) "Oaktown Renovation"]) - (make-deck "419: Amoral Scammer" [])) + (new-game {:corp {:id "Weyland Consortium: Builder of Nations" + :deck ["PAD Campaign" "The Cleaners" (qty "Pup" 3) "Oaktown Renovation"]} + :runner {:id "419: Amoral Scammer"}}) (is (= 5 (:credit (get-corp))) "Starts with 5 credits") (play-from-hand state :corp "Pup" "HQ") (click-prompt state :runner "Yes") @@ -49,9 +47,9 @@ (is (last-log-contains? state "exposes PAD Campaign") "Installed card was exposed"))) (testing "Verify expose can be blocked" (do-game - (new-game - (make-deck "Weyland Consortium: Builder of Nations" ["Underway Grid" "Pup"]) - (make-deck "419: Amoral Scammer" [])) + (new-game {:corp {:id "Weyland Consortium: Builder of Nations" + :deck ["Underway Grid" "Pup"]} + :runner {:id "419: Amoral Scammer"}}) (play-from-hand state :corp "Underway Grid" "New remote") (click-prompt state :runner "No") (take-credits state :corp) @@ -64,8 +62,9 @@ (is (last-log-contains? state "uses Underway Grid to prevent 1 card from being exposed") "Exposure was prevented")))) (testing "Ixodidae shouldn't trigger off 419's ability" (do-game - (new-game (default-corp ["PAD Campaign"]) - (make-deck "419: Amoral Scammer" ["Ixodidae"])) + (new-game {:corp {:deck ["PAD Campaign"]} + :runner {:id "419: Amoral Scammer" + :deck ["Ixodidae"]}}) (take-credits state :corp) (play-from-hand state :runner "Ixodidae") (take-credits state :runner) @@ -77,12 +76,11 @@ (is (= 1 (- corp-credits (:credit (get-corp)))) "Should lose 1 credit from 419 ability") (is (zero? (- runner-credits (:credit (get-runner)))) "Should not gain any credits from Ixodidae"))))) -(deftest acme-consulting:-the-truth-you-need +(deftest acme-consulting-the-truth-you-need (testing "Tag gain when rezzing outermost ice" (do-game - (new-game - (make-deck "Acme Consulting: The Truth You Need" ["Vanilla" (qty "Hedge Fund" 5)]) - (default-runner)) + (new-game {:corp {:id "Acme Consulting: The Truth You Need" + :deck ["Vanilla" (qty "Hedge Fund" 5)]}}) (play-from-hand state :corp "Vanilla" "Archives") (take-credits state :corp) (run-on state :archives) @@ -93,9 +91,8 @@ (is (not (is-tagged? state)) "Runner no longer encountering outermost ice"))) (testing "Interaction with Data Ward" (do-game - (new-game - (make-deck "Acme Consulting: The Truth You Need" ["Data Ward" (qty "Hedge Fund" 5)]) - (default-runner)) + (new-game {:corp {:id "Acme Consulting: The Truth You Need" + :deck ["Data Ward" (qty "Hedge Fund" 5)]}}) (core/gain state :corp :credit 10) (play-from-hand state :corp "Data Ward" "Archives") (take-credits state :corp) @@ -107,9 +104,8 @@ (is (not (:run @state)) "Run ended by Data Ward"))) (testing "Tag gain when starting run" (do-game - (new-game - (make-deck "Acme Consulting: The Truth You Need" ["Vanilla" (qty "Hedge Fund" 5)]) - (default-runner)) + (new-game {:corp {:id "Acme Consulting: The Truth You Need" + :deck ["Vanilla" (qty "Hedge Fund" 5)]}}) (play-from-hand state :corp "Vanilla" "Archives") (core/rez state :corp (get-ice state :archives 0)) (take-credits state :corp) @@ -119,9 +115,8 @@ (is (not (is-tagged? state)) "Runner no longer encountering outermost ice"))) (testing "Tag loss when derezzing ice" (do-game - (new-game - (make-deck "Acme Consulting: The Truth You Need" ["Vanilla" (qty "Hedge Fund" 5)]) - (default-runner)) + (new-game {:corp {:id "Acme Consulting: The Truth You Need" + :deck ["Vanilla" (qty "Hedge Fund" 5)]}}) (play-from-hand state :corp "Vanilla" "Archives") (core/rez state :corp (get-ice state :archives 0)) (take-credits state :corp) @@ -131,17 +126,15 @@ (is (not (is-tagged? state)) "Runner no longer encountering the derezzed ice"))) (testing "No tag on empty server" (do-game - (new-game - (make-deck "Acme Consulting: The Truth You Need" ["Vanilla" (qty "Hedge Fund" 5)]) - (default-runner)) + (new-game {:corp {:id "Acme Consulting: The Truth You Need" + :deck ["Vanilla" (qty "Hedge Fund" 5)]}}) (take-credits state :corp) (run-on state :archives) (is (not (is-tagged? state)) "No ice to encounter"))) (testing "No tag when encountering second ice" (do-game - (new-game - (make-deck "Acme Consulting: The Truth You Need" [(qty "Vanilla" 2) (qty "Hedge Fund" 4)]) - (default-runner)) + (new-game {:corp {:id "Acme Consulting: The Truth You Need" + :deck [(qty "Vanilla" 2) (qty "Hedge Fund" 4)]}}) (play-from-hand state :corp "Vanilla" "Archives") (play-from-hand state :corp "Vanilla" "Archives") (core/rez state :corp (get-ice state :archives 0)) @@ -153,9 +146,8 @@ (is (not (is-tagged? state)) "Runner is not tagged when encountering second ice"))) (testing "Tag loss when runner jacks out" (do-game - (new-game - (make-deck "Acme Consulting: The Truth You Need" ["Vanilla" (qty "Hedge Fund" 5)]) - (default-runner)) + (new-game {:corp {:id "Acme Consulting: The Truth You Need" + :deck ["Vanilla" (qty "Hedge Fund" 5)]}}) (play-from-hand state :corp "Vanilla" "Archives") (core/rez state :corp (get-ice state :archives 0)) (take-credits state :corp) @@ -166,8 +158,8 @@ (testing "No tag gained when rezzing something other than ice" (do-game (new-game - (make-deck "Acme Consulting: The Truth You Need" ["Vanilla" "NGO Front"]) - (default-runner)) + {:corp {:id "Acme Consulting: The Truth You Need" + :deck ["Vanilla" "NGO Front"]}}) (play-from-hand state :corp "Vanilla" "Archives") (play-from-hand state :corp "NGO Front" "New remote") (take-credits state :corp) @@ -181,14 +173,13 @@ (run-continue state) (is (not (is-tagged? state)) "Runner is not tagged when encountering second ice")))) -(deftest adam:-compulsive-hacker +(deftest adam-compulsive-hacker ;; Adam (testing "Allow runner to choose directives" (do-game - (new-game - (default-corp) - (make-deck "Adam: Compulsive Hacker" [(qty "Sure Gamble" 3)]) - {:dont-start-game true}) + (new-game {:runner {:id "Adam: Compulsive Hacker" + :deck [(qty "Sure Gamble" 3)]} + :options {:dont-start-game true}}) (is (= 4 (count (get-in @state [:runner :play-area]))) "All directives are in the runner's play area") (is (zero? (count (get-in @state [:runner :hand])))) (click-card state :runner (find-card "Neutralize All Threats" (get-in @state [:runner :play-area]))) @@ -202,10 +193,11 @@ (is (and nat sf abr) "The chosen directives were installed")))) (testing "Directives should not grant Pālanā credits" (do-game - (new-game - (make-deck "Pālanā Foods: Sustainable Growth" [(qty "Hedge Fund" 3)]) - (make-deck "Adam: Compulsive Hacker" [(qty "Sure Gamble" 3)]) - {:dont-start-game true}) + (new-game {:corp {:id "Pālanā Foods: Sustainable Growth" + :deck [(qty "Hedge Fund" 3)]} + :runner {:id "Adam: Compulsive Hacker" + :deck [(qty "Sure Gamble" 3)]} + :options {:dont-start-game true}}) (click-card state :runner (find-card "Neutralize All Threats" (get-in @state [:runner :play-area]))) (click-card state :runner (find-card "Safety First" (get-in @state [:runner :play-area]))) (click-card state :runner (find-card "Always Be Running" (get-in @state [:runner :play-area]))) @@ -215,10 +207,10 @@ (is (= 5 (:credit (get-corp))) "Pālanā does not gain credit from Adam's starting Directives"))) (testing "Neutralize All Threats interaction with advanceable traps" (do-game - (new-game - (default-corp [(qty "Cerebral Overwriter" 3)]) - (make-deck "Adam: Compulsive Hacker" [(qty "Sure Gamble" 3)]) - {:dont-start-game true}) + (new-game {:corp {:deck [(qty "Cerebral Overwriter" 3)]} + :runner {:id "Adam: Compulsive Hacker" + :deck [(qty "Sure Gamble" 3)]} + :options {:dont-start-game true}}) (click-card state :runner (find-card "Neutralize All Threats" (get-in @state [:runner :play-area]))) (click-card state :runner (find-card "Safety First" (get-in @state [:runner :play-area]))) (click-card state :runner (find-card "Always Be Running" (get-in @state [:runner :play-area]))) @@ -234,12 +226,13 @@ (is (= 2 (:brain-damage (get-runner))) "Runner took 2 brain damage") (is (= 1 (count (:discard (get-corp)))) "1 card in archives")))) -(deftest akiko-nisei:-head-case +(deftest akiko-nisei-head-case ;; Akiko Nisei (testing "Basic test" (do-game - (new-game (default-corp [(qty "Hedge Fund" 10)]) - (make-deck "Akiko Nisei: Head Case" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Hedge Fund" 10)]} + :runner {:id "Akiko Nisei: Head Case" + :deck [(qty "Sure Gamble" 3)]}}) (take-credits state :corp) (run-on state :rd) (run-successful state) @@ -255,8 +248,9 @@ (is (= 1 (core/access-count state :runner :rd-access)) "Should only access 1 from missed psi game"))) (testing "Shiro interaction: second sub should give Akiko 2 accesses" (do-game - (new-game (default-corp [(qty "Hedge Fund" 10) "Shiro"]) - (make-deck "Akiko Nisei: Head Case" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Hedge Fund" 10) "Shiro"]} + :runner {:id "Akiko Nisei: Head Case" + :deck [(qty "Sure Gamble" 3)]}}) (starting-hand state :corp ["Shiro"]) (play-from-hand state :corp "Shiro" "New remote") (let [shiro (get-ice state :remote1 0)] @@ -275,12 +269,11 @@ (click-prompt state :runner "0 [Credits]") (is (= 1 (core/access-count state :runner :rd-access)) "Should only access 1 from missed psi game"))))) -(deftest alice-merchant:-clan-agitator +(deftest alice-merchant-clan-agitator ;; Alice Merchant (do-game - (new-game (default-corp) - (make-deck "Alice Merchant: Clan Agitator" - ["Security Testing"])) + (new-game {:runner {:id "Alice Merchant: Clan Agitator" + :deck ["Security Testing"]}}) ; (trash-from-hand state :corp "Hostile Takeover") (take-credits state :corp) (play-from-hand state :runner "Security Testing") @@ -293,39 +286,37 @@ (is (= 1 (-> (get-corp) :discard count)) "Alice ability should trash 1 card from HQ") (is (-> (get-corp) :discard first :seen not) "Discarded card should be facedown when access is replaced"))) -(deftest andromeda:-dispossessed-ristie +(deftest andromeda-dispossessed-ristie ;; Andromeda - 9 card starting hand, 1 link (testing "Basic test" (do-game - (new-game - (default-corp) - (make-deck "Andromeda: Dispossessed Ristie" [(qty "Sure Gamble" 3) (qty "Desperado" 3) - (qty "Security Testing" 3) (qty "Bank Job" 3)])) + (new-game {:runner {:id "Andromeda: Dispossessed Ristie" + :deck [(qty "Sure Gamble" 3) (qty "Desperado" 3) + (qty "Security Testing" 3) (qty "Bank Job" 3)]}}) (is (= 1 (:link (get-runner))) "1 link") (is (= 9 (count (:hand (get-runner)))) "9 cards in Andromeda starting hand"))) (testing "9 card starting hand after mulligan" (do-game - (new-game - (default-corp) - (make-deck "Andromeda: Dispossessed Ristie" [(qty "Sure Gamble" 3) (qty "Desperado" 3) - (qty "Security Testing" 3) (qty "Bank Job" 3)]) - {:mulligan :runner}) + (new-game {:runner {:id "Andromeda: Dispossessed Ristie" + :deck [(qty "Sure Gamble" 3) (qty "Desperado" 3) + (qty "Security Testing" 3) (qty "Bank Job" 3)]} + :options {:mulligan :runner}}) (is (= 1 (:link (get-runner))) "1 link") (is (= 9 (count (:hand (get-runner)))) "9 cards in Andromeda starting hand"))) (testing "should not grant Palana credits" (do-game - (new-game - (make-deck "Pālanā Foods: Sustainable Growth" [(qty "Hedge Fund" 3)]) - (make-deck "Andromeda: Dispossessed Ristie" [(qty "Sure Gamble" 3) (qty "Desperado" 3) - (qty "Security Testing" 3) (qty "Bank Job" 3)])) + (new-game {:corp {:id "Pālanā Foods: Sustainable Growth" + :deck [(qty "Hedge Fund" 3)]} + :runner {:id "Andromeda: Dispossessed Ristie" + :deck [(qty "Sure Gamble" 3) (qty "Desperado" 3) + (qty "Security Testing" 3) (qty "Bank Job" 3)]}}) (is (= 5 (:credit (get-corp))) "Palana does not gain credit from Andromeda's starting hand")))) -(deftest apex:-invasive-predator +(deftest apex-invasive-predator ;; Apex - Allow facedown install of a second console. Issue #1326 (do-game - (new-game - (default-corp) - (make-deck "Apex: Invasive Predator" [(qty "Heartbeat" 2)])) + (new-game {:runner {:id "Apex: Invasive Predator" + :deck [(qty "Heartbeat" 2)]}}) (take-credits state :corp) (core/end-phase-12 state :runner nil) (click-prompt state :runner "Done") ; no facedown install on turn 1 @@ -337,12 +328,11 @@ (click-card state :runner (find-card "Heartbeat" (:hand (get-runner)))) (is (= 1 (count (get-runner-facedown state))) "2nd console installed facedown"))) -(deftest asa-group:-security-through-vigilance +(deftest asa-group-security-through-vigilance (testing "Asa Group should not allow installing operations" (do-game - (new-game - (make-deck "Asa Group: Security Through Vigilance" ["Pup" "BOOM!" "Urban Renewal"]) - (default-runner)) + (new-game {:corp {:id "Asa Group: Security Through Vigilance" + :deck ["Pup" "BOOM!" "Urban Renewal"]}}) (play-from-hand state :corp "Pup" "New remote") (click-card state :corp (find-card "BOOM!" (:hand (get-corp)))) (is (empty? (get-content state :remote1)) "Asa Group installed an event in a server") @@ -350,9 +340,8 @@ (is (= "Urban Renewal" (:title (get-content state :remote1 0))) "Asa Group can install an asset in a remote"))) (testing "Asa Group should not allow installing agendas" (do-game - (new-game - (make-deck "Asa Group: Security Through Vigilance" ["Pup" "Project Vitruvius" "Urban Renewal"]) - (default-runner)) + (new-game {:corp {:id "Asa Group: Security Through Vigilance" + :deck ["Pup" "Project Vitruvius" "Urban Renewal"]}}) (play-from-hand state :corp "Pup" "New remote") (click-card state :corp (find-card "Project Vitruvius" (:hand (get-corp)))) (is (empty? (get-content state :remote1)) "Asa Group did not install Agenda with its ability") @@ -360,13 +349,12 @@ (is (= "Urban Renewal" (:title (get-content state :remote1 0))) "Asa Group can install an asset in a remote"))) (testing "Asa Group ordering correct when playing Mirrormorph" (do-game - (new-game - (make-deck "Asa Group: Security Through Vigilance" ["Shipment from MirrorMorph" - "Pup" - "Red Herrings" - "Marilyn Campaign" - "Project Vitruvius"]) - (default-runner)) + (new-game {:corp {:id "Asa Group: Security Through Vigilance" + :deck ["Shipment from MirrorMorph" + "Pup" + "Red Herrings" + "Marilyn Campaign" + "Project Vitruvius"]}}) (let [marilyn (find-card "Marilyn Campaign" (:hand (get-corp))) pup (find-card "Pup" (:hand (get-corp))) herrings (find-card "Red Herrings" (:hand (get-corp))) @@ -385,25 +373,22 @@ (is (= 6 (count (:servers (get-corp)))) "There are six servers, including centrals")))) (testing "don't allow installation of operations" (do-game - (new-game - (make-deck "Asa Group: Security Through Vigilance" ["Pup" "BOOM!" "Urban Renewal"]) - (default-runner)) + (new-game {:corp {:id "Asa Group: Security Through Vigilance" + :deck ["Pup" "BOOM!" "Urban Renewal"]}}) (play-from-hand state :corp "Pup" "New remote") (click-card state :corp (find-card "BOOM!" (:hand (get-corp)))) (is (empty? (get-content state :remote1)) "Asa Group installed an event in a server") (click-card state :corp (find-card "Urban Renewal" (:hand (get-corp)))) (is (= "Urban Renewal" (:title (get-content state :remote1 0))) "Asa Group can install an asset in a remote")))) -(deftest ^{:card-title "ayla-\"bios\"-rahim:-simulant-specialist"} - ayla +(deftest ayla-bios-rahim-simulant-specialist ;; Ayla - choose & use cards for NVRAM (do-game - (new-game - (default-corp) - (make-deck "Ayla \"Bios\" Rahim: Simulant Specialist" ["Sure Gamble" "Desperado" - "Security Testing" "Bank Job" - "Heartbeat" "Eater"]) - {:dont-start-game true}) + (new-game {:runner {:id "Ayla \"Bios\" Rahim: Simulant Specialist" + :deck ["Sure Gamble" "Desperado" + "Security Testing" "Bank Job" + "Heartbeat" "Eater"]} + :options {:dont-start-game true}}) (is (= 6 (count (get-in @state [:runner :play-area]))) "Deck cards are in play area") (is (zero? (count (get-in @state [:runner :hand])))) (click-card state :runner (find-card "Sure Gamble" (get-in @state [:runner :play-area]))) @@ -420,31 +405,29 @@ (click-prompt state :runner (find-card "Bank Job" (:hosted (:identity (get-runner))))) (is (= 3 (count (get-in @state [:runner :hand]))) "There are 3 cards in the runner's Grip"))) -(deftest cerebral-imaging:-infinite-frontiers +(deftest cerebral-imaging-infinite-frontiers ;; Cerebral Imaging - Maximum hand size equal to credits (do-game - (new-game - (make-deck "Cerebral Imaging: Infinite Frontiers" [(qty "Hedge Fund" 3)]) - (default-runner)) + (new-game {:corp {:id "Cerebral Imaging: Infinite Frontiers" + :deck [(qty "Hedge Fund" 3)]}}) (play-from-hand state :corp "Hedge Fund") (play-from-hand state :corp "Hedge Fund") (is (= 13 (:credit (get-corp))) "Has 13 credits") (is (= 13 (core/hand-size state :corp)) "Max hand size is 13"))) -(deftest chaos-theory:-wunderkind +(deftest chaos-theory-wunderkind ;; Chaos Theory, start with +1 MU (do-game - (new-game (default-corp) - (make-deck "Chaos Theory: Wünderkind" [])) + (new-game {:runner {:id "Chaos Theory: Wünderkind"}}) (is (= 5 (core/available-mu state)) "Chaos Theory starts the game with +1 MU"))) -(deftest chronos-protocol:-selective-mind-mapping +(deftest chronos-protocol-selective-mind-mapping ;; Chronos Protocol - Choose Runner discard for first net damage of a turn (testing "Basic test" (do-game - (new-game - (make-deck "Chronos Protocol: Selective Mind-mapping" ["Pup" (qty "Neural EMP" 2)]) - (default-runner [(qty "Imp" 3)])) + (new-game {:corp {:id "Chronos Protocol: Selective Mind-mapping" + :deck ["Pup" (qty "Neural EMP" 2)]} + :runner {:deck [(qty "Imp" 3)]}}) (play-from-hand state :corp "Pup" "HQ") (take-credits state :corp) (run-on state :hq) @@ -469,8 +452,9 @@ (is (= 3 (count (:discard (get-runner))))))))) (testing "with Obokata: Pay 4 net damage to steal. Only 3 damage left after Chronos. No trigger of damage prevent." (do-game - (new-game (make-deck "Chronos Protocol: Selective Mind-mapping" [(qty "Obokata Protocol" 5)]) - (default-runner [(qty "Sure Gamble" 3) "Inti" "Feedback Filter"])) + (new-game {:corp {:id "Chronos Protocol: Selective Mind-mapping" + :deck [(qty "Obokata Protocol" 5)]} + :runner {:deck [(qty "Sure Gamble" 3) "Inti" "Feedback Filter"]}}) (core/gain state :runner :credit 10) (play-from-hand state :corp "Obokata Protocol" "New remote") (take-credits state :corp) @@ -483,9 +467,9 @@ (is (= 4 (count (:discard (get-runner)))) "Runner paid 4 net damage"))) (testing "vs Employee Strike. Issue #1958" (do-game - (new-game - (make-deck "Chronos Protocol: Selective Mind-mapping" ["Pup"]) - (default-runner ["Employee Strike" (qty "Scrubbed" 3) "Sure Gamble"])) + (new-game {:corp {:id "Chronos Protocol: Selective Mind-mapping" + :deck ["Pup"]} + :runner {:deck ["Employee Strike" (qty "Scrubbed" 3) "Sure Gamble"]}}) (play-from-hand state :corp "Pup" "HQ") (take-credits state :corp) (play-from-hand state :runner "Employee Strike") @@ -504,13 +488,13 @@ (card-subroutine state :corp pup 0) (is (not (empty? (:prompt (get-corp)))) "Employee Strike out of play - Ability turned on correctly"))))) -(deftest edward-kim:-humanity's-hammer +(deftest edward-kim-humanity-s-hammer ;; Edward Kim (testing "Trash first operation accessed each turn, but not if first one was in Archives" (do-game - (new-game - (default-corp [(qty "Hedge Fund" 3) (qty "Restructure" 2) "PAD Campaign"]) - (make-deck "Edward Kim: Humanity's Hammer" ["Eater" (qty "Sure Gamble" 2)])) + (new-game {:corp {:deck [(qty "Hedge Fund" 3) (qty "Restructure" 2) "PAD Campaign"]} + :runner {:id "Edward Kim: Humanity's Hammer" + :deck ["Eater" (qty "Sure Gamble" 2)]}}) (play-from-hand state :corp "Hedge Fund") (trash-from-hand state :corp "PAD Campaign") (take-credits state :corp) @@ -537,9 +521,9 @@ (is (= 4 (count (:discard (get-corp)))) "1 operation trashed from HQ; accessed non-operation in Archives first")))) (testing "Do not trigger maw on first Operation access (due to trash)" (do-game - (new-game - (default-corp [(qty "Hedge Fund" 3) (qty "Restructure" 2)]) - (make-deck "Edward Kim: Humanity's Hammer" ["Maw" (qty "Sure Gamble" 2)])) + (new-game {:corp {:deck [(qty "Hedge Fund" 3) (qty "Restructure" 2)]} + :runner {:id "Edward Kim: Humanity's Hammer" + :deck ["Maw" (qty "Sure Gamble" 2)]}}) (take-credits state :corp) (play-from-hand state :runner "Sure Gamble") (play-from-hand state :runner "Maw") @@ -550,14 +534,13 @@ (click-prompt state :runner "No action") (is (= 2 (count (:discard (get-corp)))) "One more card trashed from HQ, by Maw")))) -(deftest exile:-streethawk +(deftest exile-streethawk ;; Exile (testing "Simultaneous-resolution prompt shown for interaction with Customized Secretary" (do-game - (new-game - (default-corp) - (make-deck "Exile: Streethawk" [(qty "Customized Secretary" 3) (qty "Clone Chip" 3) - (qty "Sure Gamble" 3)])) + (new-game {:runner {:id "Exile: Streethawk" + :deck [(qty "Customized Secretary" 3) (qty "Clone Chip" 3) + (qty "Sure Gamble" 3)]}}) (take-credits state :corp) (starting-hand state :runner ["Customized Secretary" "Clone Chip"]) (trash-from-hand state :runner "Customized Secretary") @@ -569,13 +552,14 @@ (click-prompt state :runner "Exile: Streethawk") (is (= 1 (count (:hand (get-runner)))) "Exile drew a card")))) -(deftest freedom-khumalo:-crypto-anarchist +(deftest freedom-khumalo-crypto-anarchist ;; Freedom Khumalo - Can spend virus counters from other cards to trash accessed cards with play/rez costs (testing "Only works with Assets, ICE, Operations, and Upgrades" (letfn [(fk-test [card] (do-game - (new-game (default-corp [card]) - (make-deck "Freedom Khumalo: Crypto-Anarchist" ["Cache"])) + (new-game {:corp {:deck [card]} + :runner {:id "Freedom Khumalo: Crypto-Anarchist" + :deck ["Cache"]}}) (take-credits state :corp) (play-from-hand state :runner "Cache") (run-empty-server state "HQ") @@ -592,8 +576,9 @@ (testing "Triggers when play/rez cost less than or equal to number of available virus counters" (letfn [(fk-test [card] (do-game - (new-game (default-corp [card]) - (make-deck "Freedom Khumalo: Crypto-Anarchist" ["Cache"])) + (new-game {:corp {:deck [card]} + :runner {:id "Freedom Khumalo: Crypto-Anarchist" + :deck ["Cache"]}}) (take-credits state :corp) (play-from-hand state :runner "Cache") (run-empty-server state "HQ") @@ -612,8 +597,9 @@ (testing "Doesn't trigger when there aren't enough available virus counters" (letfn [(fk-test [card] (do-game - (new-game (default-corp [card]) - (make-deck "Freedom Khumalo: Crypto-Anarchist" ["Cache"])) + (new-game {:corp {:deck [card]} + :runner {:id "Freedom Khumalo: Crypto-Anarchist" + :deck ["Cache"]}}) (take-credits state :corp) (play-from-hand state :runner "Cache") (run-empty-server state "HQ") @@ -626,9 +612,9 @@ "Tyrant"])))) (testing "Can use multiple programs for virus counter payment" (do-game - (new-game (default-corp ["Dedicated Response Team"]) - (make-deck "Freedom Khumalo: Crypto-Anarchist" - ["Cache" "Virus Breeding Ground"])) + (new-game {:corp {:deck ["Dedicated Response Team"]} + :runner {:id "Freedom Khumalo: Crypto-Anarchist" + :deck ["Cache" "Virus Breeding Ground"]}}) (take-credits state :corp) (play-from-hand state :runner "Cache") (play-from-hand state :runner "Virus Breeding Ground") @@ -642,8 +628,9 @@ (str "Accessed Dedicated Response Team should have been trashed after selecting 2 virus counters")))) (testing "Can use viruses on hosted cards" (do-game - (new-game (default-corp [(qty "Ice Wall" 2)]) - (make-deck "Freedom Khumalo: Crypto-Anarchist" ["Trypano"])) + (new-game {:corp {:deck [(qty "Ice Wall" 2)]} + :runner {:id "Freedom Khumalo: Crypto-Anarchist" + :deck ["Trypano"]}}) (play-from-hand state :corp "Ice Wall" "R&D") (let [iw (get-ice state :rd 0)] (take-credits state :corp) @@ -658,98 +645,102 @@ (is (= 1 (count (:discard (get-corp)))) "Accessed Ice Wall should be discarded after selecting 1 virus counter"))) (testing "Doesn't trigger when accessing an Agenda" (do-game - (new-game (default-corp ["Hostile Takeover"]) - (make-deck "Freedom Khumalo: Crypto-Anarchist" ["Cache"])) + (new-game {:corp {:deck ["Hostile Takeover"]} + :runner {:id "Freedom Khumalo: Crypto-Anarchist" + :deck ["Cache"]}}) (take-credits state :corp) (play-from-hand state :runner "Cache") (run-empty-server state "HQ") (is (= 1 (->> @state :runner :prompt first :choices count)) "Should only have 1 option") (is (= "Steal" (-> @state :runner :prompt first :choices first)) "Only option should be 'Steal'"))) - (testing "Shows multiple prompts when playing Imp" - (do-game - (new-game (default-corp ["Dedicated Response Team"]) - (make-deck "Freedom Khumalo: Crypto-Anarchist" - ["Sure Gamble" "Cache" "Imp"])) - (take-credits state :corp) - (play-from-hand state :runner "Sure Gamble") - (play-from-hand state :runner "Cache") - (play-from-hand state :runner "Imp") - (run-empty-server state "HQ") - (is (= 4 (-> @state :runner :prompt first :choices count)) "Should have 4 options: Freedom, Imp, Trash, No action"))) - (testing "Should return to access prompts when Done is pressed" - (do-game - (new-game (default-corp ["Dedicated Response Team"]) - (make-deck "Freedom Khumalo: Crypto-Anarchist" ["Cache"])) - (take-credits state :corp) - (play-from-hand state :runner "Cache") - (run-empty-server state "HQ") - (is (= 3 (->> @state :runner :prompt first :choices count)) "Should have 3 choices: Freedom, Trash, No action") - (click-prompt state :runner "[Freedom]: Trash card") - (click-card state :runner (get-program state 0)) - (click-prompt state :runner "Done") - (is (= 3 (-> @state :runner :prompt first :choices count)) - (str "Should go back to access prompts, with 3 choices: Freedom, Trash, No action. " - "Choices seen: " (-> @state :runner :prompt first :choices))) - (click-prompt state :runner "[Freedom]: Trash card") - (click-card state :runner (get-program state 0)) - (click-card state :runner (get-program state 0)) - (is (= 1 (count (:discard (get-corp)))) "Card should now be properly discarded"))) - (testing "Shouldn't grant additional accesses after trashing accessed card. #3423" - (do-game - (new-game (default-corp [(qty "Ice Wall" 10)]) - (make-deck "Freedom Khumalo: Crypto-Anarchist" ["Cache"])) - (take-credits state :corp) - (play-from-hand state :runner "Cache") - (run-empty-server state "R&D") - (click-prompt state :runner "[Freedom]: Trash card") - (click-card state :runner (get-program state 0)) - (is (= 1 (count (:discard (get-corp)))) "Accessed Ice Wall should be discarded now") - (is (not (:run @state)) "Run ended"))) - (testing "Shouldn't give Aumakua additional counters on trash. #3479" - (do-game - (new-game (default-corp [(qty "Ice Wall" 10)]) - (make-deck "Freedom Khumalo: Crypto-Anarchist" ["Cache" "Aumakua"])) - (take-credits state :corp) - (play-from-hand state :runner "Cache") - (play-from-hand state :runner "Aumakua") - (run-empty-server state "R&D") - (is (zero? (get-counters (get-program state 1) :virus)) "Aumakuma shouldn't have any virus counters yet.") - (click-prompt state :runner "[Freedom]: Trash card") - (click-card state :runner (get-program state 0)) - (is (= 1 (count (:discard (get-corp)))) "Ice Wall should be discarded now") - (is (zero? (get-counters (get-program state 1) :virus)) "Aumakua doesn't gain any virus counters from trash ability.") - (is (not (:run @state)) "Run ended"))) - (testing "interaction with trash-cost-bonuses, and declining ability once initiated" - (do-game - (new-game (default-corp ["The Board"]) - (make-deck "Freedom Khumalo: Crypto-Anarchist" ["Skulljack" "Imp" "Sure Gamble"])) - (play-from-hand state :corp "The Board" "New remote") - (take-credits state :corp) - (run-empty-server state "Server 1") - (is (= 1 (-> (get-runner) :prompt first :choices count)) "Runner doesn't have enough credits to trash") - (click-prompt state :runner "No action") - (play-from-hand state :runner "Imp") - (core/add-counter state :runner (get-program state 0) :virus 5) - (play-from-hand state :runner "Skulljack") - (take-credits state :runner) - (take-credits state :corp) - (run-empty-server state "Server 1") - (is (= 6 (core/trash-cost state :runner (get-content state :remote1 0))) "The Board should cost 6 to trash") - (is (= 3 (-> (get-runner) :prompt first :choices count)) "Runner can use Freedom or Imp to trash") - (click-prompt state :runner "[Freedom]: Trash card") - (click-card state :runner (get-program state 0)) - (click-prompt state :runner "Done") - (is (= 6 (core/trash-cost state :runner (get-content state :remote1 0))) "Skulljack shouldn't trigger a second time") - (is (= 3 (-> (get-runner) :prompt first :choices count)) "Runner can still use Freedom or Imp the second time around") - (click-prompt state :runner "[Imp]: Trash card") - (is (= 2 (:agenda-point (get-runner))) "Runner should trash The Board with Imp and gain 2 agenda points")))) - -(deftest gabriel-santiago:-consummate-professional +(testing "Shows multiple prompts when playing Imp" + (do-game + (new-game {:corp {:deck ["Dedicated Response Team"]} + :runner {:id "Freedom Khumalo: Crypto-Anarchist" + :deck ["Sure Gamble" "Cache" "Imp"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Sure Gamble") + (play-from-hand state :runner "Cache") + (play-from-hand state :runner "Imp") + (run-empty-server state "HQ") + (is (= 4 (-> @state :runner :prompt first :choices count)) "Should have 4 options: Freedom, Imp, Trash, No action"))) +(testing "Should return to access prompts when Done is pressed" + (do-game + (new-game {:corp {:deck ["Dedicated Response Team"]} + :runner {:id "Freedom Khumalo: Crypto-Anarchist" + :deck ["Cache"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Cache") + (run-empty-server state "HQ") + (is (= 3 (->> @state :runner :prompt first :choices count)) "Should have 3 choices: Freedom, Trash, No action") + (click-prompt state :runner "[Freedom]: Trash card") + (click-card state :runner (get-program state 0)) + (click-prompt state :runner "Done") + (is (= 3 (-> @state :runner :prompt first :choices count)) + (str "Should go back to access prompts, with 3 choices: Freedom, Trash, No action. " + "Choices seen: " (-> @state :runner :prompt first :choices))) + (click-prompt state :runner "[Freedom]: Trash card") + (click-card state :runner (get-program state 0)) + (click-card state :runner (get-program state 0)) + (is (= 1 (count (:discard (get-corp)))) "Card should now be properly discarded"))) +(testing "Shouldn't grant additional accesses after trashing accessed card. #3423" + (do-game + (new-game {:corp {:deck [(qty "Ice Wall" 10)]} + :runner {:id "Freedom Khumalo: Crypto-Anarchist" + :deck ["Cache"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Cache") + (run-empty-server state "R&D") + (click-prompt state :runner "[Freedom]: Trash card") + (click-card state :runner (get-program state 0)) + (is (= 1 (count (:discard (get-corp)))) "Accessed Ice Wall should be discarded now") + (is (not (:run @state)) "Run ended"))) +(testing "Shouldn't give Aumakua additional counters on trash. #3479" + (do-game + (new-game {:corp {:deck [(qty "Ice Wall" 10)]} + :runner {:id "Freedom Khumalo: Crypto-Anarchist" + :deck ["Cache" "Aumakua"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Cache") + (play-from-hand state :runner "Aumakua") + (run-empty-server state "R&D") + (is (zero? (get-counters (get-program state 1) :virus)) "Aumakuma shouldn't have any virus counters yet.") + (click-prompt state :runner "[Freedom]: Trash card") + (click-card state :runner (get-program state 0)) + (is (= 1 (count (:discard (get-corp)))) "Ice Wall should be discarded now") + (is (zero? (get-counters (get-program state 1) :virus)) "Aumakua doesn't gain any virus counters from trash ability.") + (is (not (:run @state)) "Run ended"))) +(testing "interaction with trash-cost-bonuses, and declining ability once initiated" + (do-game + (new-game {:corp {:deck ["The Board"]} + :runner {:id "Freedom Khumalo: Crypto-Anarchist" + :deck ["Skulljack" "Imp" "Sure Gamble"]}}) + (play-from-hand state :corp "The Board" "New remote") + (take-credits state :corp) + (run-empty-server state "Server 1") + (is (= 1 (-> (get-runner) :prompt first :choices count)) "Runner doesn't have enough credits to trash") + (click-prompt state :runner "No action") + (play-from-hand state :runner "Imp") + (core/add-counter state :runner (get-program state 0) :virus 5) + (play-from-hand state :runner "Skulljack") + (take-credits state :runner) + (take-credits state :corp) + (run-empty-server state "Server 1") + (is (= 6 (core/trash-cost state :runner (get-content state :remote1 0))) "The Board should cost 6 to trash") + (is (= 3 (-> (get-runner) :prompt first :choices count)) "Runner can use Freedom or Imp to trash") + (click-prompt state :runner "[Freedom]: Trash card") + (click-card state :runner (get-program state 0)) + (click-prompt state :runner "Done") + (is (= 6 (core/trash-cost state :runner (get-content state :remote1 0))) "Skulljack shouldn't trigger a second time") + (is (= 3 (-> (get-runner) :prompt first :choices count)) "Runner can still use Freedom or Imp the second time around") + (click-prompt state :runner "[Imp]: Trash card") + (is (= 2 (:agenda-point (get-runner))) "Runner should trash The Board with Imp and gain 2 agenda points")))) + +(deftest gabriel-santiago-consummate-professional ;; Gabriel Santiago - Gain 2c on first successful HQ run each turn (do-game - (new-game - (default-corp) - (make-deck "Gabriel Santiago: Consummate Professional" ["Easy Mark"])) + (new-game {:runner {:id "Gabriel Santiago: Consummate Professional" + :deck ["Easy Mark"]}}) (take-credits state :corp) (run-empty-server state :rd) (is (= 5 (:credit (get-runner))) "No credits gained") @@ -758,12 +749,11 @@ (run-empty-server state :hq) (is (= 7 (:credit (get-runner))) "No credits gained"))) -(deftest gagarin-deep-space:-expanding-the-horizon +(deftest gagarin-deep-space-expanding-the-horizon ;; Gagarin - pay 1c to access each card in remote (do-game - (new-game - (make-deck "Gagarin Deep Space: Expanding the Horizon" ["PAD Campaign" "Caprice Nisei"]) - (default-runner)) + (new-game {:corp {:id "Gagarin Deep Space: Expanding the Horizon" + :deck ["PAD Campaign" "Caprice Nisei"]}}) (core/lose state :runner :credit 4) (is (= 1 (:credit (get-runner))) "Runner has 1 credit") (play-from-hand state :corp "PAD Campaign" "New remote") @@ -782,30 +772,30 @@ (click-prompt state :runner "No action") ; Dismiss trash prompt (is (last-log-contains? state "Caprice") "Accessed card name was logged"))) -(deftest grndl:-power-unleashed +(deftest grndl-power-unleashed ;; GRNDL: Power Unleashed - start game with 10 credits and 1 bad pub. (testing "Basic test" (do-game - (new-game - (make-deck "GRNDL: Power Unleashed" [(qty "Hedge Fund" 3)]) - (default-runner)) + (new-game {:corp {:id "GRNDL: Power Unleashed" + :deck [(qty "Hedge Fund" 3)]}}) (is (= 10 (:credit (get-corp))) "GRNDL starts with 10 credits") (is (= 1 (:bad-publicity (get-corp))) "GRNDL starts with 1 bad publicity"))) (testing "vs Valencia - only 1 bad pub at start" (do-game - (new-game - (make-deck "GRNDL: Power Unleashed" [(qty "Hedge Fund" 3)]) - (make-deck "Valencia Estevez: The Angel of Cayambe" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:id "GRNDL: Power Unleashed" + :deck [(qty "Hedge Fund" 3)]} + :runner {:id "Valencia Estevez: The Angel of Cayambe" + :deck [(qty "Sure Gamble" 3)]}}) (is (= 10 (:credit (get-corp))) "GRNDL starts with 10 credits") (is (= 1 (:bad-publicity (get-corp))) "GRNDL starts with 1 bad publicity")))) -(deftest haarpsichord-studios:-entertainment-unleashed +(deftest haarpsichord-studios-entertainment-unleashed ;; Haarpsichord Studios (testing "Prevent stealing more than 1 agenda per turn" (do-game - (new-game - (make-deck "Haarpsichord Studios: Entertainment Unleashed" [(qty "15 Minutes" 3)]) - (default-runner ["Gang Sign"])) + (new-game {:corp {:id "Haarpsichord Studios: Entertainment Unleashed" + :deck [(qty "15 Minutes" 3)]} + :runner {:deck ["Gang Sign"]}}) (take-credits state :corp) (play-from-hand state :runner "Gang Sign") (run-empty-server state "HQ") @@ -822,9 +812,9 @@ (is (= 2 (:agenda-point (get-runner))) "Steal prevention didn't carry over to Corp turn"))) (testing "Interactions with Employee Strike. Issue #1313" (do-game - (new-game - (make-deck "Haarpsichord Studios: Entertainment Unleashed" [(qty "15 Minutes" 3)]) - (default-runner ["Employee Strike" "Scrubbed"])) + (new-game {:corp {:id "Haarpsichord Studios: Entertainment Unleashed" + :deck [(qty "15 Minutes" 3)]} + :runner {:deck ["Employee Strike" "Scrubbed"]}}) (take-credits state :corp) (core/gain state :runner :click 5) (run-empty-server state "HQ") @@ -839,12 +829,11 @@ (click-prompt state :runner "No action") (is (= 2 (:agenda-point (get-runner))) "Third steal prevented")))) -(deftest haas-bioroid:-architects-of-tomorrow +(deftest haas-bioroid-architects-of-tomorrow ;; Architects of Tomorrow - prompt to rez after passing bioroid (do-game - (new-game - (make-deck "Haas-Bioroid: Architects of Tomorrow" [(qty "Eli 1.0" 2) "Pup"]) - (default-runner)) + (new-game {:corp {:id "Haas-Bioroid: Architects of Tomorrow" + :deck [(qty "Eli 1.0" 2) "Pup"]}}) (core/gain state :corp :credit 3) (play-from-hand state :corp "Eli 1.0" "Archives") (play-from-hand state :corp "Pup" "Archives") @@ -859,13 +848,13 @@ (click-card state :corp (get-ice state :hq 0)) (is (= 3 (:credit (get-corp))) "Corp not charged for Architects of Tomorrow rez of Eli 1.0"))) -(deftest haas-bioroid:-engineering-the-future +(deftest haas-bioroid-engineering-the-future ;; Engineereing the Future (testing "interaction with Employee Strike" (do-game - (new-game - (make-deck "Haas-Bioroid: Engineering the Future" [(qty "Eli 1.0" 3) "Paywall Implementation"]) - (default-runner ["Employee Strike"])) + (new-game {:corp {:id "Haas-Bioroid: Engineering the Future" + :deck [(qty "Eli 1.0" 3) "Paywall Implementation"]} + :runner {:deck ["Employee Strike"]}}) (take-credits state :corp) (is (= 8 (:credit (get-corp))) "Corp has 8 credits at turn end") (play-from-hand state :runner "Employee Strike") @@ -880,23 +869,22 @@ (play-from-hand state :corp "Eli 1.0" "New remote") (is (= 9 (:credit (get-corp))) "Corp gained 1cr from EtF")))) -(deftest haas-bioroid:-stronger-together +(deftest haas-bioroid-stronger-together ;; Stronger Together - +1 strength for Bioroid ice (do-game - (new-game - (make-deck "Haas-Bioroid: Stronger Together" ["Eli 1.0"]) - (default-runner)) + (new-game {:corp {:id "Haas-Bioroid: Stronger Together" + :deck ["Eli 1.0"]}}) (play-from-hand state :corp "Eli 1.0" "Archives") (let [eli (get-ice state :archives 0)] (core/rez state :corp eli) (is (= 5 (:current-strength (refresh eli))) "Eli 1.0 at 5 strength")))) -(deftest iain-stirling:-retired-spook +(deftest iain-stirling-retired-spook ;; Iain Stirling - Gain 2 credits when behind (do-game - (new-game - (default-corp ["Breaking News"]) - (make-deck "Iain Stirling: Retired Spook" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Breaking News"]} + :runner {:id "Iain Stirling: Retired Spook" + :deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Breaking News" "New remote") (let [ag1 (get-in @state [:corp :servers :remote1 :content 0])] (core/advance state :corp {:card (refresh ag1)}) @@ -907,14 +895,12 @@ (take-credits state :runner 1) (is (= 8 (:credit (get-runner))) "Gained 2 credits from being behind on points")))) -(deftest industrial-genomics:-growing-solutions +(deftest industrial-genomics-growing-solutions ;; Industrial Genomics - Increase trash cost (testing "Basic test" (do-game - (new-game - (make-deck "Industrial Genomics: Growing Solutions" - [(qty "PAD Campaign" 3) (qty "Hedge Fund" 3)]) - (default-runner)) + (new-game {:corp {:id "Industrial Genomics: Growing Solutions" + :deck [(qty "PAD Campaign" 3) (qty "Hedge Fund" 3)]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (trash-from-hand state :corp "PAD Campaign") (trash-from-hand state :corp "PAD Campaign") @@ -927,10 +913,8 @@ (is (= 8 (core/trash-cost state :runner (refresh pad))))))) (testing "with Product Recall" (do-game - (new-game - (make-deck "Industrial Genomics: Growing Solutions" - ["Product Recall" (qty "PAD Campaign" 3) (qty "Hedge Fund" 2)]) - (default-runner)) + (new-game {:corp {:id "Industrial Genomics: Growing Solutions" + :deck ["Product Recall" (qty "PAD Campaign" 3) (qty "Hedge Fund" 2)]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (trash-from-hand state :corp "PAD Campaign") (trash-from-hand state :corp "PAD Campaign") @@ -948,14 +932,13 @@ (click-card state :corp pad) (is (= (+ credits 8) (:credit (get-corp))) "Gain 8 credits from trashing PAD Campaign")))))) -(deftest jemison-astronautics:-sacrifice.-audacity.-success. +(deftest jemison-astronautics-sacrifice-audacity-success ;; Jemison Astronautics - Place advancements when forfeiting agendas (testing "Basic test" (do-game - (new-game - (make-deck "Jemison Astronautics: Sacrifice. Audacity. Success." - ["Enforcer 1.0" "Hostile Takeover" "Ice Wall" "Global Food Initiative"]) - (default-runner ["Data Dealer"])) + (new-game {:corp {:id "Jemison Astronautics: Sacrifice. Audacity. Success." + :deck ["Enforcer 1.0" "Hostile Takeover" "Ice Wall" "Global Food Initiative"]} + :runner {:deck ["Data Dealer"]}}) (play-from-hand state :corp "Enforcer 1.0" "HQ") (play-from-hand state :corp "Ice Wall" "R&D") (play-from-hand state :corp "Hostile Takeover" "New remote") @@ -979,11 +962,9 @@ (testing "24/7 - Armed Intimidation combination" ;; Expected result: 24/7 causes Forfeit, Jemison places counters, AI triggers (do-game - (new-game - (make-deck "Jemison Astronautics: Sacrifice. Audacity. Success." - ["Armed Intimidation" "Hostile Takeover" - "24/7 News Cycle" "Ice Wall"]) - (default-runner)) + (new-game {:corp {:id "Jemison Astronautics: Sacrifice. Audacity. Success." + :deck ["Armed Intimidation" "Hostile Takeover" + "24/7 News Cycle" "Ice Wall"]}}) (play-and-score state "Hostile Takeover") (is (= 1 (:agenda-point (get-corp))) "Corp has 1 agenda points from Hostile Takeover") (is (= 12 (:credit (get-corp))) "Corp has 12 credits after scoring Hostile Takeover with play-score") @@ -1003,12 +984,13 @@ (click-prompt state :runner "Take 2 tags") ; First runner has prompt (is (= 4 (count-tags state)) "Runner took 2 more tags from AI -- happens at the end of all the async completion")))) -(deftest jesminder-sareen:-girl-behind-the-curtain +(deftest jesminder-sareen-girl-behind-the-curtain ;; Jesminder Sareen - avoid tags only during a run (testing "Basic test" (do-game - (new-game (default-corp ["SEA Source" "Data Raven"]) - (make-deck "Jesminder Sareen: Girl Behind the Curtain" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["SEA Source" "Data Raven"]} + :runner {:id "Jesminder Sareen: Girl Behind the Curtain" + :deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Data Raven" "Archives") (take-credits state :corp) (let [dr (-> @state :corp :servers :archives :ices first)] @@ -1030,32 +1012,30 @@ (is (= 2 (count-tags state)) "Jesminder did not avoid the tag outside of a run")))) (testing "don't avoid John Masanori tag" (do-game - (new-game (default-corp) - (make-deck "Jesminder Sareen: Girl Behind the Curtain" ["John Masanori"])) + (new-game {:runner {:id "Jesminder Sareen: Girl Behind the Curtain" + :deck ["John Masanori"]}}) (take-credits state :corp) (play-from-hand state :runner "John Masanori") (run-on state "HQ") (core/jack-out state :runner nil) (is (= 1 (count-tags state)) "Jesminder did not avoid John Masanori tag")))) -(deftest jinteki-biotech:-life-imagined +(deftest jinteki-biotech-life-imagined ;; Jinteki Biotech (testing "Brewery net damage" (do-game - (new-game - (make-deck "Jinteki Biotech: Life Imagined" ["Braintrust"]) - (default-runner) - {:dont-start-turn true}) + (new-game {:corp {:id "Jinteki Biotech: Life Imagined" + :deck ["Braintrust"]} + :options {:dont-start-turn true}}) (click-prompt state :corp "The Brewery") (core/start-turn state :corp nil) (card-ability state :corp (:identity (get-corp)) 1) (is (= 1 (count (:hand (get-runner)))) "Runner took 2 net damage from Brewery flip"))) (testing "Greenhouse four advancement tokens" (do-game - (new-game - (make-deck "Jinteki Biotech: Life Imagined" ["Braintrust"]) - (default-runner) - {:dont-start-turn true}) + (new-game {:corp {:id "Jinteki Biotech: Life Imagined" + :deck ["Braintrust"]} + :options {:dont-start-turn true}}) (click-prompt state :corp "The Greenhouse") (core/start-turn state :corp nil) (play-from-hand state :corp "Braintrust" "New remote") @@ -1068,10 +1048,9 @@ (is (= 4 (get-counters (refresh bt) :advancement)) "Four advancement counters on agenda")))) (testing "Tank shuffle Archives into R&D" (do-game - (new-game - (make-deck "Jinteki Biotech: Life Imagined" [(qty "Hedge Fund" 3)]) - (default-runner) - {:dont-start-turn true}) + (new-game {:corp {:id "Jinteki Biotech: Life Imagined" + :deck [(qty "Hedge Fund" 3)]} + :options {:dont-start-turn true}}) (click-prompt state :corp "The Tank") (core/start-turn state :corp nil) (play-from-hand state :corp "Hedge Fund") @@ -1084,23 +1063,24 @@ (is (zero? (count (:discard (get-corp)))) "Archives ended empty") (is (= 3 (count (:deck (get-corp)))) "R&D ended with 3 cards")))) -(deftest jinteki:-personal-evolution +(deftest jinteki-personal-evolution ;; Personal Evolution - Prevent runner from running on remotes unless they first run on a central (do-game - (new-game - (make-deck "Jinteki: Personal Evolution" [(qty "Braintrust" 6)]) - (default-runner [(qty "Sure Gamble" 3)])) + (new-game {:corp {:id "Jinteki: Personal Evolution" + :deck [(qty "Braintrust" 6)]} + :runner {:deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Braintrust" "New remote") (take-credits state :corp) (run-empty-server state "Server 1") (click-prompt state :runner "Steal") (is (= 2 (count (:hand (get-runner)))) "Runner took 1 net damage from steal"))) -(deftest jinteki:-potential-unleashed +(deftest jinteki-potential-unleashed ;; Potential Unleashed - when the runner takes at least one net damage, mill 1 from their deck (do-game - (new-game (make-deck "Jinteki: Potential Unleashed" ["Philotic Entanglement" "Neural EMP" (qty "Braintrust" 3)]) - (default-runner [(qty "Employee Strike" 10)])) + (new-game {:corp {:id "Jinteki: Potential Unleashed" + :deck ["Philotic Entanglement" "Neural EMP" (qty "Braintrust" 3)]} + :runner {:deck [(qty "Employee Strike" 10)]}}) (play-from-hand state :corp "Braintrust" "New remote") (play-from-hand state :corp "Braintrust" "New remote") (take-credits state :corp) @@ -1115,13 +1095,12 @@ (play-from-hand state :corp "Neural EMP") (is (= 5 (count (:discard (get-runner))))))) -(deftest jinteki:-replicating-perfection +(deftest jinteki-replicating-perfection ;; Replicating Perfection - Prevent runner from running on remotes unless they first run on a central (testing "Basic test" (do-game - (new-game - (make-deck "Jinteki: Replicating Perfection" [(qty "Mental Health Clinic" 3)]) - (default-runner)) + (new-game {:corp {:id "Jinteki: Replicating Perfection" + :deck [(qty "Mental Health Clinic" 3)]}}) (play-from-hand state :corp "Mental Health Clinic" "New remote") (take-credits state :corp) (is (not (core/can-run-server? state "Server 1")) "Runner can only run on centrals") @@ -1129,9 +1108,9 @@ (is (boolean (core/can-run-server? state "Server 1")) "Runner can run on remotes"))) (testing "interaction with Employee Strike. Issue #1313 and #1956." (do-game - (new-game - (make-deck "Jinteki: Replicating Perfection" [(qty "Mental Health Clinic" 3)]) - (default-runner ["Employee Strike" "Scrubbed"])) + (new-game {:corp {:id "Jinteki: Replicating Perfection" + :deck [(qty "Mental Health Clinic" 3)]} + :runner {:deck ["Employee Strike" "Scrubbed"]}}) (play-from-hand state :corp "Mental Health Clinic" "New remote") (take-credits state :corp) (is (not (core/can-run-server? state "Server 1")) "Runner can only run on centrals") @@ -1140,30 +1119,28 @@ (play-from-hand state :runner "Scrubbed") (is (not (core/can-run-server? state "Server 1")) "Runner can only run on centrals")))) -(deftest ^{:card-title "kate-\"mac\"-mccaffrey:-digital-tinker"} - kate +(deftest kate-mac-mccaffrey-digital-tinker ;; Kate 'Mac' McCaffrey (testing "Install discount" (do-game - (new-game (default-corp) - (make-deck "Kate \"Mac\" McCaffrey: Digital Tinker" ["Magnum Opus"])) + (new-game {:runner {:id "Kate \"Mac\" McCaffrey: Digital Tinker" + :deck ["Magnum Opus"]}}) (take-credits state :corp) (play-from-hand state :runner "Magnum Opus") (is (= 1 (:credit (get-runner))) "Installed Magnum Opus for 4 credits"))) (testing "No discount for 0 cost" (do-game - (new-game (default-corp) - (make-deck "Kate \"Mac\" McCaffrey: Digital Tinker" - ["Magnum Opus" - "Self-modifying Code"])) + (new-game {:runner {:id "Kate \"Mac\" McCaffrey: Digital Tinker" + :deck ["Magnum Opus" + "Self-modifying Code"]}}) (take-credits state :corp) (play-from-hand state :runner "Self-modifying Code") (play-from-hand state :runner "Magnum Opus") (is (zero? (:credit (get-runner))) "No Kate discount on second program install"))) (testing "Can afford only with the discount" (do-game - (new-game (default-corp) - (make-deck "Kate \"Mac\" McCaffrey: Digital Tinker" ["Magnum Opus"])) + (new-game {:runner {:id "Kate \"Mac\" McCaffrey: Digital Tinker" + :deck ["Magnum Opus"]}}) (take-credits state :corp) (core/lose state :runner :credit 1) (is (= 4 (:credit (get-runner)))) @@ -1171,12 +1148,11 @@ (is (= 1 (count (get-program state))) "Magnum Opus installed") (is (zero? (:credit (get-runner))) "Installed Magnum Opus for 4 credits")))) -(deftest ^{:card-title "ken-\"express\"-tenma:-disappeared-clone"} - ken +(deftest ken-express-tenma-disappeared-clone ;; Ken 'Express' Tenma - Gain 1 credit when first Run event played (do-game - (new-game (default-corp) - (make-deck "Ken \"Express\" Tenma: Disappeared Clone" [(qty "Account Siphon" 2)])) + (new-game {:runner {:id "Ken \"Express\" Tenma: Disappeared Clone" + :deck [(qty "Account Siphon" 2)]}}) (take-credits state :corp) (play-run-event state (first (:hand (get-runner))) :hq) (is (= 6 (:credit (get-runner))) "Gained 1 credit for first Run event") @@ -1184,13 +1160,13 @@ (play-run-event state (first (:hand (get-runner))) :hq) (is (= 16 (:credit (get-runner))) "No credit gained for second Run event"))) -(deftest khan:-savvy-skiptracer +(deftest khan-savvy-skiptracer ;; Khan (testing "proper order of events when vs. Caprice" (do-game - (new-game - (default-corp ["Eli 1.0" "Caprice Nisei"]) - (make-deck "Khan: Savvy Skiptracer" ["Corroder"])) + (new-game {:corp {:deck ["Eli 1.0" "Caprice Nisei"]} + :runner {:id "Khan: Savvy Skiptracer" + :deck ["Corroder"]}}) (play-from-hand state :corp "Eli 1.0" "Archives") (play-from-hand state :corp "Caprice Nisei" "Archives") (core/rez state :corp (get-content state :archives 0)) @@ -1209,13 +1185,13 @@ (click-prompt state :corp "1 [Credits]") (is (not (:run @state)) "Run ended")))) -(deftest laramy-fisk:-savvy-investor +(deftest laramy-fisk-savvy-investor ;; Laramy Fisk (testing "installing a Shard should still give option to force Corp draw" (do-game - (new-game - (default-corp [(qty "Hedge Fund" 3) (qty "Eli 1.0" 3)]) - (make-deck "Laramy Fisk: Savvy Investor" ["Eden Shard"])) + (new-game {:corp {:deck [(qty "Hedge Fund" 3) (qty "Eli 1.0" 3)]} + :runner {:id "Laramy Fisk: Savvy Investor" + :deck ["Eden Shard"]}}) (starting-hand state :corp ["Hedge Fund" "Hedge Fund" "Hedge Fund" "Eli 1.0" "Eli 1.0"]) (take-credits state :corp) (run-on state "R&D") @@ -1229,15 +1205,16 @@ (is (not (:run @state)) "Run ended") (is (= 6 (count (:hand (get-corp)))) "Corp forced to draw")))) -(deftest leela-patel:-trained-pragmatist +(deftest leela-patel-trained-pragmatist ;; Leela Patel (testing "complicated interaction with mutiple Gang Sign" (do-game - (new-game - (make-deck "Titan Transnational: Investing In Your Future" ["Project Atlas" - "Hostile Takeover" - "Geothermal Fracking"]) - (make-deck "Leela Patel: Trained Pragmatist" [(qty "Gang Sign" 2)])) + (new-game {:corp {:id "Titan Transnational: Investing In Your Future" + :deck ["Project Atlas" + "Hostile Takeover" + "Geothermal Fracking"]} + :runner {:id "Leela Patel: Trained Pragmatist" + :deck [(qty "Gang Sign" 2)]}}) (play-from-hand state :corp "Project Atlas" "New remote") (play-from-hand state :corp "Hostile Takeover" "New remote") (play-from-hand state :corp "Geothermal Fracking" "New remote") @@ -1261,9 +1238,9 @@ (click-prompt state :runner "Done"))) (testing "issues with lingering successful run prompt" (do-game - (new-game - (make-deck "NBN: Making News" ["Breaking News" "SanSan City Grid"]) - (make-deck "Leela Patel: Trained Pragmatist" [])) + (new-game {:corp {:id "NBN: Making News" + :deck ["Breaking News" "SanSan City Grid"]} + :runner {:id "Leela Patel: Trained Pragmatist"}}) (starting-hand state :corp ["SanSan City Grid"]) (play-from-hand state :corp "SanSan City Grid" "New remote") (take-credits state :corp) @@ -1273,8 +1250,9 @@ (is (not (:run @state)) "Run is over"))) (testing "upgrades returned to hand in the middle of a run do not break the run. Issue #2008" (do-game - (new-game (default-corp [(qty "Crisium Grid" 3) (qty "Project Atlas" 3) "Shock!"]) - (make-deck "Leela Patel: Trained Pragmatist" ["Sure Gamble"])) + (new-game {:corp {:deck [(qty "Crisium Grid" 3) (qty "Project Atlas" 3) "Shock!"]} + :runner {:id "Leela Patel: Trained Pragmatist" + :deck ["Sure Gamble"]}}) (starting-hand state :corp ["Crisium Grid" "Crisium Grid" "Crisium Grid" "Project Atlas" "Shock!" "Project Atlas"]) (play-from-hand state :corp "Crisium Grid" "HQ") (play-from-hand state :corp "Crisium Grid" "Archives") @@ -1302,24 +1280,23 @@ (is (not (get-content state :archives 0)) "Upgrade returned to hand") (is (not (:run @state)) "Run ended, no more accesses")))) -(deftest liza-talking-thunder:-prominent-legislator +(deftest liza-talking-thunder-prominent-legislator ;; Liza Talking Thunder: Prominent Legislator (do-game - (new-game - (default-corp) - (make-deck "Liza Talking Thunder: Prominent Legislator" [(qty "Sure Gamble" 7)])) + (new-game {:runner {:id "Liza Talking Thunder: Prominent Legislator" + :deck [(qty "Sure Gamble" 7)]}}) (take-credits state :corp) (run-empty-server state "R&D") (is (= 7 (count (:hand (get-runner)))) "Drew 2 cards from successful run on Archives") (is (= 1 (count-tags state)) "Took 1 tag from successful run on Archives"))) -(deftest maxx:-maximum-punk-rock +(deftest maxx-maximum-punk-rock ;; MaxX (testing "Basic test" (do-game - (new-game (default-corp) - (make-deck "MaxX: Maximum Punk Rock" [(qty "Wyldside" 3) - "Eater"])) + (new-game {:runner {:id "MaxX: Maximum Punk Rock" + :deck [(qty "Wyldside" 3) + "Eater"]}}) (starting-hand state :runner ["Eater"]) (take-credits state :corp) (is (= 2 (count (:discard (get-runner)))) "MaxX discarded 2 cards at start of turn") @@ -1327,8 +1304,8 @@ "Maxx did log trashed card names"))) (testing "with Dummy Box. Check that mills don't trigger trash prevention #3246" (do-game - (new-game (default-corp) - (make-deck "MaxX: Maximum Punk Rock" [(qty "Dummy Box" 30)])) + (new-game {:runner {:id "MaxX: Maximum Punk Rock" + :deck [(qty "Dummy Box" 30)]}}) (take-credits state :corp) (is (= 2 (count (:discard (get-runner)))) "MaxX discarded 2 cards at start of turn") (play-from-hand state :runner "Dummy Box") @@ -1337,12 +1314,12 @@ (is (empty? (:prompt (get-runner))) "Dummy Box not fired from mill"))) (testing "with Wyldside - using Wyldside during Step 1.2 should lose 1 click" (do-game - (new-game (default-corp) - (make-deck "MaxX: Maximum Punk Rock" [(qty "Wyldside" 3) - (qty "Sure Gamble" 3) - (qty "Infiltration" 3) - (qty "Corroder" 3) - (qty "Eater" 3)])) + (new-game {:runner {:id "MaxX: Maximum Punk Rock" + :deck [(qty "Wyldside" 3) + (qty "Sure Gamble" 3) + (qty "Infiltration" 3) + (qty "Corroder" 3) + (qty "Eater" 3)]}}) (take-credits state :corp) (is (= 2 (count (:discard (get-runner)))) "MaxX discarded 2 cards at start of turn") (starting-hand state :runner ["Wyldside"]) @@ -1362,12 +1339,12 @@ (is (= 3 (:click (get-runner))) "Wyldside caused 1 click to be lost") (is (= 3 (count (:hand (get-runner)))) "3 cards drawn total"))))) -(deftest mti-mwekundu:-life-improved +(deftest mti-mwekundu-life-improved ;; Mti Mwekundu: Life Improved - when server is approached, install ice from HQ at the innermost position (testing "No ice" (do-game - (new-game (make-deck "Mti Mwekundu: Life Improved" ["Enigma"]) - (default-runner)) + (new-game {:corp {:id "Mti Mwekundu: Life Improved" + :deck ["Enigma"]}}) (take-credits state :corp) (run-on state "HQ") (is (zero? (get-in @state [:run :position])) "Initial position approaching server") @@ -1378,8 +1355,8 @@ (is (empty? (:hand (get-corp))) "Enigma removed from HQ"))) (testing "Multiple ice" (do-game - (new-game (make-deck "Mti Mwekundu: Life Improved" ["Enigma" "Ice Wall" "Bloom"]) - (default-runner)) + (new-game {:corp {:id "Mti Mwekundu: Life Improved" + :deck ["Enigma" "Ice Wall" "Bloom"]}}) (play-from-hand state :corp "Ice Wall" "R&D") (play-from-hand state :corp "Bloom" "R&D") (take-credits state :corp) @@ -1394,8 +1371,8 @@ (is (empty? (:hand (get-corp))) "Enigma removed from HQ"))) (testing "with Kakugo, passing shouldn't fire net damage twice. #3588" (do-game - (new-game (make-deck "Mti Mwekundu: Life Improved" ["Kakugo"]) - (default-runner)) + (new-game {:corp {:id "Mti Mwekundu: Life Improved" + :deck ["Kakugo"]}}) (take-credits state :corp) (run-on state "HQ") (is (zero? (get-in @state [:run :position])) "Initial position approaching server") @@ -1408,13 +1385,12 @@ (run-continue state) (is (= 1 (-> (get-runner) :discard count)) "Runner should take 1 net damage from Kakugo")))) -(deftest nasir-meidan:-cyber-explorer +(deftest nasir-meidan-cyber-explorer ;; Nasir (testing "Basic test" (do-game - (new-game - (default-corp [(qty "Ice Wall" 3)]) - (make-deck "Nasir Meidan: Cyber Explorer" [])) + (new-game {:corp {:deck [(qty "Ice Wall" 3)]} + :runner {:id "Nasir Meidan: Cyber Explorer"}}) (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) (run-on state "HQ") @@ -1426,9 +1402,9 @@ (is (= 1 (:credit (get-runner))) "Credits at 1 after Nasir ability trigger")))) (testing "with Xanadu" (do-game - (new-game - (default-corp ["Ice Wall"]) - (make-deck "Nasir Meidan: Cyber Explorer" ["Xanadu"])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:id "Nasir Meidan: Cyber Explorer" + :deck ["Xanadu"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) (swap! state assoc-in [:runner :credit] 6) @@ -1441,12 +1417,11 @@ (card-ability state :runner nasir 0) (is (= 2 (:credit (get-runner))) "Gain 1 more credit due to Xanadu"))))) -(deftest ^{:card-title "nathaniel-\"gnat\"-hall:-one-of-a-kind"} gnat +(deftest nathaniel-gnat-hall-one-of-a-kind ;; Nathaniel "Gnat" Hall: One-of-a-Kind (do-game - (new-game - (default-corp) - (make-deck "Nathaniel \"Gnat\" Hall: One-of-a-Kind" [(qty "Sure Gamble" 3)])) + (new-game {:runner {:id "Nathaniel \"Gnat\" Hall: One-of-a-Kind" + :deck [(qty "Sure Gamble" 3)]}}) (take-credits state :corp) (is (= 5 (:credit (get-runner))) "Did not gain a credit when Gnat is on 3 cards") (play-from-hand state :runner "Sure Gamble") @@ -1455,13 +1430,13 @@ (take-credits state :corp) (is (= (inc runner-credits) (:credit (get-runner)))) "Gained 1 credits when on 2 cards"))) -(deftest nbn:-controlling-the-message +(deftest nbn-controlling-the-message ;; NBN: Controlling the Message (testing "Trace to tag Runner when first installed Corp card is trashed" (do-game - (new-game - (make-deck "NBN: Controlling the Message" [(qty "Launch Campaign" 3)]) - (default-runner ["Forger"])) + (new-game {:corp {:id "NBN: Controlling the Message" + :deck [(qty "Launch Campaign" 3)]} + :runner {:deck ["Forger"]}}) (play-from-hand state :corp "Launch Campaign" "New remote") (play-from-hand state :corp "Launch Campaign" "New remote") (take-credits state :corp) @@ -1482,9 +1457,8 @@ (is (empty? (:prompt (get-corp))) "No trace chance on 2nd trashed card of turn"))) (testing "Interaction with Dedicated Response Team" (do-game - (new-game - (make-deck "NBN: Controlling the Message" ["Launch Campaign" "Dedicated Response Team"]) - (default-runner)) + (new-game {:corp {:id "NBN: Controlling the Message" + :deck ["Launch Campaign" "Dedicated Response Team"]}}) (play-from-hand state :corp "Launch Campaign" "New remote") (play-from-hand state :corp "Dedicated Response Team" "New remote") (core/rez state :corp (get-content state :remote2 0)) @@ -1497,12 +1471,11 @@ (is (= 1 (count-tags state)) "Runner took 1 unpreventable tag") (is (= 2 (count (:discard (get-runner)))) "Runner took 2 meat damage from DRT")))) -(deftest new-angeles-sol:-your-news +(deftest new-angeles-sol-your-news ;; New Angeles Sol - interaction with runner stealing agendas (do-game - (new-game - (make-deck "New Angeles Sol: Your News" [(qty "Paywall Implementation" 2) "Breaking News"]) - (default-runner)) + (new-game {:corp {:id "New Angeles Sol: Your News" + :deck [(qty "Paywall Implementation" 2) "Breaking News"]}}) (play-from-hand state :corp "Breaking News" "New remote") (play-from-hand state :corp "Paywall Implementation") (take-credits state :corp) @@ -1516,13 +1489,12 @@ (is (not (:run @state)) "Run ended") (is (find-card "Paywall Implementation" (:current (get-corp))) "Paywall back in play"))) -(deftest next-design:-guarding-the-net +(deftest next-design-guarding-the-net ;; Next Design. Install up to 3 ICE before game starts, one per server max, and re-draw to 5 (do-game - (new-game - (make-deck "NEXT Design: Guarding the Net" [(qty "Snowflake" 10)]) - (default-runner) - {:dont-start-turn true}) + (new-game {:corp {:id "NEXT Design: Guarding the Net" + :deck [(qty "Snowflake" 10)]} + :options {:dont-start-turn true}}) (click-card state :corp (find-card "Snowflake" (:hand (get-corp)))) (click-prompt state :corp "HQ") (click-card state :corp (find-card "Snowflake" (:hand (get-corp)))) @@ -1533,12 +1505,11 @@ (card-ability state :corp (get-in @state [:corp :identity]) 0) (is (= 5 (count (:hand (get-corp)))) "Corp should start with 5 cards in hand"))) -(deftest nisei-division:-the-next-generation +(deftest nisei-division-the-next-generation ;; Nisei Division - Gain 1 credit from every psi game (do-game - (new-game - (make-deck "Nisei Division: The Next Generation" [(qty "Snowflake" 2)]) - (default-runner)) + (new-game {:corp {:id "Nisei Division: The Next Generation" + :deck [(qty "Snowflake" 2)]}}) (play-from-hand state :corp "Snowflake" "HQ") (play-from-hand state :corp "Snowflake" "HQ") (take-credits state :corp) @@ -1559,12 +1530,12 @@ (click-prompt state :runner "1 [Credits]") (is (= 5 (:credit (get-corp))) "Gained 1 credit from psi game")))) -(deftest noise:-hacker-extraordinaire +(deftest noise-hacker-extraordinaire ;; Noise: Hacker Extraordinaire (do-game - (new-game - (default-corp [(qty "Hedge Fund" 3) (qty "Restructure" 3) (qty "PAD Campaign" 3) (qty "Beanstalk Royalties" 2)]) - (make-deck "Noise: Hacker Extraordinaire" ["Datasucker" "Cache" "Sure Gamble" (qty "Clone Chip" 2) (qty "Sharpshooter" 2)])) + (new-game {:corp {:deck [(qty "Hedge Fund" 3) (qty "Restructure" 3) (qty "PAD Campaign" 3) (qty "Beanstalk Royalties" 2)]} + :runner {:id "Noise: Hacker Extraordinaire" + :deck ["Datasucker" "Cache" "Sure Gamble" (qty "Clone Chip" 2) (qty "Sharpshooter" 2)]}}) (starting-hand state :runner ["Datasucker" "Sure Gamble" "Clone Chip" "Clone Chip" "Cache"]) (is (= 6 (count (:hand (get-corp)))) "Corp should start with 6 cards in hand") (is (= 5 (count (:deck (get-corp)))) "Corp deck should contain 5 cards") @@ -1599,13 +1570,13 @@ (is (= (:title ss) "Sharpshooter")))) (is (= 2 (count (:discard (get-corp)))) "Playing non-virus via Clone Chip on corp's turn should not trigger Noise ability"))) -(deftest null:-whistleblower +(deftest null-whistleblower ;; Null (testing "Basic test" (do-game - (new-game - (default-corp [(qty "Wraparound" 3)]) - (make-deck "Null: Whistleblower" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Wraparound" 3)]} + :runner {:id "Null: Whistleblower" + :deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Wraparound" "HQ") (play-from-hand state :corp "Wraparound" "HQ") (take-credits state :corp) @@ -1627,9 +1598,9 @@ (is (= 7 (:current-strength (refresh wrap2))) "Outer Wraparound back to 7 strength")))) (testing "does not affect next ice when current is trashed. Issue #1788." (do-game - (new-game - (default-corp ["Wraparound" "Spiderweb"]) - (make-deck "Null: Whistleblower" [(qty "Parasite" 3)])) + (new-game {:corp {:deck ["Wraparound" "Spiderweb"]} + :runner {:id "Null: Whistleblower" + :deck [(qty "Parasite" 3)]}}) (play-from-hand state :corp "Spiderweb" "HQ") (play-from-hand state :corp "Wraparound" "HQ") (take-credits state :corp) @@ -1648,13 +1619,12 @@ (is (find-card "Spiderweb" (:discard (get-corp))) "Spiderweb trashed by Parasite + Null") (is (= 7 (:current-strength (refresh wrap))) "Wraparound not reduced by Null"))))) -(deftest omar-keung:-conspiracy-theorist +(deftest omar-keung-conspiracy-theorist ;; Omar Keung (testing "Make a successful run on the chosen server once per turn" (do-game - (new-game - (default-corp) - (make-deck "Omar Keung: Conspiracy Theorist" [(qty "Sure Gamble" 3)])) + (new-game {:runner {:id "Omar Keung: Conspiracy Theorist" + :deck [(qty "Sure Gamble" 3)]}}) (take-credits state :corp) (let [omar (get-in @state [:runner :identity])] (card-ability state :runner omar 0) @@ -1676,9 +1646,9 @@ (is (= [:hq :rd] (get-in @state [:runner :register :successful-run])))))) (testing "Ash prevents access, but not successful run" (do-game - (new-game - (default-corp ["Ash 2X3ZB9CY"]) - (make-deck "Omar Keung: Conspiracy Theorist" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Ash 2X3ZB9CY"]} + :runner {:id "Omar Keung: Conspiracy Theorist" + :deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Ash 2X3ZB9CY" "HQ") (take-credits state :corp) (let [omar (get-in @state [:runner :identity]) @@ -1693,9 +1663,9 @@ (is (= :hq (-> (get-runner) :register :successful-run first)))))) (testing "Crisium Grid prevents prompt" (do-game - (new-game - (default-corp ["Crisium Grid"]) - (make-deck "Omar Keung: Conspiracy Theorist" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Crisium Grid"]} + :runner {:id "Omar Keung: Conspiracy Theorist" + :deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Crisium Grid" "Archives") (take-credits state :corp) (let [omar (get-in @state [:runner :identity]) @@ -1708,9 +1678,8 @@ (is (= :archives (get-in @state [:run :server 0])))))) (testing "When selecting R&D, ability adds counters to Medium" (do-game - (new-game - (default-corp) - (make-deck "Omar Keung: Conspiracy Theorist" ["Medium"])) + (new-game {:runner {:id "Omar Keung: Conspiracy Theorist" + :deck ["Medium"]}}) (take-credits state :corp) (play-from-hand state :runner "Medium") (let [omar (get-in @state [:runner :identity]) @@ -1721,9 +1690,8 @@ (is (= 1 (get-counters (refresh medium) :virus)))))) (testing "When selecting HQ, ability adds counters to Nerve Agent" (do-game - (new-game - (default-corp) - (make-deck "Omar Keung: Conspiracy Theorist" ["Nerve Agent"])) + (new-game {:runner {:id "Omar Keung: Conspiracy Theorist" + :deck ["Nerve Agent"]}}) (take-credits state :corp) (play-from-hand state :runner "Nerve Agent") (let [omar (get-in @state [:runner :identity]) @@ -1733,12 +1701,12 @@ (click-prompt state :runner "HQ") (is (= 1 (get-counters (refresh nerve) :virus))))))) -(deftest quetzal:-free-spirit +(deftest quetzal-free-spirit ;; Quetzal (do-game - (new-game - (default-corp [(qty "Ice Wall" 3)]) - (make-deck "Quetzal: Free Spirit" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Ice Wall" 3)]} + :runner {:id "Quetzal: Free Spirit" + :deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) (run-on state "HQ") @@ -1763,12 +1731,11 @@ (is (last-log-contains? state qmsg) "Quetzal ability did trigger") (core/jack-out state :runner nil)))) -(deftest reina-roja:-freedom-fighter +(deftest reina-roja-freedom-fighter ;; Reina Roja - Increase cost of first rezzed ICE (do-game - (new-game - (default-corp [(qty "Quandary" 3)]) - (make-deck "Reina Roja: Freedom Fighter" [])) + (new-game {:corp {:deck [(qty "Quandary" 3)]} + :runner {:id "Reina Roja: Freedom Fighter"}}) (play-from-hand state :corp "Quandary" "R&D") (take-credits state :corp) (is (= 7 (:credit (get-corp)))) @@ -1777,12 +1744,12 @@ (core/rez state :corp quan) (is (= 5 (:credit (get-corp))) "Rez cost increased by 1")))) -(deftest ^{:card-title "rielle-\"kit\"-peddler:-transhuman"} - kit +(deftest rielle-kit-peddler-transhuman ;; Rielle "Kit" Peddler - Give ICE Code Gate (do-game - (new-game (default-corp [(qty "Ice Wall" 2)]) - (make-deck "Rielle \"Kit\" Peddler: Transhuman" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Ice Wall" 2)]} + :runner {:id "Rielle \"Kit\" Peddler: Transhuman" + :deck [(qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) (run-on state "HQ") @@ -1793,12 +1760,11 @@ (is (core/has-subtype? (refresh iwall) "Barrier") "Ice Wall has Barrier") (is (core/has-subtype? (refresh iwall) "Code Gate") "Ice Wall has Code Gate")))) -(deftest saraswati-mnemonics:-endless-exploration +(deftest saraswati-mnemonics-endless-exploration ;; Saraswati Mnemonics (do-game - (new-game - (make-deck "Saraswati Mnemonics: Endless Exploration" ["Gene Splicer" "House of Knives"]) - (default-runner)) + (new-game {:corp {:id "Saraswati Mnemonics: Endless Exploration" + :deck ["Gene Splicer" "House of Knives"]}}) (card-ability state :corp (get-in @state [:corp :identity]) 0) (click-card state :corp (find-card "Gene Splicer" (:hand (get-corp)))) (click-prompt state :corp "New remote") @@ -1824,45 +1790,13 @@ (core/score state :corp (refresh house)) (is (= 1 (:agenda-point (get-corp))) "House of Knives was able to be scored"))))) -(deftest skorpios-defense-systems:-persuasive-power - ; Remove a card from game when it moves to discard once per round - (do-game - (new-game (make-deck "Skorpios Defense Systems: Persuasive Power" ["Hedge Fund" (qty "Quandary" 4)]) - (default-runner ["The Maker's Eye" "Lucky Find"])) - (play-from-hand state :corp "Hedge Fund") - (dotimes [_ 4] (core/move state :corp (first (:hand (get-corp))) :deck)) - (take-credits state :corp) - (play-from-hand state :runner "Lucky Find") - (play-from-hand state :runner "The Maker's Eye") - (is (= :rd (get-in @state [:run :server 0]))) - ; Don't allow a run-event in progress to be targeted #2963 - (card-ability state :corp (get-in @state [:corp :identity]) 0) - (is (empty? (filter #(= "The Maker's Eye" (:title %)) (-> (get-corp) :prompt first :choices))) "No Maker's Eye choice") - (click-prompt state :corp "Cancel") - (run-successful state) - (click-prompt state :runner "Card from deck") - (is (= "You accessed Quandary." (-> (get-runner) :prompt first :msg)) "1st quandary") - (click-prompt state :runner "No action") - (click-prompt state :runner "Card from deck") - (is (= "You accessed Quandary." (-> (get-runner) :prompt first :msg)) "2nd quandary") - (click-prompt state :runner "No action") - (click-prompt state :runner "Card from deck") - (is (= "You accessed Quandary." (-> (get-runner) :prompt first :msg)) "3rd quandary") - (click-prompt state :runner "No action") - (is (not (:run @state))) - (card-ability state :corp (get-in @state [:corp :identity]) 0) - (click-prompt state :corp (find-card "The Maker's Eye" (:discard (get-runner)))) - (is (= 1 (count (get-in @state [:runner :rfg]))) "One card RFGed") - (card-ability state :corp (get-in @state [:corp :identity]) 0) - (is (empty? (:prompt (get-corp))) "Cannot use Skorpios twice"))) - -(deftest silhouette:-stealth-operative +(deftest silhouette-stealth-operative ;; Silhouette (testing "Expose trigger ability resolves completely before access. Issue #2173" (do-game - (new-game - (default-corp ["Psychic Field" (qty "Fetal AI" 10)]) - (make-deck "Silhouette: Stealth Operative" ["Feedback Filter" "Inside Job"])) + (new-game {:corp {:deck ["Psychic Field" (qty "Fetal AI" 10)]} + :runner {:id "Silhouette: Stealth Operative" + :deck ["Feedback Filter" "Inside Job"]}}) (starting-hand state :corp ["Psychic Field" "Fetal AI"]) (play-from-hand state :corp "Psychic Field" "New remote") (take-credits state :corp) @@ -1892,9 +1826,9 @@ (is (= "Flatline" (:reason @state)) "Win condition reports flatline")))) (testing "with Temüjin; broken interaction with other successful-run triggers. Issue #1968" (do-game - (new-game - (default-corp ["PAD Campaign" (qty "Hedge Fund" 3) (qty "Restructure" 3) (qty "Beanstalk Royalties" 3)]) - (make-deck "Silhouette: Stealth Operative" ["Temüjin Contract" "Desperado"])) + (new-game {:corp {:deck ["PAD Campaign" (qty "Hedge Fund" 3) (qty "Restructure" 3) (qty "Beanstalk Royalties" 3)]} + :runner {:id "Silhouette: Stealth Operative" + :deck ["Temüjin Contract" "Desperado"]}}) (starting-hand state :corp ["Hedge Fund" "PAD Campaign"]) (play-from-hand state :corp "PAD Campaign" "New remote") (take-credits state :corp) @@ -1916,13 +1850,68 @@ (is (= 12 (:credit (get-runner))) "Gained 4cr") (is (= 12 (get-counters (get-resource state 0) :credit)) "12 cr on Temujin")))) -(deftest sportsmetal:-go-big-or-go-home +(deftest skorpios-defense-systems-persuasive-power + ; Remove a card from game when it moves to discard once per round + (do-game + (new-game {:corp {:id "Skorpios Defense Systems: Persuasive Power" + :deck ["Hedge Fund" (qty "Quandary" 4)]} + :runner {:deck ["The Maker's Eye" "Lucky Find"]}}) + (play-from-hand state :corp "Hedge Fund") + (dotimes [_ 4] (core/move state :corp (first (:hand (get-corp))) :deck)) + (take-credits state :corp) + (play-from-hand state :runner "Lucky Find") + (play-from-hand state :runner "The Maker's Eye") + (is (= :rd (get-in @state [:run :server 0]))) + ; Don't allow a run-event in progress to be targeted #2963 + (card-ability state :corp (get-in @state [:corp :identity]) 0) + (is (empty? (filter #(= "The Maker's Eye" (:title %)) (-> (get-corp) :prompt first :choices))) "No Maker's Eye choice") + (click-prompt state :corp "Cancel") + (run-successful state) + (click-prompt state :runner "Card from deck") + (is (= "You accessed Quandary." (-> (get-runner) :prompt first :msg)) "1st quandary") + (click-prompt state :runner "No action") + (click-prompt state :runner "Card from deck") + (is (= "You accessed Quandary." (-> (get-runner) :prompt first :msg)) "2nd quandary") + (click-prompt state :runner "No action") + (click-prompt state :runner "Card from deck") + (is (= "You accessed Quandary." (-> (get-runner) :prompt first :msg)) "3rd quandary") + (click-prompt state :runner "No action") + (is (not (:run @state))) + (card-ability state :corp (get-in @state [:corp :identity]) 0) + (click-prompt state :corp (find-card "The Maker's Eye" (:discard (get-runner)))) + (is (= 1 (count (get-in @state [:runner :rfg]))) "One card RFGed") + (card-ability state :corp (get-in @state [:corp :identity]) 0) + (is (empty? (:prompt (get-corp))) "Cannot use Skorpios twice"))) + +(deftest spark-agency-worldswide-reach + ;; Spark Agency - Rezzing advertisements + (do-game + (new-game {:corp {:id "Spark Agency: Worldswide Reach" + :deck [(qty "Launch Campaign" 3)]}}) + (play-from-hand state :corp "Launch Campaign" "New remote") + (play-from-hand state :corp "Launch Campaign" "New remote") + (play-from-hand state :corp "Launch Campaign" "New remote") + (let [lc1 (get-content state :remote1 0) + lc2 (get-content state :remote2 0) + lc3 (get-content state :remote3 0)] + (core/rez state :corp lc1) + (is (= 4 (:credit (get-runner))) + "Runner lost 1 credit from rez of advertisement (Corp turn)") + (core/rez state :corp lc3) + (is (= 4 (:credit (get-runner))) + "Runner did not lose credit from second Spark rez") + (take-credits state :corp) + (run-on state "Server 1") + (core/rez state :corp lc2) + (is (= 3 (:credit (get-runner))) + "Runner lost 1 credit from rez of advertisement (Runner turn)")))) + +(deftest sportsmetal-go-big-or-go-home ;; SportsMetal - gain 2 credits or draw 2 cards on agenda scored or stolen (testing "Gain 2 credits on score" (do-game - (new-game - (make-deck "Sportsmetal: Go Big or Go Home" ["Merger"]) - (default-runner)) + (new-game {:corp {:id "Sportsmetal: Go Big or Go Home" + :deck ["Merger"]}}) (play-from-hand state :corp "Merger" "New remote") (score-agenda state :corp (get-content state :remote1 0)) (is (= 5 (:credit (get-corp))) "Corp starts with 5 credits") @@ -1930,9 +1919,8 @@ (is (= 7 (:credit (get-corp))) "Corp gains 2 credits"))) (testing "Gain 2 credits on steal" (do-game - (new-game - (make-deck "Sportsmetal: Go Big or Go Home" ["Merger"]) - (default-runner)) + (new-game {:corp {:id "Sportsmetal: Go Big or Go Home" + :deck ["Merger"]}}) (play-from-hand state :corp "Merger" "New remote") (take-credits state :corp) (run-empty-server state "Server 1") @@ -1942,9 +1930,8 @@ (is (= 9 (:credit (get-corp))) "Corp gains 2 credits"))) (testing "Gain 2 cards on score" (do-game - (new-game - (make-deck "Sportsmetal: Go Big or Go Home" ["Merger" (qty "Hedge Fund" 2)]) - (default-runner)) + (new-game {:corp {:id "Sportsmetal: Go Big or Go Home" + :deck ["Merger" (qty "Hedge Fund" 2)]}}) (starting-hand state :corp ["Merger"]) (play-from-hand state :corp "Merger" "New remote") (score-agenda state :corp (get-content state :remote1 0)) @@ -1953,9 +1940,8 @@ (is (= 2 (count (:hand (get-corp)))) "Corp draws 2 cards"))) (testing "Gain 2 cards on steal" (do-game - (new-game - (make-deck "Sportsmetal: Go Big or Go Home" ["Merger" (qty "Hedge Fund" 2)]) - (default-runner)) + (new-game {:corp {:id "Sportsmetal: Go Big or Go Home" + :deck ["Merger" (qty "Hedge Fund" 2)]}}) (starting-hand state :corp ["Merger"]) (play-from-hand state :corp "Merger" "New remote") (take-credits state :corp) @@ -1965,37 +1951,11 @@ (click-prompt state :corp "2 cards") (is (= 2 (count (:hand (get-corp)))) "Corp draws 2 cards")))) -(deftest spark-agency:-worldswide-reach - ;; Spark Agency - Rezzing advertisements - (do-game - (new-game - (make-deck "Spark Agency: Worldswide Reach" [(qty "Launch Campaign" 3)]) - (default-runner)) - (play-from-hand state :corp "Launch Campaign" "New remote") - (play-from-hand state :corp "Launch Campaign" "New remote") - (play-from-hand state :corp "Launch Campaign" "New remote") - (let [lc1 (get-content state :remote1 0) - lc2 (get-content state :remote2 0) - lc3 (get-content state :remote3 0)] - (core/rez state :corp lc1) - (is (= 4 (:credit (get-runner))) - "Runner lost 1 credit from rez of advertisement (Corp turn)") - (core/rez state :corp lc3) - (is (= 4 (:credit (get-runner))) - "Runner did not lose credit from second Spark rez") - (take-credits state :corp) - (run-on state "Server 1") - (core/rez state :corp lc2) - (is (= 3 (:credit (get-runner))) - "Runner lost 1 credit from rez of advertisement (Runner turn)")))) - -(deftest sso-industries:-fueling-innovation +(deftest sso-industries-fueling-innovation ;; SSO Industries: Fueling Innovation - add advancement tokens on ice for faceup agendas (do-game - (new-game - (make-deck "SSO Industries: Fueling Innovation" - [(qty "Hortum" 2) (qty "Oaktown Renovation" 2) "Braintrust"]) - (default-runner)) + (new-game {:corp {:id "SSO Industries: Fueling Innovation" + :deck [(qty "Hortum" 2) (qty "Oaktown Renovation" 2) "Braintrust"]}}) (play-from-hand state :corp "Braintrust" "New remote") (take-credits state :corp) (is (empty? (:prompt (get-corp))) "Not prompted when no faceup agenda available") @@ -2026,13 +1986,11 @@ (take-credits state :corp) (is (empty? (:prompt (get-corp))) "Not prompted when all ice advanced")))) -(deftest strategic-innovations:-future-forward +(deftest strategic-innovations-future-forward ;; Strategic Innovations: Future Forward (do-game - (new-game - (make-deck "Strategic Innovations: Future Forward" - [(qty "Hedge Fund" 2) (qty "Eli 1.0" 2) (qty "Crick" 2)]) - (default-runner)) + (new-game {:corp {:id "Strategic Innovations: Future Forward" + :deck [(qty "Hedge Fund" 2) (qty "Eli 1.0" 2) (qty "Crick" 2)]}}) (play-from-hand state :corp "Eli 1.0" "New remote") (play-from-hand state :corp "Hedge Fund") (play-from-hand state :corp "Crick" "New remote") @@ -2052,14 +2010,12 @@ (is (zero? (count (:prompt (get-corp)))) "Corp not prompted to trigger Strategic Innovations")))) -(deftest the-foundry:-refining-the-process +(deftest the-foundry-refining-the-process ;; The Foundry (testing "interaction with Accelerated Beta Test" (do-game - (new-game - (make-deck "The Foundry: Refining the Process" - [(qty "Accelerated Beta Test" 2) (qty "Eli 1.0" 3)]) - (default-runner)) + (new-game {:corp {:id "The Foundry: Refining the Process" + :deck [(qty "Accelerated Beta Test" 2) (qty "Eli 1.0" 3)]}}) (starting-hand state :corp ["Accelerated Beta Test"]) (play-from-hand state :corp "Accelerated Beta Test" "New remote") (score-agenda state :corp (get-content state :remote1 0)) @@ -2070,13 +2026,12 @@ (is (empty? (:play-area (get-corp))) "Play area shuffled into R&D") (is (= 1 (count (:hand (get-corp)))) "Added Eli 1.0 to HQ")))) -(deftest the-outfit:-family-owned-and-operated +(deftest the-outfit-family-owned-and-operated ;; The Outfit - Gain 3 whenever you take at least 1 bad publicity (testing "basic test" (do-game - (new-game - (make-deck "The Outfit: Family Owned and Operated" ["Hostile Takeover" "Profiteering"]) - (default-runner)) + (new-game {:corp {:id "The Outfit: Family Owned and Operated" + :deck ["Hostile Takeover" "Profiteering"]}}) (play-from-hand state :corp "Hostile Takeover" "New remote") (score-agenda state :corp (get-content state :remote1 0)) (is (= 1 (:bad-publicity (get-corp))) "Take 1 bad publicity") @@ -2088,9 +2043,8 @@ (is (= 33 (:credit (get-corp))) "Corp should gain 18 credits"))) (testing "with Profiteering - Only gain 3 credits when taking more than 1 bad publicity in a single effect" (do-game - (new-game - (make-deck "The Outfit: Family Owned and Operated" ["Profiteering"]) - (default-runner)) + (new-game {:corp {:id "The Outfit: Family Owned and Operated" + :deck ["Profiteering"]}}) (play-from-hand state :corp "Profiteering" "New remote") (score-agenda state :corp (get-content state :remote1 0)) (click-prompt state :corp "3") @@ -2098,9 +2052,10 @@ (is (= 23 (:credit (get-corp))) "Gain 15 from Profiteering + 3 from The Outfit"))) (testing "vs Valencia - 1 bad pub at start means 5 credits to start with (does not _gain_ BP)" (do-game - (new-game - (make-deck "The Outfit: Family Owned and Operated" ["Hostile Takeover"]) - (make-deck "Valencia Estevez: The Angel of Cayambe" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:id "The Outfit: Family Owned and Operated" + :deck ["Hostile Takeover"]} + :runner {:id "Valencia Estevez: The Angel of Cayambe" + :deck [(qty "Sure Gamble" 3)]}}) (is (= 1 (:bad-publicity (get-corp))) "The Outfit starts with 1 bad publicity") (is (= 5 (:credit (get-corp))) "The Outfit starts with 8 credits") (play-from-hand state :corp "Hostile Takeover" "New remote") @@ -2108,13 +2063,12 @@ (is (= 2 (:bad-publicity (get-corp))) "Take 1 bad publicity") (is (= (+ 5 7 3) (:credit (get-corp))) "Gain 7 from Hostile Takeover + 3 from The Outfit")))) -(deftest titan-transnational:-investing-in-your-future +(deftest titan-transnational-investing-in-your-future ;; Titan Transnational (testing "Add a counter to a scored agenda" (do-game - (new-game - (make-deck "Titan Transnational: Investing In Your Future" ["Project Atlas"]) - (default-runner)) + (new-game {:corp {:id "Titan Transnational: Investing In Your Future" + :deck ["Project Atlas"]}}) (play-from-hand state :corp "Project Atlas" "New remote") (let [atl (get-content state :remote1 0)] (core/gain state :corp :click 1) @@ -2126,9 +2080,8 @@ (is (= 1 (get-counters scored :agenda)) "1 counter added by Titan"))))) (testing "only use one counter of Corporate Sales Team" (do-game - (new-game - (make-deck "Titan Transnational: Investing In Your Future" ["Corporate Sales Team" "Mark Yale"]) - (default-runner)) + (new-game {:corp {:id "Titan Transnational: Investing In Your Future" + :deck ["Corporate Sales Team" "Mark Yale"]}}) (play-from-hand state :corp "Corporate Sales Team" "New remote") (play-from-hand state :corp "Mark Yale" "New remote") (let [cst (get-content state :remote1 0) @@ -2152,13 +2105,12 @@ (is (zero? (get-counters (refresh scored) :agenda)) "No agenda counter used by Mark Yale") (is (= 10 (get-counters (refresh scored) :credit)) "Credits not used by Mark Yale")))))) -(deftest weyland-consortium:-builder-of-nations +(deftest weyland-consortium-builder-of-nations ;; Builder of Nations (testing "1 meat damage per turn at most" (do-game - (new-game - (make-deck "Weyland Consortium: Builder of Nations" [(qty "Hedge Fund" 3)]) - (default-runner)) + (new-game {:corp {:id "Weyland Consortium: Builder of Nations" + :deck [(qty "Hedge Fund" 3)]}}) (let [bon (get-in @state [:corp :identity])] (card-ability state :corp bon 0) (click-prompt state :corp "Cancel") @@ -2171,9 +2123,9 @@ (is (zero? (count (:prompt (get-corp)))))))) (testing "2 meat damage from ID ability when The Cleaners is scored" (do-game - (new-game - (make-deck "Weyland Consortium: Builder of Nations" [(qty "The Cleaners" 3) (qty "Ice Wall" 3)]) - (default-runner [(qty "Sure Gamble" 2)])) + (new-game {:corp {:id "Weyland Consortium: Builder of Nations" + :deck [(qty "The Cleaners" 3) (qty "Ice Wall" 3)]} + :runner {:deck [(qty "Sure Gamble" 2)]}}) (play-from-hand state :corp "The Cleaners" "New remote") (let [clean (get-content state :remote1 0)] (score-agenda state :corp clean) @@ -2182,11 +2134,11 @@ (click-prompt state :corp "Yes") (is (= 2 (count (:discard (get-runner)))) "Runner took 2 meat damage from BoN/Cleaners combo")))))) -(deftest whizzard:-master-gamer +(deftest whizzard-master-gamer ;; Whizzard - Recurring credits (do-game - (new-game (default-corp) - (make-deck "Whizzard: Master Gamer" ["Sure Gamble"])) + (new-game {:runner {:id "Whizzard: Master Gamer" + :deck ["Sure Gamble"]}}) (let [click-whizzard (fn [n] (dotimes [i n] (card-ability state :runner (:identity (get-runner)) 0)))] (is (changes-credits (get-runner) 1 (click-whizzard 1))) (is (changes-credits (get-runner) 2 (click-whizzard 5)) "Can't take more than 3 Whizzard credits") @@ -2195,13 +2147,13 @@ (take-credits state :runner) (is (changes-credits (get-runner) 0 (click-whizzard 1)) "Credits don't reset at start of Corp's turn")))) -(deftest wyvern:-chemically-enhanced +(deftest wyvern-chemically-enhanced ;; Wyvern: Chemically Enhanced (do-game - (new-game (default-corp [(qty "Launch Campaign" 3)]) - (make-deck "Wyvern: Chemically Enhanced" - [(qty "Sure Gamble" 2) "Corroder" - "Clone Chip" "Easy Mark"])) + (new-game {:corp {:deck [(qty "Launch Campaign" 3)]} + :runner {:id "Wyvern: Chemically Enhanced" + :deck [(qty "Sure Gamble" 2) "Corroder" + "Clone Chip" "Easy Mark"]}}) (play-from-hand state :corp "Launch Campaign" "New remote") (play-from-hand state :corp "Launch Campaign" "New remote") (take-credits state :corp) diff --git a/test/clj/game_test/cards/operations.clj b/test/clj/game_test/cards/operations.clj index 180f1c0a82..bb6a0b5bb6 100644 --- a/test/clj/game_test/cards/operations.clj +++ b/test/clj/game_test/cards/operations.clj @@ -7,15 +7,12 @@ [jinteki.utils :refer [count-tags]] [clojure.test :refer :all])) -(use-fixtures :once load-all-cards (partial reset-card-defs "operations")) - -(deftest ^{:card-title "24/7-news-cycle"} - twenty-four-seven-news +(deftest ^{:card-title "24-7-news-cycle"} + twenty-four-seven-news-cycle ;; 24/7 News Cycle (testing "Breaking News interaction" (do-game - (new-game (default-corp [(qty "Breaking News" 2) (qty "24/7 News Cycle" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Breaking News" 2) (qty "24/7 News Cycle" 3)]}}) (play-from-hand state :corp "Breaking News" "New remote") (play-from-hand state :corp "Breaking News" "New remote") (let [ag1 (get-content state :remote1 0) @@ -34,8 +31,7 @@ (is (= 2 (count-tags state)) "Tags remained after Corp ended turn")))) (testing "Posted Bounty interaction -- Issue #1043" (do-game - (new-game (default-corp [(qty "Posted Bounty" 2) (qty "24/7 News Cycle" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Posted Bounty" 2) (qty "24/7 News Cycle" 3)]}}) (play-from-hand state :corp "Posted Bounty" "New remote") (play-from-hand state :corp "Posted Bounty" "New remote") (let [ag1 (get-content state :remote1 0) @@ -54,9 +50,9 @@ (is (zero? (:agenda-point (get-corp))) "Forfeited Posted Bounty to 24/7 News Cycle")))) (testing "Swapped agendas are able to be used. #1555" (do-game - (new-game (default-corp ["24/7 News Cycle" "Chronos Project" - "Philotic Entanglement" "Profiteering"]) - (default-runner [(qty "Turntable" 3)])) + (new-game {:corp {:deck ["24/7 News Cycle" "Chronos Project" + "Philotic Entanglement" "Profiteering"]} + :runner {:deck [(qty "Turntable" 3)]}}) (score-agenda state :corp (find-card "Chronos Project" (:hand (get-corp)))) (score-agenda state :corp (find-card "Philotic Entanglement" (:hand (get-corp)))) (take-credits state :corp) @@ -86,9 +82,8 @@ ;; Accelerated Diagnostics - Interaction with prompt effects, like Shipment from SanSan (testing "Basic test" (do-game - (new-game (default-corp ["Accelerated Diagnostics" "Cerebral Overwriter" "Shipment from SanSan" - "Hedge Fund" "Back Channels"]) - (default-runner)) + (new-game {:corp {:deck ["Accelerated Diagnostics" "Cerebral Overwriter" "Shipment from SanSan" + "Hedge Fund" "Back Channels"]}}) (starting-hand state :corp ["Accelerated Diagnostics" "Cerebral Overwriter"]) (play-from-hand state :corp "Cerebral Overwriter" "New remote") (core/gain state :corp :credit 1) @@ -110,10 +105,9 @@ (is (= 15 (:credit (get-corp))) "Corp gained 6 credits for Back Channels")))) (testing "Interaction with Current" (do-game - (new-game (default-corp ["Accelerated Diagnostics" "Cerebral Overwriter" + (new-game {:corp {:deck ["Accelerated Diagnostics" "Cerebral Overwriter" "Enhanced Login Protocol" "Shipment from SanSan" - "Hedge Fund"]) - (default-runner)) + "Hedge Fund"]}}) (starting-hand state :corp ["Accelerated Diagnostics" "Cerebral Overwriter"]) (play-from-hand state :corp "Cerebral Overwriter" "New remote") (core/gain state :corp :credit 3) @@ -134,11 +128,10 @@ (click-card state :corp hf) (is (= 9 (:credit (get-corp))) "Corp gained credits from Hedge Fund"))))) -(deftest an-offer-you-can't-refuse +(deftest an-offer-you-can-t-refuse ;; An Offer You Can't Refuse - exact card added to score area, not the last discarded one (do-game - (new-game (default-corp ["Celebrity Gift" "An Offer You Can't Refuse"]) - (default-runner)) + (new-game {:corp {:deck ["Celebrity Gift" "An Offer You Can't Refuse"]}}) (play-from-hand state :corp "An Offer You Can't Refuse") (click-prompt state :corp "R&D") (core/move state :corp (find-card "Celebrity Gift" (:hand (get-corp))) :discard) @@ -153,10 +146,9 @@ (deftest attitude-adjustment ;; Attitude Adjustment (do-game - (new-game (default-corp ["Attitude Adjustment" + (new-game {:corp {:deck ["Attitude Adjustment" (qty "Hostile Takeover" 2) - (qty "Ice Wall" 10)]) - (default-runner)) + (qty "Ice Wall" 10)]}}) (starting-hand state :corp ["Attitude Adjustment" "Hostile Takeover" "Hostile Takeover"]) (trash-from-hand state :corp "Hostile Takeover") (let [hand (-> (get-corp) :hand count dec)] ;; cuz we're playing Attitude Adjustment @@ -176,8 +168,8 @@ (deftest biased-reporting ;; Biased Reporting (do-game - (new-game (default-corp ["Biased Reporting"]) - (default-runner [(qty "Fan Site" 5)])) + (new-game {:corp {:deck ["Biased Reporting"]} + :runner {:deck [(qty "Fan Site" 5)]}}) (take-credits state :corp) (starting-hand state :runner (repeat 5 "Fan Site")) (core/gain state :runner :click 10) @@ -196,8 +188,7 @@ (deftest big-brother ;; Big Brother - Give the Runner 2 tags if already tagged (do-game - (new-game (default-corp ["Big Brother"]) - (default-runner)) + (new-game {:corp {:deck ["Big Brother"]}}) (play-from-hand state :corp "Big Brother") (is (= 1 (count (:hand (get-corp)))) "Card not played because Runner has no tags") (core/gain-tags state :runner 1) @@ -207,8 +198,7 @@ (deftest biotic-labor ;; Biotic Labor - Gain 2 clicks (do-game - (new-game (default-corp ["Biotic Labor"]) - (default-runner)) + (new-game {:corp {:deck ["Biotic Labor"]}}) (play-from-hand state :corp "Biotic Labor") (is (= 1 (:credit (get-corp)))) (is (= 4 (:click (get-corp))) "Spent 1 click to gain 2 additional clicks"))) @@ -216,10 +206,9 @@ (deftest blue-level-clearance ;; Blue Level Clearance - Gain 5 credits and draw 2 cards (do-game - (new-game (default-corp [(qty "Blue Level Clearance" 3) + (new-game {:corp {:deck [(qty "Blue Level Clearance" 3) (qty "Hedge Fund" 3) - (qty "Sweeps Week" 2)]) - (default-runner)) + (qty "Sweeps Week" 2)]}}) (play-from-hand state :corp "Blue Level Clearance") (is (= 8 (:credit (get-corp))) "Gained 5 credits") (is (= 1 (:click (get-corp)))) @@ -229,8 +218,7 @@ ;; Building Blocks - install and rez a barrier from HQ at no cost (testing "Basic behavior" (do-game - (new-game (default-corp ["Building Blocks" "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Building Blocks" "Ice Wall"]}}) (core/gain state :corp :credit 1) (is (= 6 (:credit (get-corp))) "Corp starts with 6 credits") (play-from-hand state :corp "Building Blocks") @@ -242,8 +230,7 @@ (is (:rezzed (refresh iw)) "Ice Wall is installed and rezzed")))) (testing "Select invalid card" (do-game - (new-game (default-corp ["Building Blocks" "Hedge Fund" "Cortex Lock"]) - (default-runner)) + (new-game {:corp {:deck ["Building Blocks" "Hedge Fund" "Cortex Lock"]}}) (core/gain state :corp :credit 1) (play-from-hand state :corp "Building Blocks") (is (= "Select a target for Building Blocks" (:msg (first (:prompt (get-corp))))) "Starting prompt is correct") @@ -255,9 +242,8 @@ (deftest casting-call ;; Casting Call - Only do card-init on the Public agendas. Issue #1128 (do-game - (new-game (default-corp [(qty "Casting Call" 2) "Oaktown Renovation" - "Improved Tracers" "Hunter"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Casting Call" 2) "Oaktown Renovation" + "Improved Tracers" "Hunter"]}}) (core/gain state :corp :click 1) (play-from-hand state :corp "Hunter" "HQ") (let [hunter (get-ice state :hq 0)] @@ -285,8 +271,7 @@ ;; Cerebral Cast (testing "Runner wins" (do-game - (new-game (default-corp ["Cerebral Cast"]) - (default-runner)) + (new-game {:corp {:deck ["Cerebral Cast"]}}) (play-from-hand state :corp "Cerebral Cast") (is (= 3 (:click (get-corp))) "Cerebral Cast precondition not met; card not played") (take-credits state :corp) @@ -299,8 +284,7 @@ (is (zero? (count-tags state)) "Runner took no tags"))) (testing "Corp wins" (do-game - (new-game (default-corp [(qty "Cerebral Cast" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Cerebral Cast" 2)]}}) (take-credits state :corp) (run-empty-server state "Archives") (take-credits state :runner) @@ -321,8 +305,9 @@ ;; Cerebral Static (testing "vs Chaos Theory" (do-game - (new-game (default-corp ["Cerebral Static" "Lag Time"]) - (make-deck "Chaos Theory: Wünderkind" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Cerebral Static" "Lag Time"]} + :runner {:id "Chaos Theory: Wünderkind" + :deck [(qty "Sure Gamble" 3)]}}) (is (= 5 (core/available-mu state)) "CT starts with 5 memory") (play-from-hand state :corp "Cerebral Static") (is (= 4 (core/available-mu state)) "Cerebral Static causes CT to have 4 memory") @@ -332,8 +317,7 @@ (deftest closed-accounts ;; Closed Accounts - Play if Runner is tagged to make Runner lose all credits (do-game - (new-game (default-corp ["Closed Accounts"]) - (default-runner)) + (new-game {:corp {:deck ["Closed Accounts"]}}) (play-from-hand state :corp "Closed Accounts") (is (and (= 3 (:click (get-corp))) (= 5 (:credit (get-runner)))) @@ -346,9 +330,8 @@ ;; Commercialization (testing "Single advancement token" (do-game - (new-game (default-corp ["Commercialization" - "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Commercialization" + "Ice Wall"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (core/add-counter state :corp (refresh (get-ice state :hq 0)) :advancement 1) (play-from-hand state :corp "Commercialization") @@ -356,9 +339,8 @@ (is (= 6 (:credit (get-corp))) "Gained 1 for single advanced ice from Commercialization"))) (testing "Two advancement tokens" (do-game - (new-game (default-corp ["Commercialization" - "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Commercialization" + "Ice Wall"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (core/add-counter state :corp (refresh (get-ice state :hq 0)) :advancement 2) (play-from-hand state :corp "Commercialization") @@ -369,12 +351,11 @@ ;; Consulting Visit - Only show single copies of operations corp can afford as choices. Play chosen operation (testing "Basic test" (do-game - (new-game (default-corp ["Consulting Visit" + (new-game {:corp {:deck ["Consulting Visit" (qty "Beanstalk Royalties" 2) "Green Level Clearance" "Breaking News" - "Hedge Fund"]) - (default-runner)) + "Hedge Fund"]}}) (is (= 5 (:credit (get-corp)))) (starting-hand state :corp ["Consulting Visit"]) (play-from-hand state :corp "Consulting Visit") @@ -385,14 +366,13 @@ (is (= 6 (:credit (get-corp))))))) (testing "Works properly when played with Mumbad City Hall" (do-game - (new-game (default-corp ["Mumbad City Hall" + (new-game {:corp {:deck ["Mumbad City Hall" "Beanstalk Royalties" "Green Level Clearance" "Breaking News" "Hedge Fund" "Consulting Visit" - "Mumba Temple"]) - (default-runner)) + "Mumba Temple"]}}) (is (= 5 (:credit (get-corp)))) (starting-hand state :corp ["Mumbad City Hall"]) (play-from-hand state :corp "Mumbad City Hall" "New remote") @@ -411,8 +391,8 @@ ;; Death and Taxes gain credit on runner install, runner trash installed card ;; Also regression test for #3160 (do-game - (new-game (default-corp ["Death and Taxes" "PAD Campaign"]) - (default-runner ["Aumakua" "DaVinci" "Fall Guy"])) + (new-game {:corp {:deck ["Death and Taxes" "PAD Campaign"]} + :runner {:deck ["Aumakua" "DaVinci" "Fall Guy"]}}) (play-from-hand state :corp "Death and Taxes") (is (= (- 5 2) (:credit (get-corp))) "Corp paid 2 to play Death and Taxes") (play-from-hand state :corp "PAD Campaign" "New remote") @@ -433,8 +413,8 @@ (deftest defective-brainchips ;; Defective Brainchips - Do 1 add'l brain damage the first time Runner takes some each turn (do-game - (new-game (default-corp ["Defective Brainchips" "Viktor 1.0"]) - (default-runner [(qty "Sure Gamble" 2) (qty "Shiv" 2)])) + (new-game {:corp {:deck ["Defective Brainchips" "Viktor 1.0"]} + :runner {:deck [(qty "Sure Gamble" 2) (qty "Shiv" 2)]}}) (play-from-hand state :corp "Defective Brainchips") (play-from-hand state :corp "Viktor 1.0" "HQ") (take-credits state :corp) @@ -450,8 +430,7 @@ (deftest distract-the-masses (do-game - (new-game (default-corp [(qty "Distract the Masses" 2) (qty "Hedge Fund" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Distract the Masses" 2) (qty "Hedge Fund" 3)]}}) (starting-hand state :corp ["Hedge Fund" "Hedge Fund" "Hedge Fund" "Distract the Masses" "Distract the Masses"]) (play-from-hand state :corp "Distract the Masses") (click-card state :corp (first (:hand (get-corp)))) @@ -474,10 +453,9 @@ (deftest diversified-portfolio (do-game - (new-game (default-corp ["Diversified Portfolio" + (new-game {:corp {:deck ["Diversified Portfolio" "Paper Wall" - (qty "PAD Campaign" 3)]) - (default-runner)) + (qty "PAD Campaign" 3)]}}) (core/gain state :corp :click 2) (play-from-hand state :corp "Paper Wall" "New remote") (play-from-hand state :corp "PAD Campaign" "New remote") @@ -488,8 +466,7 @@ (deftest divert-power (do-game - (new-game (default-corp [(qty "Divert Power" 2) "Paper Wall" (qty "Eve Campaign" 3) ]) - (default-runner)) + (new-game {:corp {:deck [(qty "Divert Power" 2) "Paper Wall" (qty "Eve Campaign" 3) ]}}) (core/gain state :corp :click 3 :credit 11) (play-from-hand state :corp "Paper Wall" "HQ") (play-from-hand state :corp "Eve Campaign" "New remote") @@ -508,24 +485,19 @@ (click-card state :corp (refresh pw)) (click-card state :corp (refresh ec1)) (click-prompt state :corp "Done")) - (testing "Choose a target to rez for -6 cost" (click-card state :corp (refresh ec3))) - (is (core/rezzed? (refresh ec3)) "Eve Campaign was rezzed") (is (= 4 (:credit (get-corp))) "Rezzed Eve Campaign for 0 credits") (is (not (core/rezzed? (refresh pw))) "Paper Wall was derezzed") (is (not (core/rezzed? (refresh ec1))) "First Eve Campaign was derezzed") (is (= 16 (get-counters (refresh ec3) :credit)) "Eve gained 16 credits on rez") - (play-from-hand state :corp "Divert Power") (testing "Choose 1 target to derez" (click-card state :corp (refresh ec2)) (click-prompt state :corp "Done")) - (testing "Choose a target to rez for -3 cost" (click-card state :corp (refresh ec1))) - (is (core/rezzed? (refresh ec1)) "First Eve Campaign was rezzed") (is (= 0 (:credit (get-corp))) "Rezzed Eve Campaign for 2 credits") (is (not (core/rezzed? (refresh ec2))) "Second Eve Campaign was derezzed") @@ -534,8 +506,7 @@ (deftest door-to-door ;; Door to Door (do-game - (new-game (default-corp ["Door to Door"]) - (default-runner)) + (new-game {:corp {:deck ["Door to Door"]}}) (play-from-hand state :corp "Door to Door") (take-credits state :corp) (is (zero? (count-tags state)) "Runner should start with 0 tags") @@ -554,8 +525,7 @@ (deftest economic-warfare ;; Economic Warfare - If successful run last turn, make the runner lose 4 credits if able (do-game - (new-game (default-corp [(qty "Economic Warfare" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Economic Warfare" 3)]}}) (play-from-hand state :corp "Economic Warfare") (is (= 5 (:credit (get-runner))) "Runner has 5 credits") (is (= 3 (count (:hand (get-corp)))) "Corp still has 3 cards") @@ -575,27 +545,27 @@ (deftest election-day (do-game - (new-game (default-corp [(qty "Election Day" 7)]) - (default-runner)) - (is (= 6 (count (:hand (get-corp)))) "Corp starts with 5 + 1 cards") - (core/move state :corp (find-card "Election Day" (:hand (get-corp))) :deck) - (core/move state :corp (find-card "Election Day" (:hand (get-corp))) :deck) - (core/move state :corp (find-card "Election Day" (:hand (get-corp))) :deck) - (core/move state :corp (find-card "Election Day" (:hand (get-corp))) :deck) - (core/move state :corp (find-card "Election Day" (:hand (get-corp))) :deck) - (play-from-hand state :corp "Election Day") - (is (= 1 (count (:hand (get-corp)))) "Could not play Election Day") - (take-credits state :corp) - (take-credits state :runner) - (is (= 2 (count (:hand (get-corp)))) "Corp has now 1 + 1 cards before Election Day") - (play-from-hand state :corp "Election Day") - (is (= 5 (count (:hand (get-corp)))) "Corp has now 5 cards due to Election Day"))) + (new-game {:corp {:deck [(qty "Election Day" 7)]}}) + (is (= 6 (count (:hand (get-corp)))) "Corp starts with 5 + 1 cards") + (core/move state :corp (find-card "Election Day" (:hand (get-corp))) :deck) + (core/move state :corp (find-card "Election Day" (:hand (get-corp))) :deck) + (core/move state :corp (find-card "Election Day" (:hand (get-corp))) :deck) + (core/move state :corp (find-card "Election Day" (:hand (get-corp))) :deck) + (core/move state :corp (find-card "Election Day" (:hand (get-corp))) :deck) + (play-from-hand state :corp "Election Day") + (is (= 1 (count (:hand (get-corp)))) "Could not play Election Day") + (take-credits state :corp) + (take-credits state :runner) + (is (= 2 (count (:hand (get-corp)))) "Corp has now 1 + 1 cards before Election Day") + (play-from-hand state :corp "Election Day") + (is (= 5 (count (:hand (get-corp)))) "Corp has now 5 cards due to Election Day"))) (deftest enforcing-loyalty ;; Enforcing Loyalty - Win trace to trash installed card not of Runner's faction (do-game - (new-game (default-corp [(qty "Enforcing Loyalty" 2)]) - (make-deck "Chaos Theory: Wünderkind" ["Inti" "Caldera"])) + (new-game {:corp {:deck [(qty "Enforcing Loyalty" 2)]} + :runner {:id "Chaos Theory: Wünderkind" + :deck ["Inti" "Caldera"]}}) (take-credits state :corp) (play-from-hand state :runner "Inti") (play-from-hand state :runner "Caldera") @@ -612,8 +582,8 @@ ;; Enhanced Login Protocol (testing "First click run each turn costs an additional click" (do-game - (new-game (default-corp ["Enhanced Login Protocol"]) - (default-runner ["Employee Strike"])) + (new-game {:corp {:deck ["Enhanced Login Protocol"]} + :runner {:deck ["Employee Strike"]}}) (play-from-hand state :corp "Enhanced Login Protocol") (take-credits state :corp) (is (= 4 (:click (get-runner))) "Runner has 4 clicks") @@ -638,8 +608,8 @@ (is (= 2 (:click (get-runner))) "Runner doesn't spend 1 additional click to make a run"))) (testing "Card ability runs don't cost additional clicks" (do-game - (new-game (default-corp ["Enhanced Login Protocol"]) - (default-runner ["Sneakdoor Beta"])) + (new-game {:corp {:deck ["Enhanced Login Protocol"]} + :runner {:deck ["Sneakdoor Beta"]}}) (play-from-hand state :corp "Enhanced Login Protocol") (take-credits state :corp) (play-from-hand state :runner "Sneakdoor Beta") @@ -660,9 +630,8 @@ (is (= 2 (:click (get-runner))) "Runner spends 1 additional click to make a run")))) (testing "with New Angeles Sol, Enhanced Login Protocol trashed and reinstalled on steal doesn't double remove penalty" (do-game - (new-game - (make-deck "New Angeles Sol: Your News" ["Enhanced Login Protocol" "Breaking News"]) - (default-runner)) + (new-game {:corp {:id "New Angeles Sol: Your News" + :deck ["Enhanced Login Protocol" "Breaking News"]}}) (play-from-hand state :corp "Breaking News" "New remote") (play-from-hand state :corp "Enhanced Login Protocol") (take-credits state :corp) @@ -675,8 +644,8 @@ (is (= 1 (:click (get-runner))) "Runner has 1 click"))) (testing "Run event don't cost additional clicks" (do-game - (new-game (default-corp ["Enhanced Login Protocol"]) - (default-runner ["Out of the Ashes"])) + (new-game {:corp {:deck ["Enhanced Login Protocol"]} + :runner {:deck ["Out of the Ashes"]}}) (play-from-hand state :corp "Enhanced Login Protocol") (take-credits state :corp) (is (= 4 (:click (get-runner))) "Runner has 4 clicks") @@ -695,10 +664,10 @@ (is (= 2 (:click (get-runner))) "Runner spends 1 additional click to make a run"))) (testing "Works when played on the runner's turn" (do-game - (new-game (make-deck "New Angeles Sol: Your News" - ["Enhanced Login Protocol" - "Breaking News"]) - (default-runner ["Hades Shard"])) + (new-game {:corp {:id "New Angeles Sol: Your News" + :deck ["Enhanced Login Protocol" + "Breaking News"]} + :runner {:deck ["Hades Shard"]}}) (trash-from-hand state :corp "Breaking News") (take-credits state :corp) (core/gain state :runner :credit 2) @@ -713,10 +682,10 @@ (is (= 1 (:click (get-runner))) "Runner spends 1 additional click to make a run"))) (testing "Doesn't fire if already run when played on the runner's turn" (do-game - (new-game (make-deck "New Angeles Sol: Your News" - ["Enhanced Login Protocol" - "Breaking News"]) - (default-runner ["Hades Shard"])) + (new-game {:corp {:id "New Angeles Sol: Your News" + :deck ["Enhanced Login Protocol" + "Breaking News"]} + :runner {:deck ["Hades Shard"]}}) (trash-from-hand state :corp "Breaking News") (take-credits state :corp) (run-on state :hq) @@ -737,12 +706,11 @@ ;; Exchange of Information (testing "Basic test" (do-game - (new-game (default-corp ["Exchange of Information" + (new-game {:corp {:deck ["Exchange of Information" "Market Research" "Breaking News" "Project Beale" - "Explode-a-palooza"]) - (default-runner)) + "Explode-a-palooza"]}}) (score-agenda state :corp (find-card "Market Research" (:hand (get-corp)))) (score-agenda state :corp (find-card "Breaking News" (:hand (get-corp)))) (is (= 2 (count-tags state)) "Runner gained 2 tags") @@ -761,12 +729,11 @@ (is (= 4 (:agenda-point (get-corp)))))) (testing "Swapping a just scored Breaking News keeps the tags" (do-game - (new-game (default-corp ["Exchange of Information" + (new-game {:corp {:deck ["Exchange of Information" "Market Research" "Breaking News" "Project Beale" - "Explode-a-palooza"]) - (default-runner)) + "Explode-a-palooza"]}}) (take-credits state :corp) (core/steal state :runner (find-card "Project Beale" (:hand (get-corp)))) (core/steal state :runner (find-card "Explode-a-palooza" (:hand (get-corp)))) @@ -783,9 +750,8 @@ (is (= 2 (count-tags state)) "Runner does not lose tags at end of turn"))) (testing "Swapping a 15 Minutes still keeps the ability. #1783" (do-game - (new-game (default-corp [(qty "Exchange of Information" 2) "15 Minutes" - "Project Beale"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Exchange of Information" 2) "15 Minutes" + "Project Beale"]}}) (score-agenda state :corp (find-card "15 Minutes" (:hand (get-corp)))) (take-credits state :corp) (core/gain-tags state :runner 1) @@ -821,9 +787,8 @@ (is (= "15 Minutes" (:title (first (:deck (get-corp)))))))) (testing "Swapping a Mandatory Upgrades gives the Corp an additional click per turn. #1687" (do-game - (new-game (default-corp [(qty "Exchange of Information" 2) "Mandatory Upgrades" - "Global Food Initiative"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Exchange of Information" 2) "Mandatory Upgrades" + "Global Food Initiative"]}}) (score-agenda state :corp (find-card "Global Food Initiative" (:hand (get-corp)))) (take-credits state :corp) (core/gain-tags state :runner 1) @@ -859,9 +824,9 @@ (deftest fast-break ;; Fast Break (do-game - (new-game (default-corp ["Fast Break" "Hostile Takeover" "Keegan Lane" "Haas Arcology AI" - "Research Station" (qty "Ice Wall" 10)]) - (default-runner [(qty "Fan Site" 3)])) + (new-game {:corp {:deck ["Fast Break" "Hostile Takeover" "Keegan Lane" "Haas Arcology AI" + "Research Station" (qty "Ice Wall" 10)]} + :runner {:deck [(qty "Fan Site" 3)]}}) (starting-hand state :corp ["Fast Break" "Hostile Takeover" "Keegan Lane" "Haas Arcology AI" "Research Station"]) (take-credits state :corp) @@ -899,8 +864,8 @@ (deftest foxfire ;; Foxfire (do-game - (new-game (default-corp [(qty "Foxfire" 2)]) - (default-runner ["Dyson Mem Chip" "Ice Carver"])) + (new-game {:corp {:deck [(qty "Foxfire" 2)]} + :runner {:deck ["Dyson Mem Chip" "Ice Carver"]}}) (take-credits state :corp) (core/gain state :runner :credit 100) (play-from-hand state :runner "Dyson Mem Chip") @@ -920,15 +885,16 @@ (deftest game-changer (letfn [(game-changer-test [num-agenda] (do-game - (new-game (default-corp ["Game Changer" "Hostile Takeover"]) - (default-corp [(qty "Fan Site" num-agenda)])) + (new-game {:corp {:deck ["Game Changer" "Hostile Takeover"]} + :runner {:deck [(qty "Fan Site" num-agenda)]}}) (take-credits state :corp) (core/gain state :runner :click num-agenda) (dotimes [_ num-agenda] (play-from-hand state :runner "Fan Site")) (take-credits state :runner) (play-and-score state "Hostile Takeover") - (is (= num-agenda (count (get-scored state :runner))) (str "Runner should have " (utils/quantify num-agenda "Fan Site") " in play")) + (is (= num-agenda (count (get-scored state :runner))) + (str "Runner should have " (utils/quantify num-agenda "Fan Site") " in play")) (let [clicks (:click (get-corp)) n (dec num-agenda)] (play-from-hand state :corp "Game Changer") @@ -941,8 +907,7 @@ (doseq [choice ["Yes" "No"]] (testing (str "choosing to " (when (= choice "No") "not ") "access card") (do-game - (new-game (default-corp ["Hostile Takeover" "Dedicated Response Team" "Hangeki"]) - (default-runner)) + (new-game {:corp {:deck ["Hostile Takeover" "Dedicated Response Team" "Hangeki"]}}) (play-from-hand state :corp "Hostile Takeover" "New remote") (play-from-hand state :corp "Dedicated Response Team" "New remote") (take-credits state :corp) @@ -964,8 +929,7 @@ (deftest hard-hitting-news ;; Hard-Hitting News (do-game - (new-game (default-corp ["Hard-Hitting News"]) - (default-runner)) + (new-game {:corp {:deck ["Hard-Hitting News"]}}) (take-credits state :corp) (run-empty-server state :rd) (take-credits state :runner) @@ -980,8 +944,8 @@ (deftest hatchet-job ;; Hatchet Job - Win trace to add installed non-virtual to grip (do-game - (new-game (default-corp ["Hatchet Job"]) - (default-runner ["Upya" "Ghost Runner"])) + (new-game {:corp {:deck ["Hatchet Job"]} + :runner {:deck ["Upya" "Ghost Runner"]}}) (take-credits state :corp) (play-from-hand state :runner "Ghost Runner") (play-from-hand state :runner "Upya") @@ -997,7 +961,7 @@ (deftest hedge-fund (do-game - (new-game (default-corp) (default-runner)) + (new-game) (is (= 5 (:credit (get-corp)))) (play-from-hand state :corp "Hedge Fund") (is (= 9 (:credit (get-corp)))))) @@ -1005,8 +969,8 @@ (deftest hellion-alpha-test ;; Hellion Alpha Test (do-game - (new-game (default-corp [(qty "Hellion Alpha Test" 2)]) - (default-runner ["Daily Casts"])) + (new-game {:corp {:deck [(qty "Hellion Alpha Test" 2)]} + :runner {:deck ["Daily Casts"]}}) (take-credits state :corp) (play-from-hand state :runner "Daily Casts") (take-credits state :runner) @@ -1032,8 +996,8 @@ ;; Hellion Beta Test (testing "Winning Trace - Trashing 2 cards" (do-game - (new-game (default-corp ["Dedicated Response Team" "Hellion Beta Test"]) - (default-runner ["Daily Casts" "Dyson Mem Chip"])) + (new-game {:corp {:deck ["Dedicated Response Team" "Hellion Beta Test"]} + :runner {:deck ["Daily Casts" "Dyson Mem Chip"]}}) (play-from-hand state :corp "Dedicated Response Team" "New remote") (take-credits state :corp) (core/gain state :runner :credit 100) @@ -1051,8 +1015,8 @@ (is (= 2 (-> (get-runner) :discard count)) "Runner should have 2 cards in heap after losing Hellion Beta Test trace"))) (testing "Losing trace - Gaining bad publicity" (do-game - (new-game (default-corp ["Dedicated Response Team" "Hellion Beta Test"]) - (default-runner ["Daily Casts" "Dyson Mem Chip"])) + (new-game {:corp {:deck ["Dedicated Response Team" "Hellion Beta Test"]} + :runner {:deck ["Daily Casts" "Dyson Mem Chip"]}}) (play-from-hand state :corp "Dedicated Response Team" "New remote") (take-credits state :corp) (core/gain state :runner :credit 100) @@ -1070,29 +1034,28 @@ (deftest high-profile-target (testing "when the runner has no tags" (do-game - (new-game (default-corp [(qty "High-Profile Target" 6)]) - (default-runner [(qty "Sure Gamble" 3) (qty "Lucky Find" 3)])) + (new-game {:corp {:deck [(qty "High-Profile Target" 6)]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Lucky Find" 3)]}}) (play-from-hand state :corp "High-Profile Target") (is (= 3 (:click (get-corp))) "Corp not charged a click") (is (= 5 (count (:hand (get-runner)))) "Runner did not take damage"))) (testing "when the runner has one tag" (do-game - (new-game (default-corp [(qty "High-Profile Target" 6)]) - (default-runner [(qty "Sure Gamble" 3) (qty "Lucky Find" 3)])) + (new-game {:corp {:deck [(qty "High-Profile Target" 6)]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Lucky Find" 3)]}}) (core/gain-tags state :runner 1) (play-from-hand state :corp "High-Profile Target") (is (= 3 (count (:hand (get-runner)))) "Runner has 3 cards in hand"))) (testing "when the runner has two tags" (do-game - (new-game (default-corp [(qty "High-Profile Target" 6)]) - (default-runner [(qty "Sure Gamble" 3) (qty "Lucky Find" 3)])) + (new-game {:corp {:deck [(qty "High-Profile Target" 6)]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Lucky Find" 3)]}}) (core/gain-tags state :runner 2) (play-from-hand state :corp "High-Profile Target") (is (= 1 (count (:hand (get-runner)))) "Runner has 1 card in hand"))) (testing "When the runner has three tags, gg" (do-game - (new-game (default-corp [(qty "High-Profile Target" 10)]) - (default-runner)) + (new-game {:corp {:deck [(qty "High-Profile Target" 10)]}}) (core/gain-tags state :runner 3) (play-from-hand state :corp "High-Profile Target") (is (zero? (count (:hand (get-runner)))) "Runner has 0 cards in hand") @@ -1102,8 +1065,8 @@ (deftest housekeeping ;; Housekeeping - Runner must trash a card from Grip on first install of a turn (do-game - (new-game (default-corp ["Housekeeping"]) - (default-runner [(qty "Cache" 2) "Fall Guy" "Mr. Li"])) + (new-game {:corp {:deck ["Housekeeping"]} + :runner {:deck [(qty "Cache" 2) "Fall Guy" "Mr. Li"]}}) (take-credits state :corp) (play-from-hand state :runner "Fall Guy") (take-credits state :runner) @@ -1119,8 +1082,8 @@ (deftest invasion-of-privacy ;; Invasion of Privacy - Full test (do-game - (new-game (default-corp [(qty "Invasion of Privacy" 3)]) - (default-runner [(qty "Sure Gamble" 2) "Fall Guy" (qty "Cache" 2)])) + (new-game {:corp {:deck [(qty "Invasion of Privacy" 3)]} + :runner {:deck [(qty "Sure Gamble" 2) "Fall Guy" (qty "Cache" 2)]}}) (core/gain state :corp :click 3 :credit 6) ;; trash 2 cards (play-from-hand state :corp "Invasion of Privacy") @@ -1153,9 +1116,7 @@ (deftest ipo ;; IPO - credits with Terminal operations (do-game - (new-game - (default-corp ["IPO"]) - (default-runner)) + (new-game {:corp {:deck ["IPO"]}}) (take-credits state :corp) (take-credits state :runner) (play-from-hand state :corp "IPO") @@ -1165,8 +1126,7 @@ (deftest kill-switch ;; Kill Switch (do-game - (new-game (default-corp ["Kill Switch" (qty "Hostile Takeover" 2)]) - (default-runner)) + (new-game {:corp {:deck ["Kill Switch" (qty "Hostile Takeover" 2)]}}) (play-from-hand state :corp "Kill Switch") (play-from-hand state :corp "Hostile Takeover" "New remote") (is (zero? (:brain-damage (get-runner))) "Runner should start with 0 brain damage") @@ -1183,8 +1143,7 @@ (deftest lag-time (do-game - (new-game (default-corp ["Lag Time" "Vanilla" "Lotus Field"]) - (default-runner)) + (new-game {:corp {:deck ["Lag Time" "Vanilla" "Lotus Field"]}}) (take-credits state :corp) (take-credits state :runner) (play-from-hand state :corp "Vanilla" "HQ") @@ -1197,21 +1156,19 @@ (deftest lateral-growth (do-game - (new-game (default-corp ["Lateral Growth" "Breaking News"]) - (default-runner)) + (new-game {:corp {:deck ["Lateral Growth" "Breaking News"]}}) (is (= 5 (:credit (get-corp)))) (play-from-hand state :corp "Lateral Growth") (click-card state :corp (find-card "Breaking News" (:hand (get-corp)))) (click-prompt state :corp "New remote") (is (= "Breaking News" (:title (get-content state :remote1 0))) - "Breaking News installed by Lateral Growth") + "Breaking News installed by Lateral Growth") (is (= 7 (:credit (get-corp)))))) (deftest manhunt ;; Manhunt - only fires once per turn. Unreported issue. (do-game - (new-game (default-corp ["Manhunt" (qty "Hedge Fund" 3)]) - (default-runner)) + (new-game {:corp {:deck ["Manhunt" (qty "Hedge Fund" 3)]}}) (play-from-hand state :corp "Manhunt") (take-credits state :corp) (run-empty-server state "HQ") @@ -1232,8 +1189,7 @@ [{:keys [tag-count runner-creds expected-credit-diff]}] (testing (str "when the runner has " tag-count " tags and " runner-creds " credits") (do-game - (new-game (default-corp [(qty "Market Forces" 6)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Market Forces" 6)]}}) (swap! state assoc-in [:corp :credit] 0) (swap! state assoc-in [:runner :credit] runner-creds) (core/gain-tags state :runner tag-count) @@ -1260,8 +1216,7 @@ :expected-credit-diff 5}])))) (testing "when the runner is not tagged" (do-game - (new-game (default-corp [(qty "Market Forces" 6)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Market Forces" 6)]}}) (play-from-hand state :corp "Market Forces") (is (= 6 (count (:hand (get-corp)))) "Market Forces is not played") @@ -1273,9 +1228,8 @@ (deftest mass-commercialization ;; Mass Commercialization (do-game - (new-game (default-corp ["Mass Commercialization" - (qty "Ice Wall" 3)]) - (default-runner)) + (new-game {:corp {:deck ["Mass Commercialization" + (qty "Ice Wall" 3)]}}) (play-from-hand state :corp "Ice Wall" "HQ") (play-from-hand state :corp "Ice Wall" "R&D") (play-from-hand state :corp "Ice Wall" "Archives") @@ -1290,8 +1244,7 @@ (deftest medical-research-fundraiser ;; Medical Research Fundraiser - runner gains 8creds, runner gains 3creds (do-game - (new-game (default-corp ["Medical Research Fundraiser"]) - (default-runner)) + (new-game {:corp {:deck ["Medical Research Fundraiser"]}}) (is (= 5 (:credit (get-corp))) "Corp starts with 5 credits") (is (= 5 (:credit (get-runner))) "Runner starts with 5 credits") (play-from-hand state :corp "Medical Research Fundraiser") @@ -1301,8 +1254,7 @@ (deftest midseason-replacements ;; Midseason Replacements - Trace to give Runner tags after they steal an agenda (do-game - (new-game (default-corp ["Midseason Replacements" "Breaking News"]) - (default-runner)) + (new-game {:corp {:deck ["Midseason Replacements" "Breaking News"]}}) (play-from-hand state :corp "Midseason Replacements") (is (= 3 (:click (get-corp))) "Midseason precondition not met; Corp not charged a click") (play-from-hand state :corp "Breaking News" "New remote") @@ -1321,8 +1273,7 @@ (deftest mushin-no-shin ;; Mushin No Shin - Add 3 advancements to a card; prevent rez/score of that card the rest of the turn (do-game - (new-game (default-corp [(qty "Mushin No Shin" 2) "Ronin" "Profiteering"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Mushin No Shin" 2) "Ronin" "Profiteering"]}}) (play-from-hand state :corp "Mushin No Shin") (click-card state :corp (find-card "Ronin" (:hand (get-corp)))) (let [ronin (get-content state :remote1 0)] @@ -1349,8 +1300,7 @@ ;; Mutate - trash a rezzed piece of ice, install and rez one from R&D (testing "Basic operation" (do-game - (new-game (default-corp ["Mutate" "Ice Wall" "Enigma" "Hedge Fund"]) - (default-runner)) + (new-game {:corp {:deck ["Mutate" "Ice Wall" "Enigma" "Hedge Fund"]}}) (core/move state :corp (find-card "Hedge Fund" (:hand (get-corp))) :deck) (core/move state :corp (find-card "Enigma" (:hand (get-corp))) :deck) (play-from-hand state :corp "Ice Wall" "HQ") @@ -1366,8 +1316,7 @@ (is (second-last-log-contains? state "Enigma") "Installed card name was logged"))) (testing "No ice in R&D" (do-game - (new-game (default-corp ["Mutate" "Ice Wall" "Enigma" "Hedge Fund"]) - (default-runner)) + (new-game {:corp {:deck ["Mutate" "Ice Wall" "Enigma" "Hedge Fund"]}}) (core/move state :corp (find-card "Hedge Fund" (:hand (get-corp))) :deck) (play-from-hand state :corp "Ice Wall" "HQ") (core/rez state :corp (get-ice state :hq 0)) @@ -1379,8 +1328,7 @@ (is (second-last-log-contains? state "Hedge Fund") "Skipped card name was logged"))) (testing "Remote server" (do-game - (new-game (default-corp ["Mutate" "Ice Wall" "Enigma" "Hedge Fund"]) - (default-runner)) + (new-game {:corp {:deck ["Mutate" "Ice Wall" "Enigma" "Hedge Fund"]}}) (core/move state :corp (find-card "Hedge Fund" (:hand (get-corp))) :deck) (core/move state :corp (find-card "Enigma" (:hand (get-corp))) :deck) (play-from-hand state :corp "Ice Wall" "New remote") @@ -1398,8 +1346,7 @@ (deftest neural-emp ;; Neural EMP - Play if Runner made a run the previous turn to do 1 net damage (do-game - (new-game (default-corp ["Neural EMP"]) - (default-runner)) + (new-game {:corp {:deck ["Neural EMP"]}}) (play-from-hand state :corp "Neural EMP") (is (= 3 (:click (get-corp))) "Neural precondition not met; card not played") (take-credits state :corp) @@ -1411,8 +1358,7 @@ (deftest oversight-ai ;; Oversight AI - Rez a piece of ICE ignoring all costs (do-game - (new-game (default-corp ["Oversight AI" "Archer"]) - (default-runner)) + (new-game {:corp {:deck ["Oversight AI" "Archer"]}}) (play-from-hand state :corp "Archer" "R&D") (let [archer (get-ice state :rd 0)] (play-from-hand state :corp "Oversight AI") @@ -1425,8 +1371,7 @@ (deftest patch ;; Patch - +2 current strength (do-game - (new-game (default-corp ["Patch" "Vanilla"]) - (default-runner)) + (new-game {:corp {:deck ["Patch" "Vanilla"]}}) (play-from-hand state :corp "Vanilla" "HQ") (core/rez state :corp (get-ice state :hq 0)) (play-from-hand state :corp "Patch") @@ -1436,8 +1381,7 @@ (deftest paywall-implementation ;; Paywall Implementation - Gain 1 credit for every successful run (do-game - (new-game (default-corp ["Paywall Implementation"]) - (default-runner)) + (new-game {:corp {:deck ["Paywall Implementation"]}}) (play-from-hand state :corp "Paywall Implementation") (is (= "Paywall Implementation" (:title (first (get-in @state [:corp :current])))) "Paywall active in Current area") @@ -1451,8 +1395,7 @@ (deftest peak-efficiency ;; Peak Efficiency - Gain 1 credit for each rezzed ICE (do-game - (new-game (default-corp ["Peak Efficiency" (qty "Paper Wall" 3) "Wraparound"]) - (default-runner)) + (new-game {:corp {:deck ["Peak Efficiency" (qty "Paper Wall" 3) "Wraparound"]}}) (core/gain state :corp :click 3) (play-from-hand state :corp "Paper Wall" "HQ") (play-from-hand state :corp "Paper Wall" "R&D") @@ -1464,11 +1407,26 @@ (play-from-hand state :corp "Peak Efficiency") (is (= 7 (:credit (get-corp))) "Gained 3 credits for 3 rezzed ICE; unrezzed ICE ignored"))) +(deftest power-grid-overload + ;; Power Grid Overload + (do-game + (new-game {:corp {:deck ["Power Grid Overload"]} + :runner {:deck ["Dyson Mem Chip"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Dyson Mem Chip") + (run-empty-server state :rd) + (take-credits state :runner) + (play-from-hand state :corp "Power Grid Overload") + (click-prompt state :corp "3") + (click-prompt state :runner "0") + (click-card state :corp (get-hardware state 0)) + (is (= 1 (-> (get-runner) :discard count)) "Dyson Mem Chip should be in heap after Runner loses Power Grid Overload trace"))) + (deftest power-shutdown ;; Power Shutdown - Trash cards from R&D to force Runner to trash a program or hardware (do-game - (new-game (default-corp [(qty "Power Shutdown" 3) (qty "Hive" 3)]) - (default-runner ["Grimoire" "Cache"])) + (new-game {:corp {:deck [(qty "Power Shutdown" 3) (qty "Hive" 3)]} + :runner {:deck ["Grimoire" "Cache"]}}) (play-from-hand state :corp "Power Shutdown") (is (empty? (:discard (get-corp))) "Not played, no run last turn") (take-credits state :corp) @@ -1488,27 +1446,11 @@ (click-card state :runner (get-program state 0)) (is (= 1 (count (:discard (get-runner)))) "Cache trashed"))) -(deftest power-grid-overload - ;; Power Grid Overload - (do-game - (new-game (default-corp ["Power Grid Overload"]) - (default-runner ["Dyson Mem Chip"])) - (take-credits state :corp) - (play-from-hand state :runner "Dyson Mem Chip") - (run-empty-server state :rd) - (take-credits state :runner) - (play-from-hand state :corp "Power Grid Overload") - (click-prompt state :corp "3") - (click-prompt state :runner "0") - (click-card state :corp (get-hardware state 0)) - (is (= 1 (-> (get-runner) :discard count)) "Dyson Mem Chip should be in heap after Runner loses Power Grid Overload trace"))) - (deftest precognition ;; Precognition - Full test (do-game - (new-game (default-corp ["Precognition" "Caprice Nisei" "Adonis Campaign" - "Quandary" "Jackson Howard" "Global Food Initiative"]) - (default-runner)) + (new-game {:corp {:deck ["Precognition" "Caprice Nisei" "Adonis Campaign" + "Quandary" "Jackson Howard" "Global Food Initiative"]}}) (starting-hand state :corp ["Precognition"]) (play-from-hand state :corp "Precognition") (click-prompt state :corp (find-card "Caprice Nisei" (:deck (get-corp)))) @@ -1534,9 +1476,8 @@ ;; Preemptive Action - Shuffles cards into R&D and removes itself from game (testing "Basic test" (do-game - (new-game (default-corp [(qty "Subliminal Messaging" 3) - "Preemptive Action"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Subliminal Messaging" 3) + "Preemptive Action"]}}) (play-from-hand state :corp "Subliminal Messaging") (play-from-hand state :corp "Subliminal Messaging") (play-from-hand state :corp "Subliminal Messaging") @@ -1548,9 +1489,8 @@ (is (= 1 (count (:rfg (get-corp))))))) (testing "forces you to take 3 if there are three, and removes itself from game" (do-game - (new-game (default-corp [(qty "Subliminal Messaging" 3) - (qty "Preemptive Action" 1)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Subliminal Messaging" 3) + (qty "Preemptive Action" 1)]}}) (play-from-hand state :corp "Subliminal Messaging") (play-from-hand state :corp "Subliminal Messaging") (play-from-hand state :corp "Subliminal Messaging") @@ -1561,9 +1501,8 @@ (is (= 1 (count (:rfg (get-corp))))))) (testing "Shuffles all archives cards into R&D if Archives has less than 3 cards, and removes itself from game" (do-game - (new-game (default-corp [(qty "Subliminal Messaging" 2) - (qty "Preemptive Action" 1)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Subliminal Messaging" 2) + (qty "Preemptive Action" 1)]}}) (play-from-hand state :corp "Subliminal Messaging") (play-from-hand state :corp "Subliminal Messaging") (play-from-hand state :corp "Preemptive Action") @@ -1575,8 +1514,7 @@ (deftest psychographics ;; Psychographics - Place advancements up to the number of Runner tags on a card (do-game - (new-game (default-corp ["Psychographics" "Project Junebug"]) - (default-runner)) + (new-game {:corp {:deck ["Psychographics" "Project Junebug"]}}) (core/gain-tags state :runner 4) (play-from-hand state :corp "Project Junebug" "New remote") (let [pj (get-content state :remote1 0)] @@ -1589,9 +1527,8 @@ (deftest psychokinesis ;; Pyschokinesis - Terminal Event (end the turn); Look at R&D, install an Asset, Agenda, or Upgrade in a Remote Server (do-game - (new-game (default-corp [(qty "Psychokinesis" 3) "Caprice Nisei" "Adonis Campaign" - "Global Food Initiative" "Mwanza City Grid"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Psychokinesis" 3) "Caprice Nisei" "Adonis Campaign" + "Global Food Initiative" "Mwanza City Grid"]}}) (starting-hand state :corp ["Psychokinesis" "Psychokinesis" "Psychokinesis"]) ;; Test installing an Upgrade (play-from-hand state :corp "Psychokinesis") @@ -1600,34 +1537,33 @@ (click-prompt state :corp (find-card "Caprice Nisei" (:deck (get-corp)))) (click-prompt state :corp "New remote") (is (= "Caprice Nisei" (:title (get-content state :remote1 0))) - "Caprice Nisei installed by Psychokinesis") + "Caprice Nisei installed by Psychokinesis") ;; Test installing an Asset (core/gain state :corp :click 1) (play-from-hand state :corp "Psychokinesis") (click-prompt state :corp (find-card "Adonis Campaign" (:deck (get-corp)))) (click-prompt state :corp "New remote") (is (= "Adonis Campaign" (:title (get-content state :remote2 0))) - "Adonis Campaign installed by Psychokinesis") + "Adonis Campaign installed by Psychokinesis") ;; Test installing an Agenda (core/gain state :corp :click 1) (play-from-hand state :corp "Psychokinesis") (click-prompt state :corp (find-card "Global Food Initiative" (:deck (get-corp)))) (click-prompt state :corp "New remote") (is (= "Global Food Initiative" (:title (get-content state :remote3 0))) - "Global Food Initiative installed by Psychokinesis") + "Global Food Initiative installed by Psychokinesis") ;; Test selecting "None" (core/gain state :corp :click 1) (core/move state :corp (find-card "Psychokinesis" (:discard (get-corp))) :hand) (play-from-hand state :corp "Psychokinesis") (click-prompt state :corp "None") (is (= nil (:title (get-content state :remote4 0))) - "Nothing is installed by Psychokinesis"))) + "Nothing is installed by Psychokinesis"))) (deftest punitive-counterstrike ;; Punitive Counterstrike - deal meat damage equal to printed agenda points (do-game - (new-game (default-corp ["Global Food Initiative" "Punitive Counterstrike"]) - (default-runner)) + (new-game {:corp {:deck ["Global Food Initiative" "Punitive Counterstrike"]}}) (play-from-hand state :corp "Global Food Initiative" "New remote") (take-credits state :corp) (run-empty-server state :remote1) @@ -1642,9 +1578,8 @@ (deftest red-planet-couriers ;; Red Planet Couriers - Move all advancements on cards to 1 advanceable card (do-game - (new-game (default-corp ["Red Planet Couriers" (qty "Ice Wall" 2) - "GRNDL Refinery" "Government Takeover"]) - (default-runner)) + (new-game {:corp {:deck ["Red Planet Couriers" (qty "Ice Wall" 2) + "GRNDL Refinery" "Government Takeover"]}}) (core/gain state :corp :click 4) (play-from-hand state :corp "Government Takeover" "New remote") (play-from-hand state :corp "GRNDL Refinery" "New remote") @@ -1667,9 +1602,8 @@ (deftest reuse ;; Reuse - Gain 2 credits for each card trashed from HQ (do-game - (new-game (default-corp [(qty "Reuse" 2) "Hive" "IQ" - "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Reuse" 2) "Hive" "IQ" + "Ice Wall"]}}) (play-from-hand state :corp "Reuse") (click-card state :corp (find-card "Ice Wall" (:hand (get-corp)))) (click-card state :corp (find-card "Hive" (:hand (get-corp)))) @@ -1682,8 +1616,8 @@ (deftest reverse-infection ;; Reverse Infection - purge and trash 1 card from stack for every 3 counters purged - or gain 2 credits (do-game - (new-game (default-corp [(qty "Reverse Infection" 2)]) - (default-runner ["Virus Breeding Ground" "Datasucker" (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Reverse Infection" 2)]} + :runner {:deck ["Virus Breeding Ground" "Datasucker" (qty "Sure Gamble" 3)]}}) (starting-hand state :runner ["Virus Breeding Ground" "Datasucker"]) (play-from-hand state :corp "Reverse Infection") (click-prompt state :corp "Gain 2 [Credits]") @@ -1705,8 +1639,7 @@ ;; Riot Suppression - lose 3 clicks or take 1 brain damage (testing "Take 1 brain damage" (do-game - (new-game (default-corp ["Riot Suppression" "Adonis Campaign"]) - (default-runner)) + (new-game {:corp {:deck ["Riot Suppression" "Adonis Campaign"]}}) (play-from-hand state :corp "Adonis Campaign" "New remote") (take-credits state :corp) (run-empty-server state "Server 1") @@ -1724,8 +1657,7 @@ (is (= 4 (:click (get-runner))) "Runner has all clicks the following turn"))) (testing "Lose 3 clicks" (do-game - (new-game (default-corp ["Riot Suppression" "Adonis Campaign"]) - (default-runner)) + (new-game {:corp {:deck ["Riot Suppression" "Adonis Campaign"]}}) (play-from-hand state :corp "Adonis Campaign" "New remote") (take-credits state :corp) (run-empty-server state "Server 1") @@ -1745,9 +1677,9 @@ (deftest rolling-brownout ;; Rolling Brownout - Increase cost of events/operations by 1, gain 1c on first Runner event of turn (do-game - (new-game (default-corp ["Rolling Brownout" "Beanstalk Royalties" - "Domestic Sleepers"]) - (default-runner [(qty "Easy Mark" 3)])) + (new-game {:corp {:deck ["Rolling Brownout" "Beanstalk Royalties" + "Domestic Sleepers"]} + :runner {:deck [(qty "Easy Mark" 3)]}}) (play-from-hand state :corp "Rolling Brownout") (play-from-hand state :corp "Beanstalk Royalties") (is (= 5 (:credit (get-corp))) "Beanstalk netted only 2c") @@ -1767,8 +1699,7 @@ ;; Sacrifice - Remove BP for each agenda point sacrificed and gain a credit (testing "Basic test" (do-game - (new-game (default-corp ["Hostile Takeover" "Sacrifice"]) - (default-runner)) + (new-game {:corp {:deck ["Hostile Takeover" "Sacrifice"]}}) (play-and-score state "Hostile Takeover") (is (= 1 (:bad-publicity (get-corp))) "Hostile Takeover gives one bad publicity") (let [ht (get-scored state :corp 0) @@ -1779,8 +1710,7 @@ (is (= (inc credits) (:credit (get-corp))) "Corp gained one credit from removing one bad pub with Sacrifice")))) (testing "Play restrictions" (do-game - (new-game (default-corp ["Standoff" "Hostile Takeover" "Sacrifice"]) - (default-runner)) + (new-game {:corp {:deck ["Standoff" "Hostile Takeover" "Sacrifice"]}}) (play-and-score state "Standoff") (core/gain state :corp :bad-publicity 1) (play-from-hand state :corp "Sacrifice") @@ -1791,12 +1721,12 @@ (play-from-hand state :corp "Sacrifice") (is (= 1 (count (:hand (get-corp)))) "Can not play Sacrifice with no bad publicity in score area")))) -(deftest salem's-hospitality +(deftest salem-s-hospitality ;; Salem's Hospitality - Full test (do-game - (new-game (default-corp [(qty "Salem's Hospitality" 3)]) - (default-runner [(qty "I've Had Worse" 3) "Faust" - "Levy AR Lab Access"])) + (new-game {:corp {:deck [(qty "Salem's Hospitality" 3)]} + :runner {:deck [(qty "I've Had Worse" 3) "Faust" + "Levy AR Lab Access"]}}) (play-from-hand state :corp "Salem's Hospitality") (is (= 5 (count (:hand (get-runner))))) (click-prompt state :corp "I've Had Worse") @@ -1809,22 +1739,21 @@ ;; Scorched Earth (testing "Basic test" (do-game - (new-game (default-corp ["Scorched Earth"]) - (default-runner [(qty "Sure Gamble" 3) (qty "Lucky Find" 3)])) + (new-game {:corp {:deck ["Scorched Earth"]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Lucky Find" 3)]}}) (core/gain-tags state :runner 1) (play-from-hand state :corp "Scorched Earth") (is (= 1 (count (:hand (get-runner)))) "Runner has 1 card in hand"))) (testing "not tagged" (do-game - (new-game (default-corp ["Scorched Earth"]) - (default-runner [(qty "Sure Gamble" 3) (qty "Lucky Find" 3)])) + (new-game {:corp {:deck ["Scorched Earth"]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Lucky Find" 3)]}}) (play-from-hand state :corp "Scorched Earth") (is (= 3 (:click (get-corp))) "Corp not charged a click") (is (= 5 (count (:hand (get-runner)))) "Runner did not take damage"))) (testing "flatline" (do-game - (new-game (default-corp [(qty "Scorched Earth" 10)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Scorched Earth" 10)]}}) (core/gain-tags state :runner 1) (play-from-hand state :corp "Scorched Earth") (is (zero? (count (:hand (get-runner)))) "Runner has 0 cards in hand") @@ -1834,8 +1763,7 @@ (deftest sea-source ;; SEA Source (do-game - (new-game (default-corp ["SEA Source"]) - (default-runner)) + (new-game {:corp {:deck ["SEA Source"]}}) (take-credits state :corp) (run-empty-server state :rd) (take-credits state :runner) @@ -1848,8 +1776,8 @@ (deftest self-growth-program ;; Self-Growth Program - Add 2 installed cards to grip if runner is tagged (do-game - (new-game (default-corp ["Self-Growth Program"]) - (default-runner ["Clone Chip" "Inti"])) + (new-game {:corp {:deck ["Self-Growth Program"]} + :runner {:deck ["Clone Chip" "Inti"]}}) (take-credits state :corp) (play-from-hand state :runner "Clone Chip") (play-from-hand state :runner "Inti") @@ -1871,8 +1799,8 @@ ;; Service Outage (testing "First click run each turn costs a credit" (do-game - (new-game (default-corp ["Service Outage"]) - (default-runner ["Employee Strike"])) + (new-game {:corp {:deck ["Service Outage"]} + :runner {:deck ["Employee Strike"]}}) (play-from-hand state :corp "Service Outage") (take-credits state :corp) (is (= 5 (:credit (get-runner))) "Runner has 5 credits") @@ -1903,8 +1831,8 @@ "Runner doesn't spend 1 credit to make a run"))) (testing "First card ability run each turn costs an additional credit" (do-game - (new-game (default-corp ["Service Outage"]) - (default-runner ["Sneakdoor Beta"])) + (new-game {:corp {:deck ["Service Outage"]} + :runner {:deck ["Sneakdoor Beta"]}}) (play-from-hand state :corp "Service Outage") (take-credits state :corp) (play-from-hand state :runner "Sneakdoor Beta") @@ -1930,8 +1858,8 @@ (is (zero? (:credit (get-runner))) "Runner has 0 credits")))) (testing "First run event each turn costs an additional credit" (do-game - (new-game (default-corp ["Service Outage"]) - (default-runner [(qty "Out of the Ashes" 2)])) + (new-game {:corp {:deck ["Service Outage"]} + :runner {:deck [(qty "Out of the Ashes" 2)]}}) (play-from-hand state :corp "Service Outage") (take-credits state :corp) (is (= 5 (:credit (get-runner))) "Runner has 5 credits") @@ -1957,9 +1885,10 @@ (is (= 1 (:credit (get-runner))) "Runner has 1 credit"))) (testing "Works when played on the runner's turn" (do-game - (new-game (make-deck "New Angeles Sol: Your News" ["Service Outage" - "Breaking News"]) - (default-runner ["Hades Shard"])) + (new-game {:corp {:id "New Angeles Sol: Your News" + :deck ["Service Outage" + "Breaking News"]} + :runner {:deck ["Hades Shard"]}}) (trash-from-hand state :corp "Breaking News") (take-credits state :corp) (core/gain state :runner :credit 3) @@ -1976,9 +1905,10 @@ "Runner spends 1 additional credit to make a run"))) (testing "Doesn't fire if already run when played on the runner's turn" (do-game - (new-game (make-deck "New Angeles Sol: Your News" ["Service Outage" - "Breaking News"]) - (default-runner ["Hades Shard"])) + (new-game {:corp {:id "New Angeles Sol: Your News" + :deck ["Service Outage" + "Breaking News"]} + :runner {:deck ["Hades Shard"]}}) (trash-from-hand state :corp "Breaking News") (take-credits state :corp) (run-on state :hq) @@ -1998,10 +1928,9 @@ "Runner doesn't spend 1 additional credit to make a run"))) (testing "trashed and reinstalled on steal doesn't double remove penalty" (do-game - (new-game - (make-deck "New Angeles Sol: Your News" ["Service Outage" - "Breaking News"]) - (default-runner)) + (new-game {:corp {:id "New Angeles Sol: Your News" + :deck ["Service Outage" + "Breaking News"]}}) (play-from-hand state :corp "Breaking News" "New remote") (play-from-hand state :corp "Service Outage") (take-credits state :corp) @@ -2019,8 +1948,7 @@ (deftest shipment-from-sansan ;; Shipment from SanSan - placing advancements (do-game - (new-game (default-corp [(qty "Shipment from SanSan" 3) (qty "Ice Wall" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Shipment from SanSan" 3) (qty "Ice Wall" 3)]}}) (play-from-hand state :corp "Ice Wall" "HQ") (let [iwall (get-ice state :hq 0)] (play-from-hand state :corp "Shipment from SanSan") @@ -2032,8 +1960,8 @@ (deftest snatch-and-grab ;; Snatch and Grab (do-game - (new-game (default-corp [(qty "Snatch and Grab" 2)]) - (default-runner ["Scrubber"])) + (new-game {:corp {:deck [(qty "Snatch and Grab" 2)]} + :runner {:deck ["Scrubber"]}}) (take-credits state :corp) (play-from-hand state :runner "Scrubber") (take-credits state :runner) @@ -2055,8 +1983,7 @@ (deftest stock-buy-back ;; Stock Buy-Back - Gain 3c for every agenda in Runner's area (do-game - (new-game (default-corp [(qty "Hostile Takeover" 2) (qty "Stock Buy-Back" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Hostile Takeover" 2) (qty "Stock Buy-Back" 3)]}}) (play-from-hand state :corp "Hostile Takeover" "New remote") (play-from-hand state :corp "Hostile Takeover" "New remote") (take-credits state :corp) @@ -2072,8 +1999,7 @@ (deftest sub-boost ;; Sub Boost - Give ICE Barrier (do-game - (new-game (default-corp ["Sub Boost" "Quandary"]) - (default-runner)) + (new-game {:corp {:deck ["Sub Boost" "Quandary"]}}) (play-from-hand state :corp "Quandary" "HQ") (let [qu (get-ice state :hq 0)] (core/rez state :corp qu) @@ -2089,8 +2015,8 @@ ;; Subcontract (testing "Don't allow second operation until damage prevention completes" (do-game - (new-game (default-corp [(qty "Scorched Earth" 2) "Subcontract"]) - (default-runner ["Plascrete Carapace"])) + (new-game {:corp {:deck [(qty "Scorched Earth" 2) "Subcontract"]} + :runner {:deck ["Plascrete Carapace"]}}) (take-credits state :corp) (core/gain-tags state :runner 1) (play-from-hand state :runner "Plascrete Carapace") @@ -2103,9 +2029,7 @@ (is (not-empty (:prompt (get-corp))) "Corp can now play second Subcontract operation"))) (testing "interaction with Terminal operations" (do-game - (new-game - (default-corp [(qty "Hard-Hitting News" 2) "Subcontract"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Hard-Hitting News" 2) "Subcontract"]}}) (core/gain-tags state :runner 1) (take-credits state :corp) (run-empty-server state :archives) @@ -2121,8 +2045,9 @@ ;; Subliminal Messaging - Playing/trashing/milling will all prompt returning to hand (testing "Basic test" (do-game - (new-game (default-corp [(qty "Subliminal Messaging" 3)]) - (make-deck "Noise: Hacker Extraordinaire" [(qty "Cache" 3) "Utopia Shard"])) + (new-game {:corp {:deck [(qty "Subliminal Messaging" 3)]} + :runner {:id "Noise: Hacker Extraordinaire" + :deck [(qty "Cache" 3) "Utopia Shard"]}}) (play-from-hand state :corp "Subliminal Messaging") (is (= 6 (:credit (get-corp)))) (is (= 3 (:click (get-corp))) "First Subliminal Messaging gains 1 click") @@ -2159,8 +2084,7 @@ (is (= 1 (count (:discard (get-corp)))) "1 Subliminal not returned because runner made a run last turn"))) (testing "Scenario involving Subliminal being added to HQ with Archived Memories" (do-game - (new-game (default-corp [(qty "Subliminal Messaging" 2) "Archived Memories"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Subliminal Messaging" 2) "Archived Memories"]}}) (play-from-hand state :corp "Subliminal Messaging") (play-from-hand state :corp "Subliminal Messaging") (play-from-hand state :corp "Archived Memories") @@ -2180,8 +2104,7 @@ "Only 2 Subliminal prompts - there will be a third if flag not cleared"))) (testing "Scenario involving Subliminal being reshuffled into R&D with Jackson" (do-game - (new-game (default-corp ["Subliminal Messaging" "Jackson Howard"]) - (default-runner)) + (new-game {:corp {:deck ["Subliminal Messaging" "Jackson Howard"]}}) (play-from-hand state :corp "Subliminal Messaging") (play-from-hand state :corp "Jackson Howard" "New remote") (take-credits state :corp) @@ -2202,8 +2125,7 @@ "Subliminal prompt cleared - there will be a second prompt if flag not cleared"))) (testing "Runner made run, ensure game asks again next turn" (do-game - (new-game (default-corp [(qty "Subliminal Messaging" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Subliminal Messaging" 2)]}}) (play-from-hand state :corp "Subliminal Messaging") (trash-from-hand state :corp "Subliminal Messaging") (take-credits state :corp) @@ -2219,8 +2141,7 @@ (is (zero? (count (:discard (get-corp)))) "No Subliminals in Archives"))) (testing "User declines to return to hand, ensure game asks again next turn" (do-game - (new-game (default-corp [(qty "Subliminal Messaging" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Subliminal Messaging" 2)]}}) (play-from-hand state :corp "Subliminal Messaging") (trash-from-hand state :corp "Subliminal Messaging") (take-credits state :corp) @@ -2240,8 +2161,7 @@ ;; Success (testing "Works with bad publicity" (do-game - (new-game (default-corp ["NAPD Contract" "Project Beale" "Success"]) - (default-runner)) + (new-game {:corp {:deck ["NAPD Contract" "Project Beale" "Success"]}}) (play-from-hand state :corp "NAPD Contract" "New remote") (play-from-hand state :corp "Project Beale" "New remote") (core/gain state :corp :bad-publicity 9) @@ -2262,8 +2182,7 @@ (is (= 7 (:agenda-point (get-corp))))))) (testing "Works with public agendas" (do-game - (new-game (default-corp ["Oaktown Renovation" "Vanity Project" "Success"]) - (default-runner)) + (new-game {:corp {:deck ["Oaktown Renovation" "Vanity Project" "Success"]}}) (core/gain state :corp :click 1) (score-agenda state :corp (find-card "Vanity Project" (:hand (get-corp)))) (is (= 4 (:agenda-point (get-corp)))) @@ -2280,11 +2199,10 @@ (is (= 2 (:agenda-point (get-corp))))))) (testing "interaction with Jemison, regression test for issue #2704" (do-game - (new-game (make-deck "Jemison Astronautics: Sacrifice. Audacity. Success." - ["Success" - "High-Risk Investment" - "Government Takeover"]) - (default-runner)) + (new-game {:corp {:id "Jemison Astronautics: Sacrifice. Audacity. Success." + :deck ["Success" + "High-Risk Investment" + "Government Takeover"]}}) (core/gain state :corp :click 1) (score-agenda state :corp (find-card "High-Risk Investment" (:hand (get-corp)))) (play-from-hand state :corp "Government Takeover" "New remote") @@ -2301,8 +2219,7 @@ (deftest successful-demonstration ;; Successful Demonstration - Play if only Runner made unsuccessful run last turn; gain 7 credits (do-game - (new-game (default-corp ["Successful Demonstration"]) - (default-runner)) + (new-game {:corp {:deck ["Successful Demonstration"]}}) (play-from-hand state :corp "Successful Demonstration") (is (and (= 3 (:click (get-corp))) (= 5 (:credit (get-runner)))) @@ -2318,8 +2235,8 @@ ;; Surveillance Sweep (testing "Basic test" (do-game - (new-game (default-corp ["Restructured Datapool" "Surveillance Sweep" "Data Raven"]) - (default-runner ["Scrubbed"])) + (new-game {:corp {:deck ["Restructured Datapool" "Surveillance Sweep" "Data Raven"]} + :runner {:deck ["Scrubbed"]}}) (is (zero? (count-tags state)) "Runner should start with no tags") (play-from-hand state :corp "Surveillance Sweep") (play-and-score state "Restructured Datapool") @@ -2352,8 +2269,7 @@ (run-successful state)))) (testing "trace during run after stealing an agenda" (do-game - (new-game (default-corp ["Surveillance Sweep" "Breaking News" "Forced Connection" "Data Raven"]) - (default-runner)) + (new-game {:corp {:deck ["Surveillance Sweep" "Breaking News" "Forced Connection" "Data Raven"]}}) (core/gain state :corp :click 4) (core/gain state :corp :credit 20) (play-from-hand state :corp "Surveillance Sweep") @@ -2380,8 +2296,7 @@ (deftest targeted-marketing ;; Targeted Marketing (do-game - (new-game (default-corp ["Targeted Marketing"]) - (default-runner)) + (new-game {:corp {:deck ["Targeted Marketing"]}}) (play-from-hand state :corp "Targeted Marketing") (click-prompt state :corp "Sure Gamble") (take-credits state :corp) @@ -2392,8 +2307,8 @@ (deftest the-all-seeing-i (testing "Counts number of cards if one card is prevented trashed with fall guy" (do-game - (new-game (default-corp ["The All-Seeing I"]) - (default-runner ["Fall Guy" (qty "Same Old Thing" 2)])) + (new-game {:corp {:deck ["The All-Seeing I"]} + :runner {:deck ["Fall Guy" (qty "Same Old Thing" 2)]}}) (letfn [(res [] (count (get-in (get-runner) [:rig :resource])))] (take-credits state :corp) (play-from-hand state :runner "Same Old Thing") @@ -2411,8 +2326,8 @@ (is (= 2 (count (:discard (get-runner)))) "Two cards in heap")))) (testing "Checks that All-seeing I does not double-trash hosted cards, trashes hosted cards" (do-game - (new-game (default-corp ["The All-Seeing I"]) - (default-runner [(qty "Fall Guy" 2) "Off-Campus Apartment"])) + (new-game {:corp {:deck ["The All-Seeing I"]} + :runner {:deck [(qty "Fall Guy" 2) "Off-Campus Apartment"]}}) (take-credits state :corp) (play-from-hand state :runner "Off-Campus Apartment") (let [oca (get-resource state 0) @@ -2434,8 +2349,8 @@ (is (= 2 (count (:discard (get-runner)))) "Two cards in heap"))) (testing "should not trash Jarogniew Mercs if there are other installed resources" (do-game - (new-game (default-corp [(qty "The All-Seeing I" 4)]) - (default-runner [(qty "Jarogniew Mercs" 2) (qty "Same Old Thing" 2)])) + (new-game {:corp {:deck [(qty "The All-Seeing I" 4)]} + :runner {:deck [(qty "Jarogniew Mercs" 2) (qty "Same Old Thing" 2)]}}) (letfn [(res [] (count (get-in (get-runner) [:rig :resource])))] (take-credits state :corp) (play-from-hand state :runner "Same Old Thing") @@ -2459,8 +2374,8 @@ (deftest threat-assessment ;; Threat Assessment - play only if runner trashed a card last turn, move a card to the stack or take 2 tags (do-game - (new-game (default-corp [(qty "Threat Assessment" 3) "Adonis Campaign"]) - (default-runner ["Desperado" "Corroder"])) + (new-game {:corp {:deck [(qty "Threat Assessment" 3) "Adonis Campaign"]} + :runner {:deck ["Desperado" "Corroder"]}}) (play-from-hand state :corp "Adonis Campaign" "New remote") (take-credits state :corp) (run-on state :remote1) @@ -2492,8 +2407,7 @@ (deftest threat-level-alpha ;; Threat Level Alpha - Win trace to give tags = Runner tags; or 1 tag if 0 (do-game - (new-game (default-corp [(qty "Threat Level Alpha" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Threat Level Alpha" 2)]}}) (core/gain state :corp :click 2) (core/gain state :corp :credit 2) (is (zero? (count-tags state))) @@ -2510,9 +2424,8 @@ (deftest transparency-initiative ;; Transparency Initiative - Full test (do-game - (new-game (default-corp ["Transparency Initiative" "Oaktown Renovation" - "Project Atlas" "Hostile Takeover" "Casting Call"]) - (default-runner)) + (new-game {:corp {:deck ["Transparency Initiative" "Oaktown Renovation" + "Project Atlas" "Hostile Takeover" "Casting Call"]}}) (core/gain state :corp :click 5) (play-from-hand state :corp "Oaktown Renovation" "New remote") (play-from-hand state :corp "Casting Call") @@ -2546,8 +2459,8 @@ (deftest trojan-horse ;; Trojan Horse (do-game - (new-game (default-corp ["Trojan Horse" "Dedicated Response Team"]) - (default-runner ["Wyrm"])) + (new-game {:corp {:deck ["Trojan Horse" "Dedicated Response Team"]} + :runner {:deck ["Wyrm"]}}) (play-from-hand state :corp "Dedicated Response Team" "New remote") (take-credits state :corp) (play-from-hand state :runner "Wyrm") @@ -2563,8 +2476,8 @@ (deftest under-the-bus ;; Under the Bus (do-game - (new-game (default-corp ["Under the Bus"]) - (default-runner ["Film Critic"])) + (new-game {:corp {:deck ["Under the Bus"]} + :runner {:deck ["Film Critic"]}}) (take-credits state :corp) (run-on state :hq) (run-successful state) @@ -2583,8 +2496,8 @@ ;; Wake Up Call (testing "should fire after using En Passant to trash ice" (do-game - (new-game (default-corp ["Enigma" "Wake Up Call"]) - (default-runner ["En Passant" "Maya"])) + (new-game {:corp {:deck ["Enigma" "Wake Up Call"]} + :runner {:deck ["En Passant" "Maya"]}}) (play-from-hand state :corp "Enigma" "HQ") (take-credits state :corp) (play-from-hand state :runner "Maya") @@ -2606,10 +2519,9 @@ (deftest wetwork-refit ;; Wetwork Refit - Only works on Bioroid ICE and adds a subroutine (do-game - (new-game (default-corp ["Eli 1.0" + (new-game {:corp {:deck ["Eli 1.0" "Vanilla" - (qty "Wetwork Refit" 3)]) - (default-runner)) + (qty "Wetwork Refit" 3)]}}) (core/gain state :corp :credit 20) (core/gain state :corp :click 10) (play-from-hand state :corp "Eli 1.0" "R&D") diff --git a/test/clj/game_test/cards/programs.clj b/test/clj/game_test/cards/programs.clj index 792f5b54e7..e858e1a302 100644 --- a/test/clj/game_test/cards/programs.clj +++ b/test/clj/game_test/cards/programs.clj @@ -1,20 +1,17 @@ (ns game-test.cards.programs (:require [game.core :as core] - [game.utils :refer [has?]] + [game.utils :as utils] [game-test.core :refer :all] [game-test.utils :refer :all] [game-test.macros :refer :all] [jinteki.utils :refer [count-tags]] [clojure.test :refer :all])) -(use-fixtures :once load-all-cards (partial reset-card-defs "programs")) - (deftest algernon ;; Algernon - pay 2 credits to gain a click, trash if no successful run (testing "Use, successful run" (do-game - (new-game (default-corp) - (default-runner ["Algernon"])) + (new-game {:runner {:deck ["Algernon"]}}) (take-credits state :corp) (play-from-hand state :runner "Algernon") (take-credits state :runner) @@ -31,8 +28,7 @@ (is (= "Algernon" (:title (get-program state 0))) "Algernon still installed"))) (testing "Use, no successful run" (do-game - (new-game (default-corp) - (default-runner ["Algernon"])) + (new-game {:runner {:deck ["Algernon"]}}) (take-credits state :corp) (play-from-hand state :runner "Algernon") (take-credits state :runner) @@ -49,8 +45,7 @@ (is (empty? (get-program state)) "No programs installed"))) (testing "Not used, no successful run" (do-game - (new-game (default-corp) - (default-runner ["Algernon"])) + (new-game {:runner {:deck ["Algernon"]}}) (take-credits state :corp) (play-from-hand state :runner "Algernon") (take-credits state :runner) @@ -69,8 +64,7 @@ (deftest au-revoir ;; Au Revoir - Gain 1 credit every time you jack out (do-game - (new-game (default-corp) - (default-runner [(qty "Au Revoir" 2)])) + (new-game {:runner {:deck [(qty "Au Revoir" 2)]}}) (take-credits state :corp) (play-from-hand state :runner "Au Revoir") (run-on state "Archives") @@ -86,8 +80,7 @@ (deftest bankroll ;; Bankroll (do-game - (new-game (default-corp) - (default-runner ["Bankroll"])) + (new-game {:runner {:deck ["Bankroll"]}}) (take-credits state :corp) (play-from-hand state :runner "Bankroll") (is (= 3 (core/available-mu state)) "Bankroll uses up 1 MU") @@ -109,8 +102,8 @@ ;; Consume - gain virus counter for trashing corp card. click to get 2c per counter. (testing "Trash and cash out" (do-game - (new-game (default-corp ["Adonis Campaign"]) - (default-runner ["Consume"])) + (new-game {:corp {:deck ["Adonis Campaign"]} + :runner {:deck ["Consume"]}}) (play-from-hand state :corp "Adonis Campaign" "New remote") (take-credits state :corp) (play-from-hand state :runner "Consume") @@ -127,8 +120,8 @@ (is (zero? (get-counters (refresh c) :virus)) "Consume loses counters")))) (testing "Hivemind interaction" (do-game - (new-game (default-corp ["Adonis Campaign"]) - (default-runner ["Consume" "Hivemind"])) + (new-game {:corp {:deck ["Adonis Campaign"]} + :runner {:deck ["Consume" "Hivemind"]}}) (play-from-hand state :corp "Adonis Campaign" "New remote") (take-credits state :corp) (core/gain state :runner :credit 3) @@ -151,8 +144,7 @@ (is (zero? (get-counters (refresh h) :virus)) "Hivemind loses counters")))) (testing "Hivemind counters only" (do-game - (new-game (default-corp) - (default-runner ["Consume" "Hivemind"])) + (new-game {:runner {:deck ["Consume" "Hivemind"]}}) (take-credits state :corp) (play-from-hand state :runner "Consume") (play-from-hand state :runner "Hivemind") @@ -169,8 +161,8 @@ (deftest crescentus ;; Crescentus should only work on rezzed ice (do-game - (new-game (default-corp ["Quandary"]) - (default-runner ["Crescentus"])) + (new-game {:corp {:deck ["Quandary"]} + :runner {:deck ["Crescentus"]}}) (play-from-hand state :corp "Quandary" "HQ") (take-credits state :corp) (play-from-hand state :runner "Crescentus") @@ -189,8 +181,8 @@ ;; Datasucker - Reduce strength of encountered ICE (testing "Basic test" (do-game - (new-game (default-corp ["Fire Wall"]) - (default-runner ["Datasucker"])) + (new-game {:corp {:deck ["Fire Wall"]} + :runner {:deck ["Datasucker"]}}) (play-from-hand state :corp "Fire Wall" "New remote") (take-credits state :corp) (core/gain state :runner :click 3) @@ -213,9 +205,8 @@ (is (= 4 (:current-strength (refresh fw))) "Fire Wall strength lowered by 1")))) (testing "does not affect next ice when current is trashed. Issue #1788" (do-game - (new-game - (default-corp ["Wraparound" "Spiderweb"]) - (default-corp ["Datasucker" "Parasite"])) + (new-game {:corp {:deck ["Wraparound" "Spiderweb"]} + :runner {:deck ["Datasucker" "Parasite"]}}) (play-from-hand state :corp "Spiderweb" "HQ") (play-from-hand state :corp "Wraparound" "HQ") (take-credits state :corp) @@ -239,8 +230,7 @@ (deftest dhegdheer ;; Dheghdheer - hosting a breaker with strength based on unused MU should calculate correctly (do-game - (new-game (default-corp) - (default-runner ["Adept" "Dhegdheer"])) + (new-game {:runner {:deck ["Adept" "Dhegdheer"]}}) (take-credits state :corp) (core/gain state :runner :credit 5) (play-from-hand state :runner "Dhegdheer") @@ -260,8 +250,8 @@ (deftest disrupter ;; Disrupter (do-game - (new-game (default-corp [(qty "SEA Source" 2)]) - (default-runner ["Disrupter"])) + (new-game {:corp {:deck [(qty "SEA Source" 2)]} + :runner {:deck ["Disrupter"]}}) (take-credits state :corp) (run-empty-server state "Archives") (play-from-hand state :runner "Disrupter") @@ -279,8 +269,8 @@ (deftest diwan ;; Diwan - Full test (do-game - (new-game (default-corp [(qty "Ice Wall" 3) (qty "Fire Wall" 3) (qty "Crisium Grid" 2)]) - (default-runner ["Diwan"])) + (new-game {:corp {:deck [(qty "Ice Wall" 3) (qty "Fire Wall" 3) (qty "Crisium Grid" 2)]} + :runner {:deck ["Diwan"]}}) (take-credits state :corp) (play-from-hand state :runner "Diwan") (click-prompt state :runner "HQ") @@ -306,8 +296,8 @@ ;; Djinn (testing "Hosted Chakana does not disable advancing agendas. Issue #750" (do-game - (new-game (default-corp ["Priority Requisition"]) - (default-runner ["Djinn" "Chakana"])) + (new-game {:corp {:deck ["Priority Requisition"]} + :runner {:deck ["Djinn" "Chakana"]}}) (play-from-hand state :corp "Priority Requisition" "New remote") (take-credits state :corp 2) (play-from-hand state :runner "Djinn") @@ -325,8 +315,7 @@ (is (= 1 (get-counters (refresh agenda) :advancement)) "Agenda was advanced"))))) (testing "Host a non-icebreaker program" (do-game - (new-game (default-corp) - (default-runner ["Djinn" "Chakana"])) + (new-game {:runner {:deck ["Djinn" "Chakana"]}}) (take-credits state :corp) (play-from-hand state :runner "Djinn") (is (= 3 (core/available-mu state))) @@ -338,8 +327,7 @@ (is (= 1 (:credit (get-runner))) "Full cost to host on Djinn")))) (testing "Tutor a virus program" (do-game - (new-game (default-corp) - (default-runner ["Djinn" "Parasite"])) + (new-game {:runner {:deck ["Djinn" "Parasite"]}}) (take-credits state :corp) (play-from-hand state :runner "Djinn") (core/move state :runner (find-card "Parasite" (:hand (get-runner))) :deck) @@ -354,9 +342,9 @@ (deftest equivocation ;; Equivocation - interactions with other successful-run events. (do-game - (new-game - (default-corp [(qty "Restructure" 3) (qty "Hedge Fund" 3)]) - (make-deck "Laramy Fisk: Savvy Investor" ["Equivocation" "Desperado"])) + (new-game {:corp {:deck [(qty "Restructure" 3) (qty "Hedge Fund" 3)]} + :runner {:id "Laramy Fisk: Savvy Investor" + :deck ["Equivocation" "Desperado"]}}) (starting-hand state :corp ["Hedge Fund"]) (take-credits state :corp) (play-from-hand state :runner "Equivocation") @@ -375,8 +363,8 @@ (deftest false-echo ;; False Echo - choice for Corp (do-game - (new-game (default-corp [(qty "Ice Wall" 3)]) - (default-runner [(qty "False Echo" 3)])) + (new-game {:corp {:deck [(qty "Ice Wall" 3)]} + :runner {:deck [(qty "False Echo" 3)]}}) (play-from-hand state :corp "Ice Wall" "Archives") (play-from-hand state :corp "Ice Wall" "Archives") (take-credits state :corp) @@ -399,8 +387,8 @@ (deftest gravedigger ;; Gravedigger - Gain counters when Corp cards are trashed, spend click-counter to mill Corp (do-game - (new-game (default-corp [(qty "Launch Campaign" 2) (qty "Enigma" 2)]) - (default-runner ["Gravedigger"])) + (new-game {:corp {:deck [(qty "Launch Campaign" 2) (qty "Enigma" 2)]} + :runner {:deck ["Gravedigger"]}}) (play-from-hand state :corp "Launch Campaign" "New remote") (play-from-hand state :corp "Launch Campaign" "New remote") (take-credits state :corp) @@ -423,8 +411,8 @@ ;; Harbinger (testing "install facedown when Blacklist installed" (do-game - (new-game (default-corp ["Blacklist"]) - (default-runner ["Harbinger"])) + (new-game {:corp {:deck ["Blacklist"]} + :runner {:deck ["Harbinger"]}}) (play-from-hand state :corp "Blacklist" "New remote") (core/rez state :corp (get-content state :remote1 0)) (take-credits state :corp) @@ -437,8 +425,7 @@ ;; Hyperdriver - Remove from game to gain 3 clicks (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner ["Hyperdriver"])) + (new-game {:runner {:deck ["Hyperdriver"]}}) (take-credits state :corp) (play-from-hand state :runner "Hyperdriver") (is (= 1 (core/available-mu state)) "3 MU used") @@ -452,8 +439,7 @@ (is (= 1 (count (:rfg (get-runner)))) "Hyperdriver removed from game")))) (testing "triggering a Dhegdeered Hyperdriver should not grant +3 MU" (do-game - (new-game (default-corp) - (default-runner ["Hyperdriver" "Dhegdheer"])) + (new-game {:runner {:deck ["Hyperdriver" "Dhegdheer"]}}) (take-credits state :corp) (play-from-hand state :runner "Dhegdheer") (let [dheg (get-program state 0)] @@ -476,8 +462,8 @@ (testing "Full test" (letfn [(imp-test [card] (do-game - (new-game (default-corp [card]) - (default-runner ["Imp"])) + (new-game {:corp {:deck [card]} + :runner {:deck ["Imp"]}}) (take-credits state :corp) (play-from-hand state :runner "Imp") (run-empty-server state "HQ") @@ -491,8 +477,8 @@ "Oberth Protocol"])))) (testing "vs an ambush" (do-game - (new-game (default-corp ["Prisec"]) - (default-runner ["Imp" (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Prisec"]} + :runner {:deck ["Imp" (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Prisec" "New remote") (take-credits state :corp) (let [credits (:credit (get-corp)) @@ -510,8 +496,8 @@ (testing "vs The Future Perfect" ;; Psi-game happens on access [5.5.1], Imp is a trash ability [5.5.2] (do-game - (new-game (default-corp ["The Future Perfect"]) - (default-runner ["Imp"])) + (new-game {:corp {:deck ["The Future Perfect"]} + :runner {:deck ["Imp"]}}) (take-credits state :corp) (play-from-hand state :runner "Imp") (testing "Access, corp wins psi-game" @@ -537,8 +523,8 @@ (is (zero? (:agenda-point (get-runner))) "Runner did not steal TFP")))) (testing "vs cards in Archives" (do-game - (new-game (default-corp ["Hostile Takeover"]) - (default-runner ["Imp"])) + (new-game {:corp {:deck ["Hostile Takeover"]} + :runner {:deck ["Imp"]}}) (core/move state :corp (find-card "Hostile Takeover" (:hand (get-corp))) :discard) (take-credits state :corp) (play-from-hand state :runner "Imp") @@ -548,8 +534,7 @@ (deftest incubator ;; Incubator - Gain 1 virus counter per turn; trash to move them to an installed virus program (do-game - (new-game (default-corp) - (default-runner ["Incubator" "Datasucker"])) + (new-game {:runner {:deck ["Incubator" "Datasucker"]}}) (take-credits state :corp) (play-from-hand state :runner "Datasucker") (play-from-hand state :runner "Incubator") @@ -571,8 +556,8 @@ (deftest ixodidae ;; Ixodidae should not trigger on psi-games (do-game - (new-game (default-corp ["Snowflake"]) - (default-runner ["Ixodidae" "Lamprey"])) + (new-game {:corp {:deck ["Snowflake"]} + :runner {:deck ["Ixodidae" "Lamprey"]}}) (play-from-hand state :corp "Snowflake" "HQ") (take-credits state :corp) (is (= 7 (:credit (get-corp))) "Corp at 7 credits") @@ -599,8 +584,8 @@ ;; Kyuban (testing "Gain creds when passing a piece of ice, both when rezzed and when unrezzed." (do-game - (new-game (default-corp [(qty "Lockdown" 3)]) - (default-runner [(qty "Kyuban" 1)])) + (new-game {:corp {:deck [(qty "Lockdown" 3)]} + :runner {:deck [(qty "Kyuban" 1)]}}) (play-from-hand state :corp "Lockdown" "HQ") (play-from-hand state :corp "Lockdown" "Archives") (let [ld1 (get-ice state :archives 0) @@ -631,8 +616,7 @@ (deftest lamprey ;; Lamprey - Corp loses 1 credit for each successful HQ run; trashed on purge (do-game - (new-game (default-corp) - (default-runner ["Lamprey"])) + (new-game {:runner {:deck ["Lamprey"]}}) (take-credits state :corp) (play-from-hand state :runner "Lamprey") (let [lamp (get-program state 0)] @@ -650,8 +634,7 @@ ;; Leprechaun - hosting a breaker with strength based on unused MU should calculate correctly (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner ["Adept" "Leprechaun"])) + (new-game {:runner {:deck ["Adept" "Leprechaun"]}}) (take-credits state :corp) (core/gain state :runner :credit 5) (play-from-hand state :runner "Leprechaun") @@ -667,8 +650,7 @@ (is (= 5 (:current-strength (refresh hosted-adpt))) "Adept at 5 strength hosted"))))) (testing "Keep MU the same when hosting or trashing hosted programs" (do-game - (new-game (default-corp) - (default-runner ["Leprechaun" "Hyperdriver" "Imp"])) + (new-game {:runner {:deck ["Leprechaun" "Hyperdriver" "Imp"]}}) (take-credits state :corp) (play-from-hand state :runner "Leprechaun") (let [lep (get-program state 0)] @@ -691,8 +673,7 @@ (deftest magnum-opus ;; Magnum Opus - Gain 2 cr (do-game - (new-game (default-corp) - (default-runner ["Magnum Opus"])) + (new-game {:runner {:deck ["Magnum Opus"]}}) (take-credits state :corp) (play-from-hand state :runner "Magnum Opus") (is (= 2 (core/available-mu state))) @@ -704,8 +685,8 @@ (deftest nyashia ;; Nyashia (do-game - (new-game (default-corp [(qty "Hedge Fund" 10)]) - (default-runner ["Nyashia"])) + (new-game {:corp {:deck [(qty "Hedge Fund" 10)]} + :runner {:deck ["Nyashia"]}}) (take-credits state :corp) (play-from-hand state :runner "Nyashia") (run-on state "R&D") @@ -716,8 +697,7 @@ (deftest origami ;; Origami - Increases Runner max hand size (do-game - (new-game (default-corp) - (default-runner [(qty "Origami" 2)])) + (new-game {:runner {:deck [(qty "Origami" 2)]}}) (take-credits state :corp) (play-from-hand state :runner "Origami") (is (= 6 (core/hand-size state :runner))) @@ -727,8 +707,8 @@ (deftest paintbrush ;; Paintbrush - Give rezzed ICE a chosen subtype until the end of the next run (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Paintbrush"])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Paintbrush"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) (play-from-hand state :runner "Paintbrush") @@ -744,15 +724,15 @@ (click-card state :runner iwall) (click-prompt state :runner "Code Gate") (is (= 2 (:click (get-runner))) "Click charged") - (is (= true (has? (refresh iwall) :subtype "Code Gate")) "Ice Wall gained Code Gate") + (is (= true (utils/has? (refresh iwall) :subtype "Code Gate")) "Ice Wall gained Code Gate") (run-empty-server state "Archives") - (is (= false (has? (refresh iwall) :subtype "Code Gate")) "Ice Wall lost Code Gate at the end of the run")))) + (is (= false (utils/has? (refresh iwall) :subtype "Code Gate")) "Ice Wall lost Code Gate at the end of the run")))) (deftest parasite (testing "Basic functionality: Gain 1 counter every Runner turn" (do-game - (new-game (default-corp [(qty "Wraparound" 3) (qty "Hedge Fund" 3)]) - (default-runner [(qty "Parasite" 3) (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Wraparound" 3) (qty "Hedge Fund" 3)]} + :runner {:deck [(qty "Parasite" 3) (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Wraparound" "HQ") (let [wrap (get-ice state :hq 0)] (core/rez state :corp wrap) @@ -769,8 +749,8 @@ (is (= 6 (:current-strength (refresh wrap))) "Wraparound reduced to 6 strength"))))) (testing "Installed facedown w/ Apex" (do-game - (new-game (default-corp) - (make-deck "Apex: Invasive Predator" ["Parasite"])) + (new-game {:runner {:id "Apex: Invasive Predator" + :deck ["Parasite"]}}) (take-credits state :corp) (core/end-phase-12 state :runner nil) (click-card state :runner (find-card "Parasite" (:hand (get-runner)))) @@ -778,8 +758,8 @@ (is (= 1 (count (get-runner-facedown state))) "Parasite installed face down"))) (testing "Installed on untrashable Architect should keep gaining counters past 3 and make strength go negative" (do-game - (new-game (default-corp [(qty "Architect" 3) (qty "Hedge Fund" 3)]) - (default-runner [(qty "Parasite" 3) "Grimoire"])) + (new-game {:corp {:deck [(qty "Architect" 3) (qty "Hedge Fund" 3)]} + :runner {:deck [(qty "Parasite" 3) "Grimoire"]}}) (play-from-hand state :corp "Architect" "HQ") (let [arch (get-ice state :hq 0)] (core/rez state :corp arch) @@ -799,8 +779,8 @@ (is (= -1 (:current-strength (refresh arch))) "Architect at -1 strength"))))) (testing "Should stay on hosted card moved by Builder" (do-game - (new-game (default-corp [(qty "Builder" 3) "Ice Wall"]) - (default-runner [(qty "Parasite" 3)])) + (new-game {:corp {:deck [(qty "Builder" 3) "Ice Wall"]} + :runner {:deck [(qty "Parasite" 3)]}}) (play-from-hand state :corp "Ice Wall" "HQ") (play-from-hand state :corp "Builder" "Archives") (let [builder (get-ice state :archives 0)] @@ -829,11 +809,11 @@ (is (= 2 (get-counters (refresh updated-psite) :virus)) "Parasite counters still incremented"))))))) (testing "Use Hivemind counters when installed; instantly trash ICE if counters >= ICE strength" (do-game - (new-game (default-corp [(qty "Enigma" 3) (qty "Hedge Fund" 3)]) - (default-runner ["Parasite" + (new-game {:corp {:deck [(qty "Enigma" 3) (qty "Hedge Fund" 3)]} + :runner {:deck ["Parasite" "Grimoire" "Hivemind" - "Sure Gamble"])) + "Sure Gamble"]}}) (play-from-hand state :corp "Enigma" "HQ") (let [enig (get-ice state :hq 0)] (core/rez state :corp enig) @@ -850,8 +830,8 @@ (is (= 2 (count (:discard (get-runner)))) "Parasite trashed when Enigma was trashed"))))) (testing "Trashed along with host ICE when its strength has been reduced to 0" (do-game - (new-game (default-corp [(qty "Enigma" 3) (qty "Hedge Fund" 3)]) - (default-runner [(qty "Parasite" 3) "Grimoire"])) + (new-game {:corp {:deck [(qty "Enigma" 3) (qty "Hedge Fund" 3)]} + :runner {:deck [(qty "Parasite" 3) "Grimoire"]}}) (play-from-hand state :corp "Enigma" "HQ") (let [enig (get-ice state :hq 0)] (core/rez state :corp enig) @@ -870,8 +850,7 @@ (deftest pheromones ;; Pheromones ability shouldn't have a NullPointerException when fired with 0 virus counter (do-game - (new-game (default-corp) - (default-runner ["Pheromones"])) + (new-game {:runner {:deck ["Pheromones"]}}) (take-credits state :corp) (play-from-hand state :runner "Pheromones") (let [ph (get-program state 0)] @@ -885,8 +864,8 @@ (deftest plague ;; Plague (do-game - (new-game (default-corp ["Mark Yale"]) - (default-runner ["Plague"])) + (new-game {:corp {:deck ["Mark Yale"]} + :runner {:deck ["Plague"]}}) (play-from-hand state :corp "Mark Yale" "New remote") (take-credits state :corp) (play-from-hand state :runner "Plague") @@ -903,8 +882,7 @@ ;; Progenitor (testing "Hosting Hivemind, using Virus Breeding Ground. Issue #738" (do-game - (new-game (default-corp) - (default-runner ["Progenitor" "Virus Breeding Ground" "Hivemind"])) + (new-game {:runner {:deck ["Progenitor" "Virus Breeding Ground" "Hivemind"]}}) (take-credits state :corp) (play-from-hand state :runner "Progenitor") (play-from-hand state :runner "Virus Breeding Ground") @@ -926,8 +904,7 @@ (is (zero? (get-counters (refresh vbg) :virus)) "Virus Breeding Ground lost 1 counter"))))) (testing "Keep MU the same when hosting or trashing hosted programs" (do-game - (new-game (default-corp) - (default-runner ["Progenitor" "Hivemind"])) + (new-game {:runner {:deck ["Progenitor" "Hivemind"]}}) (take-credits state :corp) (play-from-hand state :runner "Progenitor") (let [pro (get-program state 0)] @@ -944,8 +921,8 @@ ;; Reaver - Draw a card the first time you trash an installed card each turn (testing "Basic test" (do-game - (new-game (default-corp ["PAD Campaign"]) - (default-runner ["Reaver" (qty "Fall Guy" 5)])) + (new-game {:corp {:deck ["PAD Campaign"]} + :runner {:deck ["Reaver" (qty "Fall Guy" 5)]}}) (starting-hand state :runner ["Reaver" "Fall Guy"]) (play-from-hand state :corp "PAD Campaign" "New remote") (take-credits state :corp) @@ -968,8 +945,7 @@ (is (= 1 (count (:hand (get-runner)))) "One card in hand"))) (testing "with Freelance Coding Construct - should not draw when trash from hand #2671" (do-game - (new-game (default-corp) - (default-runner [(qty "Reaver" 9) "Imp" "Snitch" "Freelance Coding Contract"])) + (new-game {:runner {:deck [(qty "Reaver" 9) "Imp" "Snitch" "Freelance Coding Contract"]}}) (starting-hand state :runner ["Reaver" "Imp" "Snitch" "Freelance Coding Contract"]) (take-credits state :corp) (play-from-hand state :runner "Reaver") @@ -986,8 +962,8 @@ ;; RNG Key - first successful run on RD/HQ, guess a number, gain credits or cards if number matches card cost (testing "Basic behaviour - first successful run on RD/HQ, guess a number, gain credits or cards if number matches card cost" (do-game - (new-game (default-corp [(qty "Enigma" 5) "Hedge Fund"]) - (default-runner ["RNG Key" (qty "Paperclip" 2)])) + (new-game {:corp {:deck [(qty "Enigma" 5) "Hedge Fund"]} + :runner {:deck ["RNG Key" (qty "Paperclip" 2)]}}) (starting-hand state :corp ["Hedge Fund"]) (starting-hand state :runner ["RNG Key"]) (take-credits state :corp) @@ -1040,8 +1016,8 @@ (is (zero? (count (:deck (get-runner)))) "Cards came from stack")))) (testing "Do not pay out if accessing an upgrade first -- regression test for #3150" (do-game - (new-game (default-corp ["Hokusai Grid" "Hedge Fund"]) - (default-runner ["RNG Key"])) + (new-game {:corp {:deck ["Hokusai Grid" "Hedge Fund"]} + :runner {:deck ["RNG Key"]}}) (play-from-hand state :corp "Hokusai Grid" "HQ") (take-credits state :corp) (testing "Gain 3 credits" @@ -1059,9 +1035,8 @@ (deftest scheherazade ;; Scheherazade - Gain 1 credit when it hosts a program (do-game - (new-game (default-corp) - (default-runner ["Scheherazade" "Cache" - "Inti" "Fall Guy"])) + (new-game {:runner {:deck ["Scheherazade" "Cache" + "Inti" "Fall Guy"]}}) (take-credits state :corp) (play-from-hand state :runner "Scheherazade") (let [sch (get-program state 0)] @@ -1083,8 +1058,7 @@ (deftest self-modifying-code ;; Trash & pay 2 to search deck for a program and install it. Shuffle. (do-game - (new-game (default-corp) - (default-runner [(qty "Self-modifying Code" 3) "Reaver"])) + (new-game {:runner {:deck [(qty "Self-modifying Code" 3) "Reaver"]}}) (starting-hand state :runner ["Self-modifying Code" "Self-modifying Code"]) (core/gain state :runner :credit 5) (take-credits state :corp) @@ -1105,8 +1079,9 @@ (deftest sneakdoor-beta (testing "Gabriel Santiago, Ash on HQ should prevent Sneakdoor HQ access but still give Gabe credits. Issue #1138." (do-game - (new-game (default-corp ["Ash 2X3ZB9CY"]) - (make-deck "Gabriel Santiago: Consummate Professional" ["Sneakdoor Beta"])) + (new-game {:corp {:deck ["Ash 2X3ZB9CY"]} + :runner {:id "Gabriel Santiago: Consummate Professional" + :deck ["Sneakdoor Beta"]}}) (play-from-hand state :corp "Ash 2X3ZB9CY" "HQ") (take-credits state :corp) (play-from-hand state :runner "Sneakdoor Beta") @@ -1123,8 +1098,8 @@ (is (= :hq (-> (get-runner) :register :successful-run first)) "Successful Run on HQ recorded")))) (testing "do not switch to HQ if Archives has Crisium Grid. Issue #1229." (do-game - (new-game (default-corp ["Crisium Grid" "Priority Requisition" "Private Security Force"]) - (default-runner ["Sneakdoor Beta"])) + (new-game {:corp {:deck ["Crisium Grid" "Priority Requisition" "Private Security Force"]} + :runner {:deck ["Sneakdoor Beta"]}}) (play-from-hand state :corp "Crisium Grid" "Archives") (trash-from-hand state :corp "Priority Requisition") (take-credits state :corp) @@ -1137,8 +1112,7 @@ (is (= :archives (get-in @state [:run :server 0])) "Crisium Grid stopped Sneakdoor Beta from switching to HQ")))) (testing "Allow Nerve Agent to gain counters. Issue #1158/#955" (do-game - (new-game (default-corp) - (default-runner ["Sneakdoor Beta" "Nerve Agent"])) + (new-game {:runner {:deck ["Sneakdoor Beta" "Nerve Agent"]}}) (take-credits state :corp) (core/gain state :runner :credit 10) (play-from-hand state :runner "Nerve Agent") @@ -1153,8 +1127,7 @@ (is (= 2 (get-counters (refresh nerve) :virus)))))) (testing "Grant Security Testing credits on HQ." (do-game - (new-game (default-corp) - (default-runner ["Security Testing" "Sneakdoor Beta"])) + (new-game {:runner {:deck ["Security Testing" "Sneakdoor Beta"]}}) (take-credits state :corp) (play-from-hand state :runner "Sneakdoor Beta") (play-from-hand state :runner "Security Testing") @@ -1171,8 +1144,8 @@ (deftest snitch ;; Snitch - Only works on unrezzed ice (do-game - (new-game (default-corp [(qty "Quandary" 2)]) - (default-runner ["Snitch"])) + (new-game {:corp {:deck [(qty "Quandary" 2)]} + :runner {:deck ["Snitch"]}}) (play-from-hand state :corp "Quandary" "R&D") (play-from-hand state :corp "Quandary" "HQ") (let [hqice (get-ice state :hq 0)] @@ -1197,28 +1170,28 @@ (deftest surfer ;; Surfer - Swap position with ice before or after when encountering a Barrier ICE (do-game - (new-game (default-corp ["Ice Wall" "Quandary"]) - (default-runner ["Surfer"])) - (play-from-hand state :corp "Quandary" "HQ") - (play-from-hand state :corp "Ice Wall" "HQ") - (take-credits state :corp) - (play-from-hand state :runner "Surfer") - (is (= 3 (:credit (get-runner))) "Paid 2 credits to install Surfer") - (core/rez state :corp (get-ice state :hq 1)) - (run-on state "HQ") - (is (= 2 (get-in @state [:run :position])) "Starting run at position 2") - (let [surf (get-program state 0)] - (card-ability state :runner surf 0) - (click-card state :runner (get-ice state :hq 0)) - (is (= 1 (:credit (get-runner))) "Paid 2 credits to use Surfer") - (is (= 1 (get-in @state [:run :position])) "Now at next position (1)") - (is (= "Ice Wall" (:title (get-ice state :hq 0))) "Ice Wall now at position 1")))) + (new-game {:corp {:deck ["Ice Wall" "Quandary"]} + :runner {:deck ["Surfer"]}}) + (play-from-hand state :corp "Quandary" "HQ") + (play-from-hand state :corp "Ice Wall" "HQ") + (take-credits state :corp) + (play-from-hand state :runner "Surfer") + (is (= 3 (:credit (get-runner))) "Paid 2 credits to install Surfer") + (core/rez state :corp (get-ice state :hq 1)) + (run-on state "HQ") + (is (= 2 (get-in @state [:run :position])) "Starting run at position 2") + (let [surf (get-program state 0)] + (card-ability state :runner surf 0) + (click-card state :runner (get-ice state :hq 0)) + (is (= 1 (:credit (get-runner))) "Paid 2 credits to use Surfer") + (is (= 1 (get-in @state [:run :position])) "Now at next position (1)") + (is (= "Ice Wall" (:title (get-ice state :hq 0))) "Ice Wall now at position 1")))) (deftest takobi ;; Takobi - 2 power counter to add +3 strength to a non-AI icebreaker for encounter (do-game - (new-game (default-corp ["Enigma"]) - (default-runner ["Takobi" "Corroder" "Faust"])) + (new-game {:corp {:deck ["Enigma"]} + :runner {:deck ["Takobi" "Corroder" "Faust"]}}) (play-from-hand state :corp "Enigma" "HQ") (take-credits state :corp) (core/gain state :runner :credit 10) @@ -1251,8 +1224,8 @@ (deftest trypano (testing "Hivemind and Architect interactions" (do-game - (new-game (default-corp [(qty "Architect" 2)]) - (default-runner [(qty "Trypano" 2) "Hivemind"])) + (new-game {:corp {:deck [(qty "Architect" 2)]} + :runner {:deck [(qty "Trypano" 2) "Hivemind"]}}) (play-from-hand state :corp "Architect" "HQ") (play-from-hand state :corp "Architect" "R&D") (let [architect-rezzed (get-ice state :hq 0) @@ -1279,8 +1252,8 @@ (is (= 1 (count (:discard (get-runner)))) "Trypano went to discard"))) (testing "Fire when Hivemind gains counters" (do-game - (new-game (default-corp ["Architect"]) - (default-runner ["Trypano" "Hivemind" (qty "Surge" 2)])) + (new-game {:corp {:deck ["Architect"]} + :runner {:deck ["Trypano" "Hivemind" (qty "Surge" 2)]}}) (play-from-hand state :corp "Architect" "R&D") (let [architect-unrezzed (get-ice state :rd 0)] (take-credits state :corp) @@ -1302,8 +1275,7 @@ (deftest upya (do-game - (new-game (default-corp) - (default-runner ["Upya"])) + (new-game {:runner {:deck ["Upya"]}}) (take-credits state :corp) (play-from-hand state :runner "Upya") (dotimes [_ 3] @@ -1329,8 +1301,8 @@ (deftest wari (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Wari"])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Wari"]}}) (play-from-hand state :corp "Ice Wall" "R&D") (take-credits state :corp) (play-from-hand state :runner "Wari") diff --git a/test/clj/game_test/cards/resources.clj b/test/clj/game_test/cards/resources.clj index d0f4d386e7..9516d8eb1d 100644 --- a/test/clj/game_test/cards/resources.clj +++ b/test/clj/game_test/cards/resources.clj @@ -1,18 +1,16 @@ (ns game-test.cards.resources (:require [game.core :as core] + [game.utils :as utils] [game-test.core :refer :all] [game-test.utils :refer :all] [game-test.macros :refer :all] [jinteki.utils :refer [count-tags]] [clojure.test :refer :all])) -(use-fixtures :once load-all-cards (partial reset-card-defs "resources")) - (deftest activist-support ;; Activist Support - Take tag if you have none; Corp gains bad pub if they have none (do-game - (new-game (default-corp) - (default-runner ["Activist Support"])) + (new-game {:runner {:deck ["Activist Support"]}}) (take-credits state :corp) (play-from-hand state :runner "Activist Support") (is (zero? (count-tags state))) @@ -30,8 +28,7 @@ ;; Ensure adjusted chronotype gains only 1 click when 2 clicks are lost (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner ["Adjusted Chronotype" (qty "Beach Party" 2)])) + (new-game {:runner {:deck ["Adjusted Chronotype" (qty "Beach Party" 2)]}}) (take-credits state :corp) (play-from-hand state :runner "Adjusted Chronotype") (play-from-hand state :runner "Beach Party") @@ -44,9 +41,8 @@ (is (= 3 (:click (get-runner))) "Should have lost 2 clicks and gained 1 click"))) (testing "Chronotype to cancel out MCA click loss" (do-game - (new-game - (default-corp ["MCA Austerity Policy"]) - (default-runner ["Adjusted Chronotype"])) + (new-game {:corp {:deck ["MCA Austerity Policy"]} + :runner {:deck ["Adjusted Chronotype"]}}) (take-credits state :corp) (play-from-hand state :runner "Adjusted Chronotype") (take-credits state :runner) @@ -60,10 +56,9 @@ (is (= 4 (:click (get-runner))))))) (testing "Ensure adjusted chronotype gains 2 clicks when 2 clicks are lost and GCS is installed" (do-game - (new-game (default-corp) - (default-runner ["Adjusted Chronotype" + (new-game {:runner {:deck ["Adjusted Chronotype" (qty "Beach Party" 3) - "Gene Conditioning Shoppe"])) + "Gene Conditioning Shoppe"]}}) (take-credits state :corp) (play-from-hand state :runner "Adjusted Chronotype") (play-from-hand state :runner "Beach Party") @@ -80,11 +75,10 @@ (take-credits state :corp) (is (= 3 (:click (get-runner))) "Should have lost 3 clicks and gained 2 clicks")))) -(deftest aesop's-pawnshop +(deftest aesop-s-pawnshop ;; Tests use cases for Aesop's Pawnshop (do-game - (new-game (default-corp) - (default-runner ["Aesop's Pawnshop" "Cache"])) + (new-game {:runner {:deck ["Aesop's Pawnshop" "Cache"]}}) (take-credits state :corp) (play-from-hand state :runner "Aesop's Pawnshop") (play-from-hand state :runner "Cache") @@ -104,8 +98,7 @@ (deftest all-nighter ;; All-nighter - Click/trash to gain 2 clicks (do-game - (new-game (default-corp) - (default-runner ["All-nighter"])) + (new-game {:runner {:deck ["All-nighter"]}}) (take-credits state :corp) (play-from-hand state :runner "All-nighter") (is (= 3 (:click (get-runner)))) @@ -117,8 +110,8 @@ ;; Bank Job (testing "Manhunt trace happens first" (do-game - (new-game (default-corp ["Manhunt" "PAD Campaign"]) - (default-runner ["Bank Job"])) + (new-game {:corp {:deck ["Manhunt" "PAD Campaign"]} + :runner {:deck ["Bank Job"]}}) (play-from-hand state :corp "Manhunt") (play-from-hand state :corp "PAD Campaign" "New remote") (take-credits state :corp) @@ -134,8 +127,8 @@ (is (= 1 (count (:discard (get-runner))))))) (testing "Choose which to use when 2+ copies are installed" (do-game - (new-game (default-corp ["PAD Campaign"]) - (default-runner [(qty "Bank Job" 2)])) + (new-game {:corp {:deck ["PAD Campaign"]} + :runner {:deck [(qty "Bank Job" 2)]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (take-credits state :corp) (play-from-hand state :runner "Bank Job") @@ -154,8 +147,8 @@ (is (= 2 (get-counters (refresh bj2) :credit)) "2 credits remaining on 2nd copy")))) (testing "Security Testing takes priority" (do-game - (new-game (default-corp ["PAD Campaign"]) - (default-runner ["Bank Job" "Security Testing"])) + (new-game {:corp {:deck ["PAD Campaign"]} + :runner {:deck ["Bank Job" "Security Testing"]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (take-credits state :corp) (play-from-hand state :runner "Security Testing") @@ -171,10 +164,9 @@ (deftest bazaar ;; Bazaar - Only triggers when installing from Grip (do-game - (new-game (default-corp) - (default-runner ["Street Peddler" + (new-game {:runner {:deck ["Street Peddler" "Bazaar" - (qty "Spy Camera" 6)])) + (qty "Spy Camera" 6)]}}) (take-credits state :corp) (starting-hand state :runner ["Street Peddler" "Bazaar" "Spy Camera" "Spy Camera" "Spy Camera"]) (play-from-hand state :runner "Bazaar") @@ -187,8 +179,7 @@ (deftest beach-party ;; Beach Party - Lose 1 click when turn begins; hand size increased by 5 (do-game - (new-game (default-corp) - (default-runner ["Beach Party"])) + (new-game {:runner {:deck ["Beach Party"]}}) (take-credits state :corp) (play-from-hand state :runner "Beach Party") (is (= 10 (core/hand-size state :runner)) "Max hand size increased by 5") @@ -199,8 +190,8 @@ (deftest bhagat ;; Bhagat - only trigger on first run (do-game - (new-game (default-corp [(qty "Hedge Fund" 3) (qty "Eli 1.0" 3) (qty "Architect" 3)]) - (default-runner ["Bhagat"])) + (new-game {:corp {:deck [(qty "Hedge Fund" 3) (qty "Eli 1.0" 3) (qty "Architect" 3)]} + :runner {:deck ["Bhagat"]}}) (starting-hand state :corp []) (take-credits state :corp) (run-empty-server state :hq) @@ -215,9 +206,9 @@ (deftest chrome-parlor ;; Chrome Parlor - Prevent all meat/brain dmg when installing cybernetics (do-game - (new-game (default-corp ["Traffic Accident"]) - (default-runner ["Chrome Parlor" "Titanium Ribs" - "Brain Cage" (qty "Sure Gamble" 2)])) + (new-game {:corp {:deck ["Traffic Accident"]} + :runner {:deck ["Chrome Parlor" "Titanium Ribs" + "Brain Cage" (qty "Sure Gamble" 2)]}}) (take-credits state :corp) (play-from-hand state :runner "Chrome Parlor") (play-from-hand state :runner "Titanium Ribs") @@ -236,8 +227,7 @@ (deftest citadel-sanctuary (testing "Interaction with Corporate Grant and Thunder Art Gallery" (do-game - (new-game (default-corp) - (default-runner ["Citadel Sanctuary" "Thunder Art Gallery" "Corroder" "Corporate \"Grant\""])) + (new-game {:runner {:deck ["Citadel Sanctuary" "Thunder Art Gallery" "Corroder" "Corporate \"Grant\""]}}) (take-credits state :corp) (core/gain state :runner :credit 5) (play-from-hand state :runner "Citadel Sanctuary") @@ -259,8 +249,8 @@ (deftest compromised-employee ;; Compromised Employee - Gain 1c every time Corp rezzes ICE (do-game - (new-game (default-corp [(qty "Pup" 2) "Launch Campaign"]) - (default-runner ["Compromised Employee"])) + (new-game {:corp {:deck [(qty "Pup" 2) "Launch Campaign"]} + :runner {:deck ["Compromised Employee"]}}) (play-from-hand state :corp "Pup" "HQ") (play-from-hand state :corp "Pup" "R&D") (play-from-hand state :corp "Launch Campaign" "New remote") @@ -278,8 +268,8 @@ (deftest councilman ;; Councilman reverses the rezz and prevents re-rezz (do-game - (new-game (default-corp ["Jackson Howard"]) - (default-runner ["Councilman"])) + (new-game {:corp {:deck ["Jackson Howard"]} + :runner {:deck ["Councilman"]}}) (play-from-hand state :corp "Jackson Howard" "New remote") (take-credits state :corp) (play-from-hand state :runner "Councilman") @@ -296,12 +286,11 @@ ;; Next turn (core/rez state :corp (refresh jesus)) (is (core/rezzed? (refresh jesus)) "Jackson Howard can be rezzed next turn")))) - (deftest-pending councilman-zone-change ;; Rezz no longer prevented when card changes zone (issues #1571) (do-game - (new-game (default-corp ["Jackson Howard"]) - (default-runner ["Councilman"])) + (new-game {:corp {:deck ["Jackson Howard"]} + :runner {:deck ["Councilman"]}}) (play-from-hand state :corp "Jackson Howard" "New remote") (take-credits state :corp) (play-from-hand state :runner "Councilman") @@ -323,8 +312,8 @@ ;; Counter-Surveillance (testing "Trash to run, on successful run access cards equal to Tags and pay that amount in credits" (do-game - (new-game (default-corp [(qty "Hedge Fund" 3)]) - (default-runner ["Counter Surveillance"])) + (new-game {:corp {:deck [(qty "Hedge Fund" 3)]} + :runner {:deck ["Counter Surveillance"]}}) (take-credits state :corp) (core/gain-tags state :runner 2) (play-from-hand state :runner "Counter Surveillance") @@ -344,8 +333,8 @@ (is (= 2 (:credit (get-runner))) "Runner has 2 credits")))) (testing "Test Obelus does not trigger before Counter Surveillance accesses are done. Issues #2675" (do-game - (new-game (default-corp [(qty "Hedge Fund" 3)]) - (default-runner ["Counter Surveillance" "Obelus" (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Hedge Fund" 3)]} + :runner {:deck ["Counter Surveillance" "Obelus" (qty "Sure Gamble" 3)]}}) (starting-hand state :runner ["Counter Surveillance" "Obelus"]) (take-credits state :corp) (core/gain-tags state :runner 2) @@ -374,8 +363,7 @@ (deftest daily-casts ;; Play and tick through all turns of daily casts (do-game - (new-game (default-corp) - (default-runner [(qty "Daily Casts" 3)])) + (new-game {:runner {:deck [(qty "Daily Casts" 3)]}}) (take-credits state :corp) (play-from-hand state :runner "Daily Casts") (let [dc (get-resource state 0)] @@ -402,8 +390,7 @@ (deftest data-folding ;; Data Folding - Gain 1c at start of turn if 2+ unused MU (do-game - (new-game (default-corp) - (default-runner ["Data Folding" "Hyperdriver"])) + (new-game {:runner {:deck ["Data Folding" "Hyperdriver"]}}) (take-credits state :corp) (play-from-hand state :runner "Data Folding") (take-credits state :runner) @@ -420,8 +407,8 @@ (deftest ddos ;; Prevent rezzing of outermost ice for the rest of the turn (do-game - (new-game (default-corp [(qty "Ice Wall" 3)]) - (default-runner ["DDoS"])) + (new-game {:corp {:deck [(qty "Ice Wall" 3)]} + :runner {:deck ["DDoS"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp) @@ -447,8 +434,7 @@ (deftest dean-lister ;; Basic test (do-game - (new-game (default-corp) - (default-runner ["Dean Lister" "Faust" (qty "Sure Gamble" 3)])) + (new-game {:runner {:deck ["Dean Lister" "Faust" (qty "Sure Gamble" 3)]}}) (take-credits state :corp) (play-from-hand state :runner "Dean Lister") (play-from-hand state :runner "Faust") @@ -470,8 +456,8 @@ (deftest decoy ;; Decoy - Trash to avoid 1 tag (do-game - (new-game (default-corp ["SEA Source"]) - (default-runner ["Decoy"])) + (new-game {:corp {:deck ["SEA Source"]} + :runner {:deck ["Decoy"]}}) (take-credits state :corp) (play-from-hand state :runner "Decoy") (run-empty-server state :archives) @@ -488,8 +474,8 @@ ;; District 99 - Gains power counters on hardware/program trashes, can spend 3 power counters to recur a card matching identity (testing "Trashes by both sides and manual triggers" (do-game - (new-game (default-corp ["Bio-Ethics Association"]) - (default-runner ["District 99" (qty "Spy Camera" 3) "Faerie"])) + (new-game {:corp {:deck ["Bio-Ethics Association"]} + :runner {:deck ["District 99" (qty "Spy Camera" 3) "Faerie"]}}) (play-from-hand state :corp "Bio-Ethics Association" "New remote") (take-credits state :corp) (play-from-hand state :runner "District 99") @@ -520,9 +506,9 @@ (is (= 2 (get-counters (refresh d99) :power)) "Trashing Spy Camera after Faerie did not place a counter")))) (testing "Rebirth interaction, basic functionality" (do-game - (new-game (default-corp ["Grim"]) - (make-deck "Armand \"Geist\" Walker: Tech Lord" - ["District 99" (qty "Spy Camera" 3) "Faerie" "Rebirth" "Sure Gamble"])) + (new-game {:corp {:deck ["Grim"]} + :runner {:id "Armand \"Geist\" Walker: Tech Lord" + :deck ["District 99" (qty "Spy Camera" 3) "Faerie" "Rebirth" "Sure Gamble"]}}) (play-from-hand state :corp "Grim" "HQ") (take-credits state :corp) (core/gain state :runner :click 10) @@ -575,7 +561,7 @@ (is (= "Faerie" (-> (get-runner) :hand first :title)) "Faerie added to hand") (is (zero? (get-counters (refresh d99) :power)) "Picking up Faerie removed 3 counters")))))) -(let [;; Start id +(let [;; Start id for dj-fenris sunny "Sunny Lebeau: Security Specialist" ;; Several G-mod identities geist "Armand \"Geist\" Walker: Tech Lord" @@ -588,14 +574,14 @@ whizzard "Whizzard: Master Gamer" reina "Reina Roja: Freedom Fighter" maxx "MaxX: Maximum Punk Rock"] - (deftest dj-fenris ;; DJ Fenris - host 1 g-mod id not in faction on DJ Fenris (testing "Hosting Chaos Theory" ;; Ensure +1 MU is handled correctly (do-game - (new-game (default-corp) - (make-deck sunny ["DJ Fenris"]) {:start-as :runner}) + (new-game {:runner {:id sunny + :deck ["DJ Fenris"]} + :options {:start-as :runner}}) (play-from-hand state :runner "DJ Fenris") (is (= (first (prompt-titles :runner)) geist) "List is sorted") (is (every? #(some #{%} (prompt-titles :runner)) @@ -631,8 +617,9 @@ (testing "Hosting Geist" ;; Ensure Geist effect triggers (do-game - (new-game (default-corp) - (make-deck sunny ["DJ Fenris" (qty "All-nighter" 3) (qty "Sure Gamble" 3)]) {:start-as :runner}) + (new-game {:runner {:id sunny + :deck ["DJ Fenris" (qty "All-nighter" 3) (qty "Sure Gamble" 3)]} + :options {:start-as :runner}}) (starting-hand state :runner ["DJ Fenris" "All-nighter" "All-nighter"]) (play-from-hand state :runner "All-nighter") (play-from-hand state :runner "All-nighter") @@ -662,9 +649,9 @@ (testing "Geist does not trigger Laguna Velasco" ;; Regression test for #3759 (do-game - (new-game (default-corp) - (make-deck sunny ["DJ Fenris" "Laguna Velasco District" (qty "All-nighter" 3) (qty "Sure Gamble" 3)]) - {:start-as :runner}) + (new-game {:runner {:id sunny + :deck ["DJ Fenris" "Laguna Velasco District" (qty "All-nighter" 3) (qty "Sure Gamble" 3)]} + :options {:start-as :runner}}) (starting-hand state :runner ["DJ Fenris" "Laguna Velasco District" "All-nighter"]) (core/gain state :runner :credit 10) (play-from-hand state :runner "All-nighter") @@ -685,8 +672,9 @@ "Drew one card with Geist when using All-nighter trash ability, not two (from Laguna Velasco District)")))) (testing "Disable with Malia" (do-game - (new-game (default-corp ["Malia Z0L0K4"]) - (make-deck geist ["DJ Fenris"])) + (new-game {:corp {:deck ["Malia Z0L0K4"]} + :runner {:id geist + :deck ["DJ Fenris"]}}) (play-from-hand state :corp "Malia Z0L0K4" "New remote") (take-credits state :corp) (play-from-hand state :runner "DJ Fenris") @@ -709,8 +697,7 @@ (deftest donut-taganes ;; Donut Taganes - add 1 to play cost of Operations & Events when this is in play (do-game - (new-game (default-corp) - (default-runner ["Donut Taganes" "Easy Mark"])) + (new-game {:runner {:deck ["Donut Taganes" "Easy Mark"]}}) (take-credits state :corp) (play-from-hand state :runner "Donut Taganes") (is (= 2 (:credit (get-runner))) "Donut played for 3c") @@ -725,8 +712,7 @@ ;; Dummy Box - trash a card from hand to prevent corp trashing installed card (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner [(qty "Dummy Box" 1) (qty "Cache" 1) (qty "Clot" 1)])) + (new-game {:runner {:deck [(qty "Dummy Box" 1) (qty "Cache" 1) (qty "Clot" 1)]}}) (take-credits state :corp) (play-from-hand state :runner "Dummy Box") (play-from-hand state :runner "Cache") @@ -742,8 +728,7 @@ (is (= 1 (count (get-resource state))) "Dummy Box still installed"))) (testing "doesn't prevent program deletion during purge" (do-game - (new-game (default-corp) - (default-runner [(qty "Dummy Box" 1) (qty "Cache" 1) (qty "Clot" 1)])) + (new-game {:runner {:deck [(qty "Dummy Box" 1) (qty "Cache" 1) (qty "Clot" 1)]}}) (take-credits state :corp) (play-from-hand state :runner "Dummy Box") (play-from-hand state :runner "Clot") @@ -755,8 +740,7 @@ ;; Eden Shard - Install from Grip in lieu of accessing R&D; trash to make Corp draw 2 (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner ["Eden Shard"])) + (new-game {:runner {:deck ["Eden Shard"]}}) (starting-hand state :corp ["Hedge Fund"]) (take-credits state :corp) (is (= 1 (count (:hand (get-corp))))) @@ -770,8 +754,7 @@ (is (= 1 (count (:discard (get-runner)))) "Eden Shard trashed"))) (testing "Do not install when accessing cards" (do-game - (new-game (default-corp) - (default-runner ["Eden Shard"])) + (new-game {:runner {:deck ["Eden Shard"]}}) (starting-hand state :corp ["Hedge Fund"]) (take-credits state :corp) (is (= 1 (count (:hand (get-corp))))) @@ -784,8 +767,8 @@ ;; Fan Site - Add to score area as 0 points when Corp scores an agenda (testing "Basic test" (do-game - (new-game (default-corp ["Hostile Takeover"]) - (default-runner ["Fan Site"])) + (new-game {:corp {:deck ["Hostile Takeover"]} + :runner {:deck ["Fan Site"]}}) (take-credits state :corp) (play-from-hand state :runner "Fan Site") (take-credits state :runner) @@ -795,8 +778,8 @@ (is (= 1 (count (:scored (get-runner)))) "Fan Site added to Runner score area"))) (testing "Don't trigger after swap with Exchange of Information. Issue #1824" (do-game - (new-game (default-corp [(qty "Hostile Takeover" 2) "Exchange of Information"]) - (default-runner ["Fan Site"])) + (new-game {:corp {:deck [(qty "Hostile Takeover" 2) "Exchange of Information"]} + :runner {:deck ["Fan Site"]}}) (take-credits state :corp) (play-from-hand state :runner "Fan Site") (take-credits state :runner) @@ -814,8 +797,8 @@ (is (find-card "Fan Site" (:scored (get-corp))) "Fan Site not removed from Corp score area"))) (testing "Runner can forfeit Fan Site" (do-game - (new-game (default-corp ["Hostile Takeover"]) - (default-runner ["Fan Site" "Data Dealer"])) + (new-game {:corp {:deck ["Hostile Takeover"]} + :runner {:deck ["Fan Site" "Data Dealer"]}}) (take-credits state :corp) (play-from-hand state :runner "Fan Site") (take-credits state :runner) @@ -834,8 +817,7 @@ (deftest fester ;; Fester - Corp loses 2c (if able) when purging viruses (do-game - (new-game (default-corp) - (default-runner ["Fester"])) + (new-game {:runner {:deck ["Fester"]}}) (take-credits state :corp) (play-from-hand state :runner "Fester") (take-credits state :runner) @@ -851,8 +833,8 @@ ;; Film Critic (testing "Prevent Corp-trashed execs going to Runner scored. Issues #1181/#1042" (do-game - (new-game (default-corp [(qty "Director Haas" 3) (qty "Project Vitruvius" 3) "Hedge Fund"]) - (default-runner ["Film Critic"])) + (new-game {:corp {:deck [(qty "Director Haas" 3) (qty "Project Vitruvius" 3) "Hedge Fund"]} + :runner {:deck ["Film Critic"]}}) (play-from-hand state :corp "Project Vitruvius" "New remote") (take-credits state :corp) (play-from-hand state :runner "Film Critic") @@ -867,8 +849,8 @@ (is (empty? (:scored (get-runner))) "Nothing in Runner scored")))) (testing "Fetal AI interaction" (do-game - (new-game (default-corp [(qty "Fetal AI" 3)]) - (default-runner ["Film Critic" (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Fetal AI" 3)]} + :runner {:deck ["Film Critic" (qty "Sure Gamble" 3)]}}) (take-credits state :corp) (play-from-hand state :runner "Film Critic") (let [fc (first (get-resource state))] @@ -883,8 +865,8 @@ (is (= 3 (count (:hand (get-runner)))) "No damage dealt")))) (testing "Do not take a net damage when a hosted agenda is trashed due to film critic trash #2382" (do-game - (new-game (default-corp [(qty "Hostile Infrastructure" 3) "Project Vitruvius"]) - (default-runner ["Film Critic" (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Hostile Infrastructure" 3) "Project Vitruvius"]} + :runner {:deck ["Film Critic" (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Hostile Infrastructure" "New remote") (play-from-hand state :corp "Project Vitruvius" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -903,8 +885,8 @@ (is (= 3 (count (:hand (get-runner)))) "No damage dealt")))) (testing "required hosted cards to be an agenda before firing ability" (do-game - (new-game (default-corp ["MCA Informant"]) - (default-runner ["Film Critic"])) + (new-game {:corp {:deck ["MCA Informant"]} + :runner {:deck ["Film Critic"]}}) (take-credits state :corp) (play-from-hand state :runner "Film Critic") (let [fc (first (get-resource state))] @@ -920,9 +902,8 @@ ;; Find the Truth (testing "Basic test - On successful run see the top card from R&D before access" (do-game - (new-game - (default-corp [(qty "Restructure" 10)]) - (default-runner ["Find the Truth"])) + (new-game {:corp {:deck [(qty "Restructure" 10)]} + :runner {:deck ["Find the Truth"]}}) (take-credits state :corp) (play-from-hand state :runner "Find the Truth") (run-on state "HQ") @@ -933,9 +914,8 @@ (click-prompt state :runner "OK"))) (testing "Equivocation & FTT - should get order of choice" (do-game - (new-game - (default-corp [(qty "Restructure" 10)]) - (default-runner ["Equivocation" "Find the Truth"])) + (new-game {:corp {:deck [(qty "Restructure" 10)]} + :runner {:deck ["Equivocation" "Find the Truth"]}}) (take-credits state :corp) (core/gain state :runner :credit 10) (play-from-hand state :runner "Equivocation") @@ -950,9 +930,8 @@ (click-prompt state :runner "Yes"))) (testing "Find The Truth should completed before Marilyn trash is forced" (do-game - (new-game - (default-corp ["Marilyn Campaign" (qty "Vanilla" 10)]) - (default-runner ["Find the Truth" "Neutralize All Threats"])) + (new-game {:corp {:deck ["Marilyn Campaign" (qty "Vanilla" 10)]} + :runner {:deck ["Find the Truth" "Neutralize All Threats"]}}) (starting-hand state :corp ["Marilyn Campaign"]) (play-from-hand state :corp "Marilyn Campaign" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -977,8 +956,8 @@ ;; Gang Sign (testing "accessing from HQ, not including root. Issue #2113" (do-game - (new-game (default-corp [(qty "Hostile Takeover" 3) (qty "Braintrust" 2) "Crisium Grid"]) - (default-runner [(qty "Gang Sign" 2) "HQ Interface"])) + (new-game {:corp {:deck [(qty "Hostile Takeover" 3) (qty "Braintrust" 2) "Crisium Grid"]} + :runner {:deck [(qty "Gang Sign" 2) "HQ Interface"]}}) (play-from-hand state :corp "Crisium Grid" "HQ") (take-credits state :corp) (core/gain state :runner :credit 100) @@ -1003,8 +982,8 @@ (click-prompt state :runner "Steal")))) (testing "accessing from HQ, not including root. Issue #2113" (do-game - (new-game (default-corp ["Hostile Takeover" "Snare!"]) - (default-runner ["Gang Sign"])) + (new-game {:corp {:deck ["Hostile Takeover" "Snare!"]} + :runner {:deck ["Gang Sign"]}}) (take-credits state :corp) (play-from-hand state :runner "Gang Sign") (take-credits state :runner) @@ -1019,9 +998,9 @@ ;; Gene Conditioning Shoppe - set :genetics-trigger-twice flag (testing "Basic test" (do-game - (new-game (default-corp [(qty "Hedge Fund" 3)]) - (default-runner ["Gene Conditioning Shoppe" - "Adjusted Chronotype"])) + (new-game {:corp {:deck [(qty "Hedge Fund" 3)]} + :runner {:deck ["Gene Conditioning Shoppe" + "Adjusted Chronotype"]}}) (take-credits state :corp) (play-from-hand state :runner "Adjusted Chronotype") (is (not (core/has-flag? state :runner :persistent :genetics-trigger-twice))) @@ -1031,9 +1010,9 @@ (is (not (core/has-flag? state :runner :persistent :genetics-trigger-twice))))) (testing "set :genetics-trigger-twice flag - ensure redundant copies work" (do-game - (new-game (default-corp [(qty "Hedge Fund" 3)]) - (default-runner [(qty "Gene Conditioning Shoppe" 2) - "Adjusted Chronotype"])) + (new-game {:corp {:deck [(qty "Hedge Fund" 3)]} + :runner {:deck [(qty "Gene Conditioning Shoppe" 2) + "Adjusted Chronotype"]}}) (take-credits state :corp) (take-credits state :runner) (take-credits state :corp) @@ -1053,8 +1032,7 @@ (deftest globalsec-security-clearance ;; Globalsec Security Clearance - Ability, click lost on use (do-game - (new-game (default-corp) - (default-runner ["Globalsec Security Clearance"])) + (new-game {:runner {:deck ["Globalsec Security Clearance"]}}) (take-credits state :corp) (core/gain state :runner :link 2) (play-from-hand state :runner "Globalsec Security Clearance") @@ -1071,8 +1049,7 @@ (deftest grifter ;; Grifter - Gain 1c if you made a successful run this turn, otherwise trash it (do-game - (new-game (default-corp) - (default-runner ["Grifter"])) + (new-game {:runner {:deck ["Grifter"]}}) (take-credits state :corp) (play-from-hand state :runner "Grifter") (run-empty-server state :hq) @@ -1088,8 +1065,8 @@ ;; Guru Davinder - no prompt/trash for 'preventing' 0 damage (testing "Basic test" (do-game - (new-game (default-corp ["Punitive Counterstrike"]) - (default-runner ["Guru Davinder"])) + (new-game {:corp {:deck ["Punitive Counterstrike"]} + :runner {:deck ["Guru Davinder"]}}) (take-credits state :corp) (play-from-hand state :runner "Guru Davinder") (take-credits state :runner) @@ -1100,8 +1077,9 @@ "There is no prompt for 0 damage"))) (testing "cannot steal Obokata while installed" (do-game - (new-game (make-deck "Jinteki: Personal Evolution" [(qty "Obokata Protocol" 10)]) - (default-runner ["Guru Davinder" (qty "Sure Gamble" 4)])) + (new-game {:corp {:id "Jinteki: Personal Evolution" + :deck [(qty "Obokata Protocol" 10)]} + :runner {:deck ["Guru Davinder" (qty "Sure Gamble" 4)]}}) (play-from-hand state :corp "Obokata Protocol" "New remote") (take-credits state :corp) (core/gain state :runner :agenda-point 6) @@ -1114,8 +1092,7 @@ (deftest hard-at-work ;; Hard at Work - Gain 2c and lose 1 click when turn begins (do-game - (new-game (default-corp) - (default-runner ["Hard at Work"])) + (new-game {:runner {:deck ["Hard at Work"]}}) (take-credits state :corp) (play-from-hand state :runner "Hard at Work") (take-credits state :runner) @@ -1126,8 +1103,8 @@ (deftest ice-carver ;; Ice Carver - lower ice strength on encounter (do-game - (new-game (default-corp ["Ice Wall"]) - (default-runner ["Ice Carver"])) + (new-game {:corp {:deck ["Ice Wall"]} + :runner {:deck ["Ice Carver"]}}) (play-from-hand state :corp "Ice Wall" "Archives") (take-credits state :corp 2) (let [iwall (get-ice state :archives 0)] @@ -1141,8 +1118,7 @@ (deftest investigative-journalism ;; Investigative Journalism - 4 clicks and trash to give the Corp 1 bad pub (do-game - (new-game (default-corp) - (default-runner ["Investigative Journalism"])) + (new-game {:runner {:deck ["Investigative Journalism"]}}) (take-credits state :corp) (play-from-hand state :runner "Investigative Journalism") (is (empty? (get-resource state)) "Corp has no bad pub, couldn't install") @@ -1155,12 +1131,12 @@ (is (= 1 (count (:discard (get-runner)))) "IJ is trashed") (is (= 2 (:bad-publicity (get-corp))) "Corp took 1 bad publicity"))) -(deftest jackpot! +(deftest jackpot ;; Jackpot! - whenever a card enters your score area, trash Jackpot to pull off credits (testing "Basic test" (do-game - (new-game (default-corp ["Braintrust"]) - (default-runner ["Jackpot!"])) + (new-game {:corp {:deck ["Braintrust"]} + :runner {:deck ["Jackpot!"]}}) (take-credits state :corp) (play-from-hand state :runner "Jackpot!") (let [jak (get-resource state 0)] @@ -1181,8 +1157,8 @@ (is (= 1 (count (:discard (get-runner)))) "Jackpot! trashed")))) (testing "should fire when moving agendas from Film Critic to scored area" (do-game - (new-game (default-corp ["Project Vitruvius"]) - (default-runner ["Jackpot!" "Film Critic"])) + (new-game {:corp {:deck ["Project Vitruvius"]} + :runner {:deck ["Jackpot!" "Film Critic"]}}) (play-from-hand state :corp "Project Vitruvius" "New remote") (take-credits state :corp) (play-from-hand state :runner "Film Critic") @@ -1202,8 +1178,8 @@ (is (empty? (:hosted (refresh fc))) "Removed agenda hosted on FC")))) (testing "should fire when trashing Chairman Hiro" (do-game - (new-game (default-corp ["Chairman Hiro"]) - (default-runner ["Jackpot!"])) + (new-game {:corp {:deck ["Chairman Hiro"]} + :runner {:deck ["Jackpot!"]}}) (play-from-hand state :corp "Chairman Hiro" "New remote") (take-credits state :corp) (play-from-hand state :runner "Jackpot!") @@ -1223,8 +1199,8 @@ ;; Jak Sinclair (testing "Lost clicks carry through to when turn starts fully #1764" (do-game - (new-game (default-corp [(qty "Enigma" 3)]) - (default-runner [(qty "Jak Sinclair" 3)])) + (new-game {:corp {:deck [(qty "Enigma" 3)]} + :runner {:deck [(qty "Jak Sinclair" 3)]}}) (play-from-hand state :corp "Enigma" "HQ") (take-credits state :corp) (play-from-hand state :runner "Jak Sinclair") @@ -1244,10 +1220,10 @@ (deftest john-masanori ;; John Masanori - Draw 1 card on first successful run, take 1 tag on first unsuccessful run (do-game - (new-game (default-corp ["Crisium Grid"]) - (default-runner [(qty "John Masanori" 3) + (new-game {:corp {:deck ["Crisium Grid"]} + :runner {:deck [(qty "John Masanori" 3) (qty "Sure Gamble" 3) - "Fall Guy"])) + "Fall Guy"]}}) (play-from-hand state :corp "Crisium Grid" "HQ") (core/rez state :corp (get-content state :hq 0)) (take-credits state :corp) @@ -1267,11 +1243,10 @@ (run-jack-out state) (is (= 1 (count-tags state)) "No tag taken from second unsuccessful run"))) -(deftest joshua-b. +(deftest joshua-b ;; Joshua B. - Take 1 tag at turn end if you choose to gain the extra click (do-game - (new-game (default-corp) - (default-runner ["Joshua B."])) + (new-game {:runner {:deck ["Joshua B."]}}) (take-credits state :corp) (play-from-hand state :runner "Joshua B.") (take-credits state :runner) @@ -1288,8 +1263,7 @@ (deftest kati-jones ;; Kati Jones - Click to store and take (do-game - (new-game (default-corp) - (default-runner ["Kati Jones"])) + (new-game {:runner {:deck ["Kati Jones"]}}) (take-credits state :corp) (play-from-hand state :runner "Kati Jones") (is (= 3 (:credit (get-runner)))) @@ -1315,8 +1289,7 @@ (deftest lewi-guilherme ;; Lewi Guilherme - lower corp hand size by 1, pay 1 credit when turn begins or trash (do-game - (new-game (default-corp) - (default-runner [(qty "Lewi Guilherme" 2)])) + (new-game {:runner {:deck [(qty "Lewi Guilherme" 2)]}}) (take-credits state :corp) (play-from-hand state :runner "Lewi Guilherme") (is (= -1 (get-in (get-corp) [:hand-size :mod])) "Corp hand size reduced by 1") @@ -1343,8 +1316,8 @@ ;; Logic Bomb (testing "Basic test" (do-game - (new-game (default-corp [(qty "Ice Wall" 2)]) - (default-runner ["Logic Bomb"])) + (new-game {:corp {:deck [(qty "Ice Wall" 2)]} + :runner {:deck ["Logic Bomb"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (core/rez state :corp (get-ice state :hq 0)) (take-credits state :corp) @@ -1358,8 +1331,8 @@ (is (last-log-contains? state "\\[Click\\]\\[Click\\]") "Log should mention 2 clicks"))) (testing "if the runner has no clicks left" (do-game - (new-game (default-corp [(qty "Ice Wall" 2)]) - (default-runner ["Logic Bomb"])) + (new-game {:corp {:deck [(qty "Ice Wall" 2)]} + :runner {:deck ["Logic Bomb"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (core/rez state :corp (get-ice state :hq 0)) (take-credits state :corp) @@ -1377,9 +1350,8 @@ (deftest london-library ;; Install non-virus programs on London library. Includes #325/409 (do-game - (new-game (default-corp) - (default-runner ["London Library" "Darwin" "Study Guide" - "Chameleon" "Femme Fatale"])) + (new-game {:runner {:deck ["London Library" "Darwin" "Study Guide" + "Chameleon" "Femme Fatale"]}}) (take-credits state :corp) (core/gain state :runner :click 2) (play-from-hand state :runner "London Library") @@ -1423,9 +1395,7 @@ (deftest miss-bones ;; Miss Bones - credits for trashing installed cards, trash when empty (do-game - (new-game - (default-corp) - (default-runner ["Miss Bones"])) + (new-game {:runner {:deck ["Miss Bones"]}}) (take-credits state :corp) (play-from-hand state :runner "Miss Bones") (let [mb (get-resource state 0)] @@ -1444,8 +1414,8 @@ ;; Muertos Gang Member - Install and Trash (testing "Basic test" (do-game - (new-game (default-corp ["Tollbooth" "Ice Wall"]) - (default-runner [(qty "Hedge Fund" 3) "Muertos Gang Member"])) + (new-game {:corp {:deck ["Tollbooth" "Ice Wall"]} + :runner {:deck [(qty "Hedge Fund" 3) "Muertos Gang Member"]}}) (play-from-hand state :corp "Tollbooth" "HQ") (play-from-hand state :corp "Ice Wall" "Archives") (take-credits state :corp) @@ -1464,9 +1434,9 @@ (is (:rezzed (refresh toll)) "Tollbooth was rezzed"))))) (testing "Account for Reina interaction, #1098" (do-game - (new-game (default-corp ["Tollbooth" "Ice Wall"]) - (make-deck "Reina Roja: Freedom Fighter" [(qty "Hedge Fund" 3) - "Muertos Gang Member"])) + (new-game {:corp {:deck ["Tollbooth" "Ice Wall"]} + :runner {:id "Reina Roja: Freedom Fighter" + :deck [(qty "Hedge Fund" 3) "Muertos Gang Member"]}}) (play-from-hand state :corp "Tollbooth" "HQ") (play-from-hand state :corp "Ice Wall" "Archives") (let [toll (get-ice state :hq 0) @@ -1489,8 +1459,7 @@ (deftest net-mercur ;; Net Mercur - Gains 1 credit or draw 1 card when a stealth credit is used (do-game - (new-game (default-corp) - (default-runner ["Net Mercur" "Silencer" "Ghost Runner"])) + (new-game {:runner {:deck ["Net Mercur" "Silencer" "Ghost Runner"]}}) (take-credits state :corp) (core/gain state :runner :click 4 :credit 10) (play-from-hand state :runner "Silencer") @@ -1518,8 +1487,8 @@ ;; ICE install costs 1 more except for inner most (testing "Basic test" (do-game - (new-game (default-corp [(qty "Paper Wall" 3)]) - (default-runner ["Network Exchange"])) + (new-game {:corp {:deck [(qty "Paper Wall" 3)]} + :runner {:deck ["Network Exchange"]}}) (take-credits state :corp) (play-from-hand state :runner "Network Exchange") (take-credits state :runner) @@ -1531,8 +1500,8 @@ (is (= 3 (:credit (get-corp))) "Paid 1 extra to install Paper Wall"))) (testing "Architect 1st sub should ignore additional install cost" (do-game - (new-game (default-corp [(qty "Architect" 3)]) - (default-runner ["Network Exchange"])) + (new-game {:corp {:deck [(qty "Architect" 3)]} + :runner {:deck ["Network Exchange"]}}) (play-from-hand state :corp "Architect" "HQ") (take-credits state :corp) ; corp has 7 credits (play-from-hand state :runner "Network Exchange") @@ -1549,8 +1518,8 @@ (deftest neutralize-all-threats ;; Neutralize All Threats - Access 2 cards from HQ, force trash first accessed card with a trash cost (do-game - (new-game (default-corp [(qty "Hedge Fund" 2) "Breaker Bay Grid" "Elizabeth Mills"]) - (default-runner ["Neutralize All Threats"])) + (new-game {:corp {:deck [(qty "Hedge Fund" 2) "Breaker Bay Grid" "Elizabeth Mills"]} + :runner {:deck ["Neutralize All Threats"]}}) (play-from-hand state :corp "Breaker Bay Grid" "New remote") (play-from-hand state :corp "Elizabeth Mills" "New remote") (take-credits state :corp) @@ -1571,8 +1540,8 @@ ;; New Angeles City Hall - Avoid tags; trash when agenda is stolen (testing "Basic test" (do-game - (new-game (default-corp ["SEA Source" "Breaking News"]) - (default-runner ["New Angeles City Hall"])) + (new-game {:corp {:deck ["SEA Source" "Breaking News"]} + :runner {:deck ["New Angeles City Hall"]}}) (play-from-hand state :corp "Breaking News" "New remote") (take-credits state :corp 2) (play-from-hand state :runner "New Angeles City Hall") @@ -1594,8 +1563,7 @@ (is (empty? (get-resource state)) "NACH trashed by agenda steal")))) (testing "don't gain Siphon credits until opportunity to avoid tags has passed" (do-game - (new-game (default-corp) - (default-runner ["Account Siphon" "New Angeles City Hall"])) + (new-game {:runner {:deck ["Account Siphon" "New Angeles City Hall"]}}) (take-credits state :corp) (play-from-hand state :runner "New Angeles City Hall") (play-run-event state (first (:hand (get-runner))) :hq) @@ -1612,8 +1580,8 @@ (deftest no-one-home ;; Prevent first tag or net damage of the turn if you beat trace0, then trash (do-game - (new-game (default-corp ["Data Mine" "SEA Source" "Scorched Earth"]) - (default-runner [(qty "No One Home" 3) (qty "Sure Gamble" 2)])) + (new-game {:corp {:deck ["Data Mine" "SEA Source" "Scorched Earth"]} + :runner {:deck [(qty "No One Home" 3) (qty "Sure Gamble" 2)]}}) (play-from-hand state :corp "Data Mine" "Server 1") (take-credits state :corp) (play-from-hand state :runner "Sure Gamble") @@ -1655,9 +1623,8 @@ ;; Off-Campus Apartment (testing "ability shows a simultaneous resolution prompt when appropriate" (do-game - (new-game (default-corp) - (default-runner ["Street Peddler" "Off-Campus Apartment" - "Underworld Contact" (qty "Spy Camera" 6)])) + (new-game {:runner {:deck ["Street Peddler" "Off-Campus Apartment" + "Underworld Contact" (qty "Spy Camera" 6)]}}) (take-credits state :corp) (starting-hand state :runner ["Street Peddler" "Off-Campus Apartment" "Underworld Contact"]) (play-from-hand state :runner "Off-Campus Apartment") @@ -1673,8 +1640,7 @@ (is (= 2 (count (:hand (get-runner)))) "Drew a card from OCA")))) (testing "second ability does not break cards that are hosting others, e.g., Street Peddler" (do-game - (new-game (default-corp) - (default-runner [(qty "Street Peddler" 2) "Off-Campus Apartment" (qty "Spy Camera" 6)])) + (new-game {:runner {:deck [(qty "Street Peddler" 2) "Off-Campus Apartment" (qty "Spy Camera" 6)]}}) (take-credits state :corp) (starting-hand state :runner ["Street Peddler" "Street Peddler" "Off-Campus Apartment"]) (core/move state :runner (find-card "Street Peddler" (:hand (get-runner))) :deck {:front true}) @@ -1697,36 +1663,36 @@ (deftest officer-frank ;; Officer Frank - meat damage to trash 2 from HQ (do-game - (new-game (default-corp ["Swordsman" (qty "Hedge Fund" 2)]) - (default-runner ["Officer Frank" "Skulljack" (qty "Respirocytes" 4)])) - (play-from-hand state :corp "Swordsman" "Archives") - (take-credits state :corp) - (starting-hand state :runner ["Officer Frank" "Skulljack" "Respirocytes" "Respirocytes" "Respirocytes" "Respirocytes"]) - (play-from-hand state :runner "Officer Frank") - (card-ability state :runner (get-resource state 0) 0) - (is (zero? (count (:discard (get-corp)))) "Nothing discarded from HQ") - (play-from-hand state :runner "Skulljack") - (is (= 3 (count (:hand (get-runner)))) "Took 1 brain damage") - (card-ability state :runner (get-resource state 0) 0) - (is (zero? (count (:discard (get-corp)))) "Nothing discarded from HQ") - (let [sm (get-ice state :archives 0)] - (run-on state :archives) - (core/rez state :corp sm) - (card-subroutine state :corp sm 0) - (run-jack-out state)) - (is (= 2 (count (:hand (get-runner)))) "Took 1 net damage") - (card-ability state :runner (get-resource state 0) 0) - (is (zero? (count (:discard (get-corp)))) "Nothing discarded from HQ") - (play-from-hand state :runner "Respirocytes") - (is (zero? (count (:hand (get-runner)))) "Took 1 meat damage") - (card-ability state :runner (get-resource state 0) 0) - (is (= 2 (count (:discard (get-corp)))) "Two cards trashed from HQ"))) + (new-game {:corp {:deck ["Swordsman" (qty "Hedge Fund" 2)]} + :runner {:deck ["Officer Frank" "Skulljack" (qty "Respirocytes" 4)]}}) + (play-from-hand state :corp "Swordsman" "Archives") + (take-credits state :corp) + (starting-hand state :runner ["Officer Frank" "Skulljack" "Respirocytes" "Respirocytes" "Respirocytes" "Respirocytes"]) + (play-from-hand state :runner "Officer Frank") + (card-ability state :runner (get-resource state 0) 0) + (is (zero? (count (:discard (get-corp)))) "Nothing discarded from HQ") + (play-from-hand state :runner "Skulljack") + (is (= 3 (count (:hand (get-runner)))) "Took 1 brain damage") + (card-ability state :runner (get-resource state 0) 0) + (is (zero? (count (:discard (get-corp)))) "Nothing discarded from HQ") + (let [sm (get-ice state :archives 0)] + (run-on state :archives) + (core/rez state :corp sm) + (card-subroutine state :corp sm 0) + (run-jack-out state)) + (is (= 2 (count (:hand (get-runner)))) "Took 1 net damage") + (card-ability state :runner (get-resource state 0) 0) + (is (zero? (count (:discard (get-corp)))) "Nothing discarded from HQ") + (play-from-hand state :runner "Respirocytes") + (is (zero? (count (:hand (get-runner)))) "Took 1 meat damage") + (card-ability state :runner (get-resource state 0) 0) + (is (= 2 (count (:discard (get-corp)))) "Two cards trashed from HQ"))) (deftest pad-tap ;; PAD Tap (do-game - (new-game (default-corp ["Melange Mining Corp."]) - (default-runner ["PAD Tap"])) + (new-game {:corp {:deck ["Melange Mining Corp."]} + :runner {:deck ["PAD Tap"]}}) (play-from-hand state :corp "Melange Mining Corp." "New remote") (take-credits state :corp) (play-from-hand state :runner "PAD Tap") @@ -1757,9 +1723,8 @@ ;; Paige Piper (testing "interaction with Frantic Coding. Issue #2190" (do-game - (new-game (default-corp) - (default-runner ["Paige Piper" (qty "Frantic Coding" 2) (qty "Sure Gamble" 3) - (qty "Gordian Blade" 2) "Ninja" (qty "Bank Job" 3) (qty "Indexing" 2)])) + (new-game {:runner {:deck ["Paige Piper" (qty "Frantic Coding" 2) (qty "Sure Gamble" 3) + (qty "Gordian Blade" 2) "Ninja" (qty "Bank Job" 3) (qty "Indexing" 2)]}}) (take-credits state :corp) (starting-hand state :runner ["Paige Piper" "Frantic Coding" "Frantic Coding"]) (play-from-hand state :runner "Paige Piper") @@ -1786,8 +1751,8 @@ ;; Patron (testing "Basic test" (do-game - (new-game (default-corp ["Jackson Howard"]) - (default-runner [(qty "Patron" 4) (qty "Easy Mark" 4)])) + (new-game {:corp {:deck ["Jackson Howard"]} + :runner {:deck [(qty "Patron" 4) (qty "Easy Mark" 4)]}}) (play-from-hand state :corp "Jackson Howard" "New remote") (take-credits state :corp 2) (play-from-hand state :runner "Patron") @@ -1809,8 +1774,7 @@ (is (= 5 (count (:hand (get-runner)))) "Did not draw cards when running other server")))) (testing "Manually selecting during Step 1.2 does not show a second prompt at start of turn. Issue #1744." (do-game - (new-game (default-corp) - (default-runner [(qty "Patron" 3) (qty "Jak Sinclair" 3)])) + (new-game {:runner {:deck [(qty "Patron" 3) (qty "Jak Sinclair" 3)]}}) (take-credits state :corp) (core/gain state :runner :credit 10) (starting-hand state :runner ["Patron" "Jak Sinclair"]) @@ -1832,8 +1796,8 @@ (deftest power-tap ;; Power Tap (do-game - (new-game (default-corp ["Restructured Datapool"]) - (default-runner ["Power Tap"])) + (new-game {:corp {:deck ["Restructured Datapool"]} + :runner {:deck ["Power Tap"]}}) (play-and-score state "Restructured Datapool") (let [agenda (get-scored state :corp 0) tags (count-tags state) @@ -1858,10 +1822,9 @@ (deftest professional-contacts ;; Professional Contacts - Click to gain 1 credit and draw 1 card (do-game - (new-game (default-corp) - (default-runner [(qty "Professional Contacts" 3) + (new-game {:runner {:deck [(qty "Professional Contacts" 3) (qty "Sure Gamble" 2) - (qty "Shiv" 2)])) + (qty "Shiv" 2)]}}) (take-credits state :corp) (play-from-hand state :runner "Professional Contacts") (let [proco (get-resource state 0)] @@ -1878,8 +1841,8 @@ ;; Psych Mike (testing "Basic test" (do-game - (new-game (default-corp [(qty "Ice Wall" 100)]) - (default-runner ["Psych Mike" "Deep Data Mining"])) + (new-game {:corp {:deck [(qty "Ice Wall" 100)]} + :runner {:deck ["Psych Mike" "Deep Data Mining"]}}) (take-credits state :corp) (play-from-hand state :runner "Psych Mike") (let [credits (:credit (get-runner))] @@ -1913,8 +1876,8 @@ "Psych Mike should give 1 credit for second run of the turn, if first on HQ"))))) (testing "vs upgrades" (do-game - (new-game (default-corp ["Bryan Stinson" (qty "Ice Wall" 100)]) - (default-runner ["Psych Mike"])) + (new-game {:corp {:deck ["Bryan Stinson" (qty "Ice Wall" 100)]} + :runner {:deck ["Psych Mike"]}}) (starting-hand state :corp ["Bryan Stinson"]) (play-from-hand state :corp "Bryan Stinson" "R&D") (take-credits state :corp) @@ -1931,8 +1894,7 @@ ;; Reclaim - trash Reclaim, trash card from grip, install program, hardware, or virtual resource from heap (testing "Basic behavior" (do-game - (new-game (default-corp) - (default-runner ["Reclaim" "Mimic" "Clone Chip"])) + (new-game {:runner {:deck ["Reclaim" "Mimic" "Clone Chip"]}}) (take-credits state :corp) (core/move state :runner (find-card "Mimic" (:hand (get-runner))) :discard) (play-from-hand state :runner "Reclaim") @@ -1945,16 +1907,14 @@ (is (= 2 (:credit (get-runner))) "Runner paid install cost"))) (testing "No cards in hand" (do-game - (new-game (default-corp) - (default-runner ["Reclaim"])) + (new-game {:runner {:deck ["Reclaim"]}}) (take-credits state :corp) (play-from-hand state :runner "Reclaim") (card-ability state :runner (get-resource state 0) 0) (is (empty? (:prompt (get-runner))) "No Reclaim prompt"))) (testing "Can install trashed card" (do-game - (new-game (default-corp) - (default-runner ["Reclaim" "Mimic"])) + (new-game {:runner {:deck ["Reclaim" "Mimic"]}}) (take-credits state :corp) (play-from-hand state :runner "Reclaim") (is (empty? (get-program state)) "No programs installed") @@ -1966,8 +1926,7 @@ (is (= 2 (:credit (get-runner))) "Runner paid install cost"))) (testing "Can't afford to install card" (do-game - (new-game (default-corp) - (default-runner ["Reclaim" "Alpha"])) + (new-game {:runner {:deck ["Reclaim" "Alpha"]}}) (take-credits state :corp) (play-from-hand state :runner "Reclaim") (card-ability state :runner (get-resource state 0) 0) @@ -1981,9 +1940,8 @@ (deftest rolodex ;; Rolodex - Full test (do-game - (new-game (default-corp) - (default-runner ["Rolodex" "Sure Gamble" "Desperado" - "Diesel" "Corroder" "Patron"])) + (new-game {:runner {:deck ["Rolodex" "Sure Gamble" "Desperado" + "Diesel" "Corroder" "Patron"]}}) (starting-hand state :runner ["Rolodex"]) (is (= 1 (count (:hand (get-runner))))) (take-credits state :corp) @@ -2012,11 +1970,10 @@ (is (= 4 (count (:discard (get-runner)))) "Rolodex mills 3 cards when trashed") (is (= "Corroder" (:title (first (:deck (get-runner)))))))) -(deftest rosetta-2.0 +(deftest rosetta-2-0 ;; Rosetta 2.0 remove an installed program from the game and install one from the heap lower install cost (do-game - (new-game (default-corp) - (default-runner ["Rosetta 2.0" "Corroder" "Gordian Blade"])) + (new-game {:runner {:deck ["Rosetta 2.0" "Corroder" "Gordian Blade"]}}) (take-credits state :corp) (starting-hand state :runner ["Rosetta 2.0" "Corroder"]) (core/gain state :runner :credit 2) @@ -2036,9 +1993,8 @@ (deftest sacrificial-construct ;; Sacrificial Construct - Trash to prevent trash of installed program or hardware (do-game - (new-game (default-corp) - (default-runner [(qty "Sacrificial Construct" 2) "Cache" - "Motivation" "Astrolabe"])) + (new-game {:runner {:deck [(qty "Sacrificial Construct" 2) "Cache" + "Motivation" "Astrolabe"]}}) (take-credits state :corp) (core/gain state :runner :click 1) (play-from-hand state :runner "Sacrificial Construct") @@ -2061,8 +2017,7 @@ (deftest safety-first ;; Safety First - Reduce hand size by 2, draw 1 at turn end if below maximum (do-game - (new-game (default-corp) - (default-runner [(qty "Safety First" 3) (qty "Cache" 3)])) + (new-game {:runner {:deck [(qty "Safety First" 3) (qty "Cache" 3)]}}) (take-credits state :corp) (starting-hand state :runner ["Safety First" "Safety First" "Cache"]) (play-from-hand state :runner "Safety First") @@ -2073,61 +2028,12 @@ (take-credits state :runner) (is (= 3 (count (:hand (get-runner)))) "Drew no cards, at maximum"))) -(deftest scrubber - ;; Scrubber - (testing "Basic test" - (do-game - (new-game (default-corp ["The Board"]) - (default-runner ["Scrubber"])) - (play-from-hand state :corp "The Board" "New remote") - (take-credits state :corp) - (run-empty-server state "Server 1") - (is (= 1 (-> (get-runner) :prompt first :choices count)) "Runner doesn't have enough credits to trash") - (click-prompt state :runner "No action") - (play-from-hand state :runner "Scrubber") - (take-credits state :runner) - (take-credits state :corp) - (is (= 5 (:credit (get-runner))) "Runner should only have 5 credits in pool") - (run-empty-server state "Server 1") - (is (= 2 (-> (get-runner) :prompt first :choices count)) "Runner can use Scrubber credits to trash") - (let [scrubber (get-resource state 0)] - (card-ability state :runner scrubber 0) - (card-ability state :runner scrubber 0)) - (click-prompt state :runner "Pay 7 [Credits] to trash") - (is (= 2 (:agenda-point (get-runner))) "Runner should trash The Board and gain 2 agenda points"))) - (testing "when under trash cost but can up with recurring credits" - (do-game - (new-game (default-corp ["The Board"]) - (default-runner ["Scrubber" "Skulljack" "Sure Gamble"])) - (play-from-hand state :corp "The Board" "New remote") - (take-credits state :corp) - (run-empty-server state "Server 1") - (is (= 1 (-> (get-runner) :prompt first :choices count)) "Runner doesn't have enough credits to trash") - (click-prompt state :runner "No action") - (play-from-hand state :runner "Scrubber") - (take-credits state :runner) - (take-credits state :corp) - (play-from-hand state :runner "Skulljack") - (core/gain state :runner :credit 1) - (is (= 4 (:credit (get-runner))) "Runner should only have 4 credits in pool") - (run-empty-server state "Server 1") - (is (= 6 (core/trash-cost state :runner (get-content state :remote1 0))) "The Board should cost 6 to trash") - (is (= 2 (-> (get-runner) :prompt first :choices count)) "Runner can use Scrubber credits to trash") - (click-prompt state :runner "Pay 6 [Credits] to trash") ;; Whoops, runner forgot to actually get the credits from Scrubber - (is (= 6 (core/trash-cost state :runner (get-content state :remote1 0))) "Skulljack shouldn't trigger a second time") - (is (= 2 (-> (get-runner) :prompt first :choices count)) "Runner can still use Scrubber credits the second time around") - (let [scrubber (get-resource state 0)] - (card-ability state :runner scrubber 0) - (card-ability state :runner scrubber 0)) - (click-prompt state :runner "Pay 6 [Credits] to trash") ;; Now the runner has actually gained the Scrubber credits - (is (= 2 (:agenda-point (get-runner))) "Runner should trash The Board and gain 2 agenda points")))) - (deftest salsette-slums ;; Salsette Slums - Once per turn, when the trash cost of a card is paid, optionally remove from the game (do-game - (new-game (default-corp ["Hostile Infrastructure" "Tech Startup" "Thomas Haas" - (qty "Hedge Fund" 3)]) - (default-runner [(qty "Salsette Slums" 2) (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck ["Hostile Infrastructure" "Tech Startup" "Thomas Haas" + (qty "Hedge Fund" 3)]} + :runner {:deck [(qty "Salsette Slums" 2) (qty "Sure Gamble" 3)]}}) ;; Use Hostile Infrastructure to ensure on-trash effects don't fire. (core/move state :corp (find-card "Hostile Infrastructure" (:deck (get-corp))) :hand) (core/move state :corp (find-card "Tech Startup" (:deck (get-corp))) :hand) @@ -2189,12 +2095,61 @@ (click-card state :runner (find-card "Hostile Infrastructure" (:discard (get-corp)))) (is (not (= (:cid hostile2) (:cid (last (:rfg (get-corp)))))) "Did not remove card from game")))) +(deftest scrubber + ;; Scrubber + (testing "Basic test" + (do-game + (new-game {:corp {:deck ["The Board"]} + :runner {:deck ["Scrubber"]}}) + (play-from-hand state :corp "The Board" "New remote") + (take-credits state :corp) + (run-empty-server state "Server 1") + (is (= 1 (-> (get-runner) :prompt first :choices count)) "Runner doesn't have enough credits to trash") + (click-prompt state :runner "No action") + (play-from-hand state :runner "Scrubber") + (take-credits state :runner) + (take-credits state :corp) + (is (= 5 (:credit (get-runner))) "Runner should only have 5 credits in pool") + (run-empty-server state "Server 1") + (is (= 2 (-> (get-runner) :prompt first :choices count)) "Runner can use Scrubber credits to trash") + (let [scrubber (get-resource state 0)] + (card-ability state :runner scrubber 0) + (card-ability state :runner scrubber 0)) + (click-prompt state :runner "Pay 7 [Credits] to trash") + (is (= 2 (:agenda-point (get-runner))) "Runner should trash The Board and gain 2 agenda points"))) + (testing "when under trash cost but can up with recurring credits" + (do-game + (new-game {:corp {:deck ["The Board"]} + :runner {:deck ["Scrubber" "Skulljack" "Sure Gamble"]}}) + (play-from-hand state :corp "The Board" "New remote") + (take-credits state :corp) + (run-empty-server state "Server 1") + (is (= 1 (-> (get-runner) :prompt first :choices count)) "Runner doesn't have enough credits to trash") + (click-prompt state :runner "No action") + (play-from-hand state :runner "Scrubber") + (take-credits state :runner) + (take-credits state :corp) + (play-from-hand state :runner "Skulljack") + (core/gain state :runner :credit 1) + (is (= 4 (:credit (get-runner))) "Runner should only have 4 credits in pool") + (run-empty-server state "Server 1") + (is (= 6 (core/trash-cost state :runner (get-content state :remote1 0))) "The Board should cost 6 to trash") + (is (= 2 (-> (get-runner) :prompt first :choices count)) "Runner can use Scrubber credits to trash") + (click-prompt state :runner "Pay 6 [Credits] to trash") ;; Whoops, runner forgot to actually get the credits from Scrubber + (is (= 6 (core/trash-cost state :runner (get-content state :remote1 0))) "Skulljack shouldn't trigger a second time") + (is (= 2 (-> (get-runner) :prompt first :choices count)) "Runner can still use Scrubber credits the second time around") + (let [scrubber (get-resource state 0)] + (card-ability state :runner scrubber 0) + (card-ability state :runner scrubber 0)) + (click-prompt state :runner "Pay 6 [Credits] to trash") ;; Now the runner has actually gained the Scrubber credits + (is (= 2 (:agenda-point (get-runner))) "Runner should trash The Board and gain 2 agenda points")))) + (deftest security-testing ;; Security Testing (testing "Basic test" (do-game - (new-game (default-corp ["Jackson Howard"]) - (default-runner ["Security Testing"])) + (new-game {:corp {:deck ["Jackson Howard"]} + :runner {:deck ["Security Testing"]}}) (play-from-hand state :corp "Jackson Howard" "New remote") (take-credits state :corp 2) (play-from-hand state :runner "Security Testing") @@ -2214,8 +2169,7 @@ (is (= 12 (:credit (get-runner))) "Did not gain credits when running other server")))) (testing "with multiple copies" (do-game - (new-game (default-corp) - (default-runner [(qty "Security Testing" 2)])) + (new-game {:runner {:deck [(qty "Security Testing" 2)]}}) (take-credits state :corp) (play-from-hand state :runner "Security Testing") (play-from-hand state :runner "Security Testing") @@ -2231,8 +2185,8 @@ (deftest spoilers ;; Spoilers - Mill the Corp when it scores an agenda (do-game - (new-game (default-corp ["Hostile Takeover" "Hedge Fund"]) - (default-runner ["Spoilers"])) + (new-game {:corp {:deck ["Hostile Takeover" "Hedge Fund"]} + :runner {:deck ["Spoilers"]}}) (take-credits state :corp) (play-from-hand state :runner "Spoilers") (take-credits state :runner) @@ -2247,8 +2201,7 @@ (deftest stim-dealer ;; Stim Dealer - Take 1 brain damage when it accumulates 2 power counters (do-game - (new-game (default-corp) - (default-runner ["Stim Dealer" "Sure Gamble" "Feedback Filter"])) + (new-game {:runner {:deck ["Stim Dealer" "Sure Gamble" "Feedback Filter"]}}) (take-credits state :corp) (play-from-hand state :runner "Sure Gamble") (play-from-hand state :runner "Feedback Filter") @@ -2273,9 +2226,8 @@ ;; Street Peddler (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner ["Street Peddler" "Gordian Blade" - "Torch" (qty "Sure Gamble" 2)])) + (new-game {:runner {:deck ["Street Peddler" "Gordian Blade" + "Torch" (qty "Sure Gamble" 2)]}}) (take-credits state :corp) (starting-hand state :runner ["Street Peddler" "Sure Gamble"]) (play-from-hand state :runner "Street Peddler") @@ -2288,8 +2240,7 @@ (is (= 3 (core/available-mu state)) "Gordian cost 1 mu")))) (testing "Can't afford install" (do-game - (new-game (default-corp) - (default-runner ["Street Peddler" (qty "Gordian Blade" 3)])) + (new-game {:runner {:deck ["Street Peddler" (qty "Gordian Blade" 3)]}}) (take-credits state :corp) (starting-hand state :runner ["Street Peddler"]) (play-from-hand state :runner "Street Peddler") @@ -2305,10 +2256,10 @@ "Street Peddler still installed with 3 hosted cards"))))) (testing "Interaction with Kate discount" (do-game - (new-game (default-corp) - (make-deck "Kate \"Mac\" McCaffrey: Digital Tinker" ["Street Peddler" - "Gordian Blade" - (qty "Sure Gamble" 2)])) + (new-game {:runner {:id "Kate \"Mac\" McCaffrey: Digital Tinker" + :deck ["Street Peddler" + "Gordian Blade" + (qty "Sure Gamble" 2)]}}) (take-credits state :corp) (starting-hand state :runner ["Street Peddler"]) (play-from-hand state :runner "Street Peddler") @@ -2324,8 +2275,7 @@ (is (= 3 (core/available-mu state)) "Gordian cost 1 mu")))) (testing "Programs should cost memory. Issue #708" (do-game - (new-game (default-corp) - (default-runner ["Street Peddler" (qty "Corroder" 3)])) + (new-game {:runner {:deck ["Street Peddler" (qty "Corroder" 3)]}}) (take-credits state :corp) (starting-hand state :runner ["Street Peddler"]) (play-from-hand state :runner "Street Peddler") @@ -2339,8 +2289,8 @@ (is (= 3 (core/available-mu state)) "Corroder cost 1 mu")))) (testing "Muertos/Brain Chip uninstall effect not fired when removed off peddler/hosting Issue #2294, #2358" (do-game - (new-game (default-corp ["Jackson Howard"]) - (default-runner [(qty "Street Peddler" 2) "Muertos Gang Member" "Brain Chip"])) + (new-game {:corp {:deck ["Jackson Howard"]} + :runner {:deck [(qty "Street Peddler" 2) "Muertos Gang Member" "Brain Chip"]}}) (core/move state :runner (find-card "Muertos Gang Member" (:hand (get-runner))) :deck {:front true}) (core/move state :runner (find-card "Brain Chip" (:hand (get-runner))) :deck {:front true}) (core/move state :runner (find-card "Street Peddler" (:hand (get-runner))) :deck {:front true}) @@ -2357,8 +2307,7 @@ (is (= 4 (core/available-mu state)) "Runner has 4 MU")))) (testing "Trashing hardware should not reduce :in-play values" (do-game - (new-game (default-corp) - (default-runner ["Street Peddler" (qty "HQ Interface" 3)])) + (new-game {:runner {:deck ["Street Peddler" (qty "HQ Interface" 3)]}}) (take-credits state :corp) (starting-hand state :runner ["Street Peddler"]) (play-from-hand state :runner "Street Peddler") @@ -2369,8 +2318,8 @@ "HQ Access increased by 1 from installed HQI and not reduced by the 2 trashed ones")))) (testing "Installing Parasite with only 1cr. Issue #491." (do-game - (new-game (default-corp [(qty "Pop-up Window" 3)]) - (default-runner ["Street Peddler" (qty "Parasite" 3)])) + (new-game {:corp {:deck [(qty "Pop-up Window" 3)]} + :runner {:deck ["Street Peddler" (qty "Parasite" 3)]}}) (play-from-hand state :corp "Pop-up Window" "HQ") (take-credits state :corp 2) (starting-hand state :runner ["Street Peddler"]) @@ -2387,31 +2336,28 @@ (click-card state :runner pu) (is (= 4 (count (:discard (get-runner)))) "3 Parasite, 1 Street Peddler in heap") (is (= 1 (count (:discard (get-corp)))) "Pop-up Window in archives")))) - (testing "Tech Trader install" - (do-game - (new-game (default-corp) - (default-runner ["Street Peddler" - "Tech Trader"])) - (take-credits state :corp) - (starting-hand state :runner ["Street Peddler"]) - (play-from-hand state :runner "Street Peddler") - (let [sp (get-resource state 0)] - (is (= 1 (count (:hosted sp))) "Street Peddler is hosting 1 card") - (card-ability state :runner sp 0) - (click-prompt state :runner (find-card "Tech Trader" (:hosted sp))) ; choose to install Tech Trader - (is (= "Tech Trader" (:title (get-resource state 0))) - "Tech Trader was installed") - (is (= 5 (:credit (get-runner))) "Did not gain 1cr from Tech Trader ability"))))) - +(testing "Tech Trader install" + (do-game + (new-game {:runner {:deck ["Street Peddler" + "Tech Trader"]}}) + (take-credits state :corp) + (starting-hand state :runner ["Street Peddler"]) + (play-from-hand state :runner "Street Peddler") + (let [sp (get-resource state 0)] + (is (= 1 (count (:hosted sp))) "Street Peddler is hosting 1 card") + (card-ability state :runner sp 0) + (click-prompt state :runner (find-card "Tech Trader" (:hosted sp))) ; choose to install Tech Trader + (is (= "Tech Trader" (:title (get-resource state 0))) + "Tech Trader was installed") + (is (= 5 (:credit (get-runner))) "Did not gain 1cr from Tech Trader ability"))))) (deftest-pending street-peddler-trash-while-choosing-card ;; Street Peddler - trashing Street Peddler while choosing which card to ;; discard should dismiss the choice prompt. Issue #587. (do-game - (new-game (default-corp) - (default-runner ["Street Peddler" + (new-game {:runner {:deck ["Street Peddler" "Gordian Blade" "Torch" - (qty "Sure Gamble" 2)])) + (qty "Sure Gamble" 2)]}}) (take-credits state :corp) (starting-hand state :runner ["Street Peddler" "Sure Gamble"]) (play-from-hand state :runner "Street Peddler") @@ -2425,10 +2371,9 @@ ;; Symmetrical Visage - Gain 1 credit the first time you click to draw each turn (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner [(qty "Symmetrical Visage" 3) + (new-game {:runner {:deck [(qty "Symmetrical Visage" 3) (qty "Sure Gamble" 3) - "Fall Guy"])) + "Fall Guy"]}}) (take-credits state :corp) (play-from-hand state :runner "Symmetrical Visage") (is (= 3 (:credit (get-runner)))) @@ -2438,10 +2383,9 @@ (is (= 4 (:credit (get-runner))) "No credit gained from second click spent to draw"))) (testing "Gain 1 credit the first and second time you click to draw each turn when GCS is installed" (do-game - (new-game (default-corp) - (default-runner [(qty "Symmetrical Visage" 3) + (new-game {:runner {:deck [(qty "Symmetrical Visage" 3) (qty "Gene Conditioning Shoppe" 3) - "Fall Guy"])) + "Fall Guy"]}}) (take-credits state :corp) (core/gain state :runner :click 1) (play-from-hand state :runner "Symmetrical Visage") @@ -2463,10 +2407,10 @@ ;; Synthetic Blood - The first time you take damage each turn, draw one card (testing "Basic test" (do-game - (new-game (default-corp [(qty "Data Mine" 3) (qty "Hedge Fund" 3)]) - (default-runner [(qty "Synthetic Blood" 3) + (new-game {:corp {:deck [(qty "Data Mine" 3) (qty "Hedge Fund" 3)]} + :runner {:deck [(qty "Synthetic Blood" 3) (qty "Sure Gamble" 3) - "Fall Guy"])) + "Fall Guy"]}}) (play-from-hand state :corp "Data Mine" "HQ") (play-from-hand state :corp "Data Mine" "HQ") (take-credits state :corp) @@ -2483,10 +2427,10 @@ (is (= 3 (count (:hand (get-runner)))) "no card drawn when receiving damage (2nd time)")))) (testing "The first and second time you take damage each turn (with GCS installed), draw one card" (do-game - (new-game (default-corp [(qty "Data Mine" 3) (qty "Hedge Fund" 3)]) - (default-runner [(qty "Synthetic Blood" 3) + (new-game {:corp {:deck [(qty "Data Mine" 3) (qty "Hedge Fund" 3)]} + :runner {:deck [(qty "Synthetic Blood" 3) "Sure Gamble" - (qty "Gene Conditioning Shoppe" 3)])) + (qty "Gene Conditioning Shoppe" 3)]}}) (play-from-hand state :corp "Data Mine" "HQ") (play-from-hand state :corp "Data Mine" "HQ") (take-credits state :corp) @@ -2503,12 +2447,23 @@ (card-subroutine state :corp second-dm 0) (is (= 3 (count (:hand (get-runner)))) "1 card drawn when receiving damage (2nd time)"))))) +(deftest tech-trader + ;; Basic test + (do-game + (new-game {:runner {:deck ["Tech Trader" "Fall Guy"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Tech Trader") + (play-from-hand state :runner "Fall Guy") + (is (= 4 (:credit (get-runner)))) + (let [fall (get-resource state 1)] + (card-ability state :runner fall 1) + (is (= 7 (:credit (get-runner))))))) + (deftest technical-writer ;; Technical Writer - Gain 1c per program/hardware install; click/trash to take all credits (do-game - (new-game (default-corp) - (default-runner ["Technical Writer" (qty "Faerie" 2) - "Vigil" "Same Old Thing"])) + (new-game {:runner {:deck ["Technical Writer" (qty "Faerie" 2) + "Vigil" "Same Old Thing"]}}) (take-credits state :corp) (core/gain state :runner :click 2) (play-from-hand state :runner "Technical Writer") @@ -2526,11 +2481,89 @@ (is (zero? (:click (get-runner))) "Spent 1 click") (is (= 1 (count (:discard (get-runner)))) "Technical Writer trashed")))) +(deftest temujin-contract + ;; Temüjin Contract + (testing "Multiple times in one turn. Issue #1952" + (do-game + (new-game {:runner {:id "Silhouette: Stealth Operative" + :deck ["Temüjin Contract"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Temüjin Contract") + (click-prompt state :runner "Archives") + (run-empty-server state "Archives") + (is (= 5 (:credit (get-runner))) "Gained 4cr") + (run-empty-server state "Archives") + (is (= 9 (:credit (get-runner))) "Gained 4cr") + (is (= 12 (get-counters (get-resource state 0) :credit)) "Temjin has 12 credits remaining")))) + +(deftest the-archivist + ;; The Archivist + (do-game + (new-game {:corp {:deck ["Global Food Initiative" "Private Security Force"]} + :runner {:deck ["The Archivist"]}}) + (take-credits state :corp) + (play-from-hand state :runner "The Archivist") + (is (zero? (:bad-publicity (get-corp))) "Corp should start with 0 bad publicity") + (take-credits state :runner) + (play-and-score state "Global Food Initiative") + (click-prompt state :corp "0") + (click-prompt state :runner "0") + (is (= 1 (:bad-publicity (get-corp))) "Corp should get 1 bad publicity from The Archivist") + (play-and-score state "Private Security Force") + (click-prompt state :corp "0") + (click-prompt state :runner "0") + (is (= 2 (:bad-publicity (get-corp))) "Corp should get 1 bad publicity from The Archivist"))) + +(deftest the-black-file + ;; The Black File - Prevent Corp from winning by agenda points + (testing "Basic test" + (do-game + (new-game {:corp {:deck [(qty "Vanity Project" 3) (qty "Sure Gamble" 3)]} + :runner {:deck ["The Black File"]}}) + (starting-hand state :corp ["Vanity Project"]) + (core/gain state :corp :agenda-point 3) + (take-credits state :corp) + (play-from-hand state :runner "The Black File") + (take-credits state :runner) + (play-from-hand state :corp "Vanity Project" "New remote") + (score-agenda state :corp (get-content state :remote1 0)) + (is (= 7 (:agenda-point (get-corp)))) + (is (not (:winner @state)) "No registered Corp win") + (take-credits state :corp) + (let [bf (get-resource state 0)] + (is (= 1 (get-counters (refresh bf) :power)) "1 power counter on The Black File") + (take-credits state :runner) + (take-credits state :corp) + (is (= 2 (get-counters (refresh bf) :power)) "2 power counters on The Black File") + (take-credits state :runner) + (take-credits state :corp) + (is (= 1 (count (:rfg (get-runner)))) "The Black File removed from the game") + (is (= :corp (:winner @state)) "Corp wins") + (is (= "Agenda" (:reason @state)) "Win condition reports agendas")))) + (testing "Corp can still win by flatlining Runner" + (do-game + (new-game {:corp {:deck [(qty "Vanity Project" 3) (qty "Scorched Earth" 3)]} + :runner {:deck ["The Black File"]}}) + (starting-hand state :corp ["Vanity Project" "Scorched Earth"]) + (core/gain state :corp :agenda-point 3) + (take-credits state :corp) + (play-from-hand state :runner "The Black File") + (take-credits state :runner) + (play-from-hand state :corp "Vanity Project" "New remote") + (score-agenda state :corp (get-content state :remote1 0)) + (is (= 7 (:agenda-point (get-corp)))) + (is (not (:winner @state)) "No registered Corp win") + (take-credits state :corp) + (take-credits state :runner) + (core/gain state :runner :tag 1) + (play-from-hand state :corp "Scorched Earth") + (is (= :corp (:winner @state)) "Corp wins") + (is (= "Flatline" (:reason @state)) "Win condition reports flatline")))) + (deftest the-helpful-ai ;; The Helpful AI - +1 link; trash to give an icebreaker +2 str until end of turn (do-game - (new-game (default-corp) - (default-runner ["The Helpful AI" "Corroder"])) + (new-game {:runner {:deck ["The Helpful AI" "Corroder"]}}) (take-credits state :corp) (play-from-hand state :runner "The Helpful AI") (is (= 1 (:link (get-runner))) "Gained 1 link") @@ -2547,8 +2580,8 @@ (deftest the-source ;; The Source - Increase advancement requirement of agendas by 1; 3c additional cost to steal (do-game - (new-game (default-corp [(qty "Hostile Takeover" 2)]) - (default-runner [(qty "The Source" 2) (qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Hostile Takeover" 2)]} + :runner {:deck [(qty "The Source" 2) (qty "Sure Gamble" 3)]}}) (play-from-hand state :corp "Hostile Takeover" "New remote") (take-credits state :corp) (play-from-hand state :runner "Sure Gamble") @@ -2575,11 +2608,10 @@ ;; The Supplier (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner ["The Supplier" + (new-game {:runner {:deck ["The Supplier" "Plascrete Carapace" "Utopia Shard" - "Hedge Fund"])) + "Hedge Fund"]}}) (take-credits state :corp) (play-from-hand state :runner "The Supplier") (let [ts (get-resource state 0)] @@ -2600,12 +2632,11 @@ (is (= 1 (count (:hosted (refresh ts)))) "One card still on The Supplier")))) (testing "Interaction with Kate discount. Issue #578." (do-game - (new-game (default-corp) - (make-deck "Kate \"Mac\" McCaffrey: Digital Tinker" - ["The Supplier" - "Plascrete Carapace" - "Kati Jones" - "Hedge Fund"])) + (new-game {:runner {:id "Kate \"Mac\" McCaffrey: Digital Tinker" + :deck ["The Supplier" + "Plascrete Carapace" + "Kati Jones" + "Hedge Fund"]}}) (take-credits state :corp) (play-from-hand state :runner "The Supplier") (let [ts (get-resource state 0)] @@ -2619,9 +2650,9 @@ (is (= 1 (count (get-resource state))) "Plascrete installed")))) (testing "Brain chip mem is deducted when it is hosted and Supplier is trashed. Issue #2358" (do-game - (new-game (default-corp [(qty "Hostile Takeover" 2)]) - (default-runner ["The Supplier" - "Brain Chip"])) + (new-game {:corp {:deck [(qty "Hostile Takeover" 2)]} + :runner {:deck ["The Supplier" + "Brain Chip"]}}) (play-from-hand state :corp "Hostile Takeover" "New remote") (take-credits state :corp) (is (= 4 (core/available-mu state)) "Runner has 4 MU") @@ -2639,127 +2670,12 @@ (is (= 2 (count (:discard (get-runner))))) (is (= 4 (core/available-mu state)) "Runner has 4 MU"))))) -(deftest thunder-art-gallery - ;; Thunder Art Gallery - (testing "Works when removing/avoiding tags" - (do-game - (new-game (default-corp) - (default-runner ["Thunder Art Gallery" "New Angeles City Hall" "Corroder"])) - (take-credits state :corp) - (play-from-hand state :runner "Thunder Art Gallery") - (core/gain-credits state :runner 1) - (core/gain-tags state :corp 1) - (core/remove-tag state :runner nil) - (click-card state :runner "New Angeles City Hall") - (is (= 1 (:credit (get-runner))) "Runner paid one less to install (but 2 to remove tag)") - (is (= "New Angeles City Hall" (:title (get-resource state 1))) "NACH is installed") - (take-credits state :runner) - (is (= 3 (:credit (get-runner))) "Runner is now at 3 credits") - (core/gain-tags state :corp 1) - (card-ability state :runner (get-resource state 1) 0) - (click-prompt state :runner "Done") - (click-card state :runner "Corroder") - (is (= 0 (:credit (get-runner))) "Runner paid one less to install") - (is (= "Corroder" (:title (get-program state 0))) "Corroder is installed")))) - -(deftest tech-trader - ;; Basic test - (do-game - (new-game (default-corp) - (default-runner ["Tech Trader" "Fall Guy"])) - (take-credits state :corp) - (play-from-hand state :runner "Tech Trader") - (play-from-hand state :runner "Fall Guy") - (is (= 4 (:credit (get-runner)))) - (let [fall (get-resource state 1)] - (card-ability state :runner fall 1) - (is (= 7 (:credit (get-runner))))))) - -(deftest the-archivist - ;; The Archivist - (do-game - (new-game (default-corp ["Global Food Initiative" "Private Security Force"]) - (default-runner ["The Archivist"])) - (take-credits state :corp) - (play-from-hand state :runner "The Archivist") - (is (zero? (:bad-publicity (get-corp))) "Corp should start with 0 bad publicity") - (take-credits state :runner) - (play-and-score state "Global Food Initiative") - (click-prompt state :corp "0") - (click-prompt state :runner "0") - (is (= 1 (:bad-publicity (get-corp))) "Corp should get 1 bad publicity from The Archivist") - (play-and-score state "Private Security Force") - (click-prompt state :corp "0") - (click-prompt state :runner "0") - (is (= 2 (:bad-publicity (get-corp))) "Corp should get 1 bad publicity from The Archivist"))) - -(deftest the-black-file - ;; The Black File - Prevent Corp from winning by agenda points - (testing "Basic test" - (do-game - (new-game (default-corp [(qty "Vanity Project" 3) (qty "Sure Gamble" 3)]) - (default-runner ["The Black File"])) - (starting-hand state :corp ["Vanity Project"]) - (core/gain state :corp :agenda-point 3) - (take-credits state :corp) - (play-from-hand state :runner "The Black File") - (take-credits state :runner) - (play-from-hand state :corp "Vanity Project" "New remote") - (score-agenda state :corp (get-content state :remote1 0)) - (is (= 7 (:agenda-point (get-corp)))) - (is (not (:winner @state)) "No registered Corp win") - (take-credits state :corp) - (let [bf (get-resource state 0)] - (is (= 1 (get-counters (refresh bf) :power)) "1 power counter on The Black File") - (take-credits state :runner) - (take-credits state :corp) - (is (= 2 (get-counters (refresh bf) :power)) "2 power counters on The Black File") - (take-credits state :runner) - (take-credits state :corp) - (is (= 1 (count (:rfg (get-runner)))) "The Black File removed from the game") - (is (= :corp (:winner @state)) "Corp wins") - (is (= "Agenda" (:reason @state)) "Win condition reports agendas")))) - (testing "Corp can still win by flatlining Runner" - (do-game - (new-game (default-corp [(qty "Vanity Project" 3) (qty "Scorched Earth" 3)]) - (default-runner ["The Black File"])) - (starting-hand state :corp ["Vanity Project" "Scorched Earth"]) - (core/gain state :corp :agenda-point 3) - (take-credits state :corp) - (play-from-hand state :runner "The Black File") - (take-credits state :runner) - (play-from-hand state :corp "Vanity Project" "New remote") - (score-agenda state :corp (get-content state :remote1 0)) - (is (= 7 (:agenda-point (get-corp)))) - (is (not (:winner @state)) "No registered Corp win") - (take-credits state :corp) - (take-credits state :runner) - (core/gain-tags state :runner 1) - (play-from-hand state :corp "Scorched Earth") - (is (= :corp (:winner @state)) "Corp wins") - (is (= "Flatline" (:reason @state)) "Win condition reports flatline")))) - -(deftest temujin-contract - ;; Temüjin Contract - (testing "Multiple times in one turn. Issue #1952" - (do-game - (new-game (default-corp) - (make-deck "Silhouette: Stealth Operative" ["Temüjin Contract"])) - (take-credits state :corp) - (play-from-hand state :runner "Temüjin Contract") - (click-prompt state :runner "Archives") - (run-empty-server state "Archives") - (is (= 5 (:credit (get-runner))) "Gained 4cr") - (run-empty-server state "Archives") - (is (= 9 (:credit (get-runner))) "Gained 4cr") - (is (= 12 (get-counters (get-resource state 0) :credit)) "Temjin has 12 credits remaining")))) - (deftest the-turning-wheel ;; The Turning Wheel (testing "Basic test" (do-game - (new-game (default-corp ["Hostile Takeover" "Ice Wall" "Ice Wall"]) - (default-runner ["The Turning Wheel"])) + (new-game {:corp {:deck ["Hostile Takeover" "Ice Wall" "Ice Wall"]} + :runner {:deck ["The Turning Wheel"]}}) (core/move state :corp (find-card "Ice Wall" (:hand (get-corp))) :deck) (core/move state :corp (find-card "Hostile Takeover" (:hand (get-corp))) :deck) (take-credits state :corp) @@ -2778,8 +2694,8 @@ (is (= 1 (-> @state :run :access-bonus)) "Runner should access 1 additional card")))) (testing "Access bonus shouldn't carry over to other runs if prematurely ended after spending TTW counters. #3598" (do-game - (new-game (default-corp ["Nisei MK II"]) - (default-runner ["The Turning Wheel"])) + (new-game {:corp {:deck ["Nisei MK II"]} + :runner {:deck ["The Turning Wheel"]}}) (play-and-score state "Nisei MK II") (is (= 1 (get-counters (get-scored state :corp 0) :agenda))) (take-credits state :corp) @@ -2801,8 +2717,8 @@ (is (zero? (-> @ state :run :access-bonus)) "Access bonus should be reset on new run")))) (testing "Spending counters shouldn't increase accesses when running a non-R&D/HQ server" (do-game - (new-game (default-corp ["Hostile Takeover" "Ice Wall"]) - (default-runner ["The Turning Wheel"])) + (new-game {:corp {:deck ["Hostile Takeover" "Ice Wall"]} + :runner {:deck ["The Turning Wheel"]}}) (core/move state :corp (find-card "Ice Wall" (:hand (get-corp))) :deck) (trash-from-hand state :corp "Hostile Takeover") (take-credits state :corp) @@ -2825,8 +2741,7 @@ (deftest theophilius-bagbiter ;; Theophilius Bagbiter - hand size is equal to credit pool (do-game - (new-game (default-corp) - (default-runner ["Theophilius Bagbiter"])) + (new-game {:runner {:deck ["Theophilius Bagbiter"]}}) (take-credits state :corp) (is (= 5 (:credit (get-runner))) "Runner starts with 5c") (play-from-hand state :runner "Theophilius Bagbiter") @@ -2842,11 +2757,32 @@ (is (empty? (get-resource state)) "No resources installed") (is (= 5 (core/hand-size state :runner)) "Max hand size is reset to default"))) +(deftest thunder-art-gallery + ;; Thunder Art Gallery + (testing "Works when removing/avoiding tags" + (do-game + (new-game {:runner {:deck ["Thunder Art Gallery" "New Angeles City Hall" "Corroder"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Thunder Art Gallery") + (core/gain-credits state :runner 1) + (core/gain-tags state :corp 1) + (core/remove-tag state :runner nil) + (click-card state :runner "New Angeles City Hall") + (is (= 1 (:credit (get-runner))) "Runner paid one less to install (but 2 to remove tag)") + (is (= "New Angeles City Hall" (:title (get-resource state 1))) "NACH is installed") + (take-credits state :runner) + (is (= 3 (:credit (get-runner))) "Runner is now at 3 credits") + (core/gain-tags state :corp 1) + (card-ability state :runner (get-resource state 1) 0) + (click-prompt state :runner "Done") + (click-card state :runner "Corroder") + (is (= 0 (:credit (get-runner))) "Runner paid one less to install") + (is (= "Corroder" (:title (get-program state 0))) "Corroder is installed")))) + (deftest tri-maf-contact ;; Tri-maf Contact - Click for 2c once per turn; take 3 meat dmg when trashed (do-game - (new-game (default-corp) - (default-runner ["Tri-maf Contact" (qty "Cache" 3) "Shiv"])) + (new-game {:runner {:deck ["Tri-maf Contact" (qty "Cache" 3) "Shiv"]}}) (take-credits state :corp) (play-from-hand state :runner "Tri-maf Contact") (let [tmc (get-resource state 0)] @@ -2868,8 +2804,7 @@ ;; Virus Breeding Ground - Gain counters (testing "Basic test" (do-game - (new-game (default-corp) - (default-runner ["Virus Breeding Ground"])) + (new-game {:runner {:deck ["Virus Breeding Ground"]}}) (take-credits state :corp) (play-from-hand state :runner "Virus Breeding Ground") (let [vbg (get-resource state 0)] @@ -2882,8 +2817,7 @@ (is (= 2 (get-counters (refresh vbg) :virus)) "Virus Breeding Ground gains 1 counter per turn")))) (testing "Can move to programs pumped by Hivemind" (do-game - (new-game (default-corp) - (default-runner ["Virus Breeding Ground" "Hivemind" "Aumakua"])) + (new-game {:runner {:deck ["Virus Breeding Ground" "Hivemind" "Aumakua"]}}) (take-credits state :corp) (play-from-hand state :runner "Virus Breeding Ground") (take-credits state :runner) @@ -2900,8 +2834,7 @@ (is (zero? (get-counters (refresh vbg) :virus)) "Virus Breeding Ground lost 1 counter")))) (testing "Move counters" (do-game - (new-game (default-corp) - (default-runner ["Virus Breeding Ground" "Hivemind"])) + (new-game {:runner {:deck ["Virus Breeding Ground" "Hivemind"]}}) (take-credits state :corp) (play-from-hand state :runner "Virus Breeding Ground") (play-from-hand state :runner "Hivemind") @@ -2918,8 +2851,7 @@ (is (zero? (get-counters (refresh vbg) :virus)) "Virus Breeding Ground lost 1 counter")))) (testing "Move counters to a non-virus resource" (do-game - (new-game (default-corp) - (default-runner ["Virus Breeding Ground" "Crypt"])) + (new-game {:runner {:deck ["Virus Breeding Ground" "Crypt"]}}) (take-credits state :corp) (play-from-hand state :runner "Virus Breeding Ground") (play-from-hand state :runner "Crypt") @@ -2947,8 +2879,8 @@ (deftest wasteland ;; Wasteland - Gain 1c the first time you trash an installed card of yours each turn (do-game - (new-game (default-corp ["PAD Campaign"]) - (default-runner ["Wasteland" "Faust" (qty "Fall Guy" 4)])) + (new-game {:corp {:deck ["PAD Campaign"]} + :runner {:deck ["Wasteland" "Faust" (qty "Fall Guy" 4)]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (take-credits state :corp) (core/gain state :runner :click 2) @@ -2982,8 +2914,8 @@ (deftest xanadu ;; Xanadu - Increase all ICE rez cost by 1 credit (do-game - (new-game (default-corp [(qty "Paper Wall" 2) "Launch Campaign"]) - (default-runner ["Xanadu"])) + (new-game {:corp {:deck [(qty "Paper Wall" 2) "Launch Campaign"]} + :runner {:deck ["Xanadu"]}}) (play-from-hand state :corp "Paper Wall" "HQ") (play-from-hand state :corp "Paper Wall" "R&D") (play-from-hand state :corp "Launch Campaign" "New remote") @@ -3002,8 +2934,7 @@ (deftest zona-sul-shipping ;; Zona Sul Shipping - Gain 1c per turn, click to take all credits. Trash when tagged (do-game - (new-game (default-corp) - (default-runner ["Zona Sul Shipping"])) + (new-game {:runner {:deck ["Zona Sul Shipping"]}}) (take-credits state :corp) (play-from-hand state :runner "Zona Sul Shipping") (let [zss (get-resource state 0)] diff --git a/test/clj/game_test/cards/upgrades.clj b/test/clj/game_test/cards/upgrades.clj index fab91001bb..284147e7e4 100644 --- a/test/clj/game_test/cards/upgrades.clj +++ b/test/clj/game_test/cards/upgrades.clj @@ -1,18 +1,16 @@ (ns game-test.cards.upgrades (:require [game.core :as core] + [game.utils :as utils] [game-test.core :refer :all] [game-test.utils :refer :all] [game-test.macros :refer :all] [jinteki.utils :refer [count-tags]] [clojure.test :refer :all])) -(use-fixtures :once load-all-cards (partial reset-card-defs "upgrades")) - (deftest amazon-industrial-zone ;; Amazon Industrial Zone - Immediately rez ICE installed over its server at 3 credit discount (do-game - (new-game (default-corp ["Spiderweb" "Amazon Industrial Zone"]) - (default-runner)) + (new-game {:corp {:deck ["Spiderweb" "Amazon Industrial Zone"]}}) (take-credits state :corp 1) (play-from-hand state :corp "Amazon Industrial Zone" "New remote") (let [aiz (get-content state :remote1 0)] @@ -28,8 +26,7 @@ ;; Arella Salvatore - when an agenda is scored from this server, install a card from hq w/ advancement token (testing "Install to server" (do-game - (new-game (default-corp ["Arella Salvatore" "Bryan Stinson" (qty "TGTBT" 2)]) - (default-runner)) + (new-game {:corp {:deck ["Arella Salvatore" "Bryan Stinson" (qty "TGTBT" 2)]}}) (play-from-hand state :corp "Arella Salvatore" "New remote") (play-from-hand state :corp "TGTBT" "Server 1") (play-from-hand state :corp "TGTBT" "New remote") @@ -48,8 +45,8 @@ (is (= 1 (get-counters (get-content state :remote3 0) :advancement)) "Bryan has 1 advancement counter")))) (testing "Interaction w/ other on-scored triggers" (do-game - (new-game (make-deck "Sportsmetal: Go Big or Go Home" ["Arella Salvatore" "Domestic Sleepers" "Project Vitruvius" "Hedge Fund"]) - (default-runner)) + (new-game {:corp {:id "Sportsmetal: Go Big or Go Home" + :deck ["Arella Salvatore" "Domestic Sleepers" "Project Vitruvius" "Hedge Fund"]}}) (starting-hand state :corp ["Arella Salvatore" "Domestic Sleepers"]) (play-from-hand state :corp "Arella Salvatore" "New remote") (play-from-hand state :corp "Domestic Sleepers" "Server 1") @@ -66,8 +63,7 @@ (is (= 1 (get-counters (get-content state :remote1 1) :advancement)) "Agenda has 1 advancement counter")))) (testing "No cost" (do-game - (new-game (default-corp ["Arella Salvatore" "TGTBT" (qty "Ice Wall" 2)]) - (default-runner)) + (new-game {:corp {:deck ["Arella Salvatore" "TGTBT" (qty "Ice Wall" 2)]}}) (core/gain state :corp :click 5) (play-from-hand state :corp "Arella Salvatore" "New remote") (play-from-hand state :corp "TGTBT" "Server 1") @@ -85,8 +81,7 @@ (deftest ash-2x3zb9cy ;; Ash 2X3ZB9CY (do-game - (new-game (default-corp ["Ash 2X3ZB9CY" (qty "Ice Wall" 10)]) - (default-runner)) + (new-game {:corp {:deck ["Ash 2X3ZB9CY" (qty "Ice Wall" 10)]}}) (starting-hand state :corp ["Ash 2X3ZB9CY" "Ice Wall"]) (play-from-hand state :corp "Ash 2X3ZB9CY" "HQ") (take-credits state :corp) @@ -103,8 +98,7 @@ ;; Awakening Center (testing "Basic Operation" (do-game - (new-game (default-corp ["Awakening Center" "Fairchild"]) - (default-runner)) + (new-game {:corp {:deck ["Awakening Center" "Fairchild"]}}) (play-from-hand state :corp "Awakening Center" "New remote") (let [ac (get-content state :remote1 0)] (core/rez state :corp ac) @@ -125,8 +119,8 @@ (is (empty? (:hosted (refresh ac))) "Fairchild no longer hosted"))))) (testing "DDoS Interaction" (do-game - (new-game (default-corp ["Awakening Center" "Fairchild"]) - (default-runner ["DDoS"])) + (new-game {:corp {:deck ["Awakening Center" "Fairchild"]} + :runner {:deck ["DDoS"]}}) (play-from-hand state :corp "Awakening Center" "New remote") (let [ac (get-content state :remote1 0)] (core/rez state :corp ac) @@ -151,8 +145,7 @@ ;; Ben Musashi (testing "Basic test - pay 2 net damage to steal from this server" (do-game - (new-game (default-corp ["Ben Musashi" "House of Knives"]) - (default-runner)) + (new-game {:corp {:deck ["Ben Musashi" "House of Knives"]}}) (play-from-hand state :corp "Ben Musashi" "New remote") (play-from-hand state :corp "House of Knives" "Server 1") (take-credits state :corp 1) @@ -177,8 +170,7 @@ (is (= 1 (count (:scored (get-runner)))) "1 scored agenda")))) (testing "on R&D access" (do-game - (new-game (default-corp ["Ben Musashi" "House of Knives"]) - (default-runner)) + (new-game {:corp {:deck ["Ben Musashi" "House of Knives"]}}) (starting-hand state :corp ["Ben Musashi"]) (play-from-hand state :corp "Ben Musashi" "R&D") (take-credits state :corp) @@ -202,8 +194,7 @@ (is (= 1 (count (:scored (get-runner)))) "1 scored agenda")))) (testing "pay even when trashed" (do-game - (new-game (default-corp [(qty "Ben Musashi" 3) (qty "House of Knives" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Ben Musashi" 3) (qty "House of Knives" 3)]}}) (play-from-hand state :corp "Ben Musashi" "New remote") (play-from-hand state :corp "House of Knives" "Server 1") (take-credits state :corp 1) @@ -222,8 +213,8 @@ (is (= 1 (count (:scored (get-runner)))) "1 scored agenda")))) (testing "Check runner chooses order of payment" (do-game - (new-game (default-corp ["Ben Musashi" "Obokata Protocol"]) - (default-runner [(qty "Sure Gamble" 6)])) + (new-game {:corp {:deck ["Ben Musashi" "Obokata Protocol"]} + :runner {:deck [(qty "Sure Gamble" 6)]}}) (play-from-hand state :corp "Ben Musashi" "New remote") (play-from-hand state :corp "Obokata Protocol" "Server 1") (take-credits state :corp) @@ -245,8 +236,8 @@ (is (= 1 (count (:scored (get-runner)))) "Scored agenda")))) (testing "Check Fetal AI can be stolen, #2586" (do-game - (new-game (default-corp ["Ben Musashi" "Fetal AI"]) - (default-runner [(qty "Sure Gamble" 5)])) + (new-game {:corp {:deck ["Ben Musashi" "Fetal AI"]} + :runner {:deck [(qty "Sure Gamble" 5)]}}) (play-from-hand state :corp "Ben Musashi" "New remote") (play-from-hand state :corp "Fetal AI" "Server 1") (take-credits state :corp) @@ -271,8 +262,7 @@ ;; Bernice Mai (testing "Basic test - successful and unsuccessful" (do-game - (new-game (default-corp [(qty "Bernice Mai" 3) (qty "Hedge Fund" 3) (qty "Wall of Static" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Bernice Mai" 3) (qty "Hedge Fund" 3) (qty "Wall of Static" 3)]}}) (starting-hand state :corp ["Bernice Mai" "Bernice Mai" "Bernice Mai"]) (play-from-hand state :corp "Bernice Mai" "New remote") (play-from-hand state :corp "Bernice Mai" "New remote") @@ -299,8 +289,7 @@ (is (:card (first (:prompt (get-runner)))) "Accessing a card from R&D; not showing Bernice Mai as possible access"))) (testing "interaction with Dedicated Response Team" (do-game - (new-game (default-corp [(qty "Bernice Mai" 3) "Dedicated Response Team"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Bernice Mai" 3) "Dedicated Response Team"]}}) (play-from-hand state :corp "Bernice Mai" "New remote") (play-from-hand state :corp "Dedicated Response Team" "New remote") (core/rez state :corp (get-content state :remote1 0)) @@ -317,8 +306,7 @@ (deftest bio-vault ;; Bio Vault - 2 advancement tokens + trash to end the run (do-game - (new-game (default-corp ["Bio Vault"]) - (default-runner)) + (new-game {:corp {:deck ["Bio Vault"]}}) (play-from-hand state :corp "Bio Vault" "New remote") (take-credits state :corp) (let [bv (get-content state :remote1 0)] @@ -339,31 +327,30 @@ (deftest breaker-bay-grid ;; Breaker Bay Grid - Reduce rez cost of other cards in this server by 5 credits (do-game - (new-game (default-corp [(qty "Breaker Bay Grid" 2) "The Root" "Strongbox"]) - (default-runner)) - (core/gain state :corp :click 1) - (play-from-hand state :corp "Breaker Bay Grid" "New remote") - (play-from-hand state :corp "The Root" "Server 1") - (let [bbg1 (get-content state :remote1 0) - root (get-content state :remote1 1)] - (core/rez state :corp bbg1) - (core/rez state :corp root) - (is (= 4 (:credit (get-corp))) "Paid only 1 to rez The Root") - (play-from-hand state :corp "Breaker Bay Grid" "R&D") - (play-from-hand state :corp "Strongbox" "R&D") - (let [bbg2 (get-content state :rd 0) - sbox (get-content state :rd 1)] - (core/rez state :corp bbg2) - (core/rez state :corp sbox) - (is (= 1 (:credit (get-corp))) "Paid full 3 credits to rez Strongbox"))))) + (new-game {:corp {:deck [(qty "Breaker Bay Grid" 2) "The Root" "Strongbox"]}}) + (core/gain state :corp :click 1) + (play-from-hand state :corp "Breaker Bay Grid" "New remote") + (play-from-hand state :corp "The Root" "Server 1") + (let [bbg1 (get-content state :remote1 0) + root (get-content state :remote1 1)] + (core/rez state :corp bbg1) + (core/rez state :corp root) + (is (= 4 (:credit (get-corp))) "Paid only 1 to rez The Root") + (play-from-hand state :corp "Breaker Bay Grid" "R&D") + (play-from-hand state :corp "Strongbox" "R&D") + (let [bbg2 (get-content state :rd 0) + sbox (get-content state :rd 1)] + (core/rez state :corp bbg2) + (core/rez state :corp sbox) + (is (= 1 (:credit (get-corp))) "Paid full 3 credits to rez Strongbox"))))) (deftest bryan-stinson ;; Bryan Stinson - play a transaction from archives and remove from game. Ensure Currents are RFG and not trashed. (do-game - (new-game (default-corp ["Bryan Stinson" "Death and Taxes" - "Paywall Implementation" "Global Food Initiative" - "IPO"]) - (default-runner ["Interdiction"])) + (new-game {:corp {:deck ["Bryan Stinson" "Death and Taxes" + "Paywall Implementation" "Global Food Initiative" + "IPO"]} + :runner {:deck ["Interdiction"]}}) (trash-from-hand state :corp "Death and Taxes") (play-from-hand state :corp "Bryan Stinson" "New remote") (let [bs (get-content state :remote1 0)] @@ -399,8 +386,7 @@ (deftest calibration-testing ;; Calibration Testing - advanceable / non-advanceable (do-game - (new-game (default-corp [(qty "Calibration Testing" 2) "Project Junebug" "PAD Campaign"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Calibration Testing" 2) "Project Junebug" "PAD Campaign"]}}) (core/gain state :corp :credit 10) (core/gain state :corp :click 1) (play-from-hand state :corp "Calibration Testing" "New remote") @@ -425,44 +411,42 @@ (deftest caprice-nisei ;; Caprice Nisei - Psi game for ETR after runner passes last ice (do-game - (new-game (default-corp [(qty "Caprice Nisei" 3) (qty "Quandary" 3)]) - (default-runner)) - (play-from-hand state :corp "Caprice Nisei" "New remote") - (take-credits state :corp) - (let [caprice (get-content state :remote1 0)] - ;; Check Caprice triggers properly on no ice (and rezzed) - (core/rez state :corp caprice) - (run-on state "Server 1") - (is (prompt-is-card? state :corp caprice) - "Caprice prompt even with no ice, once runner makes run") - (is (prompt-is-card? state :runner caprice) "Runner has Caprice prompt") - (click-prompt state :corp "0 [Credits]") - (click-prompt state :runner "1 [Credits]") - (take-credits state :runner) - (play-from-hand state :corp "Quandary" "Server 1") - (play-from-hand state :corp "Quandary" "Server 1") - (take-credits state :corp) - ;; Check Caprice triggers properly on multiple ice - (run-on state "Server 1") - (run-continue state) - (is (empty? (get-in @state [:corp :prompt])) "Caprice not trigger on first ice") - (run-continue state) ; Caprice prompt after this - (is (prompt-is-card? state :corp caprice) - "Corp has Caprice prompt (triggered automatically as runner passed last ice)") - (is (prompt-is-card? state :runner caprice) "Runner has Caprice prompt") - (click-prompt state :corp "0 [Credits]") - (click-prompt state :runner "1 [Credits]") - (is (not (:run @state)) "Run ended by Caprice") - (is (empty? (get-in @state [:corp :prompt])) "Caprice prompted cleared") - ;; Check Caprice does not trigger on other servers - (run-on state "HQ") - (is (empty? (get-in @state [:corp :prompt])) "Caprice does not trigger on other servers")))) + (new-game {:corp {:deck [(qty "Caprice Nisei" 3) (qty "Quandary" 3)]}}) + (play-from-hand state :corp "Caprice Nisei" "New remote") + (take-credits state :corp) + (let [caprice (get-content state :remote1 0)] + ;; Check Caprice triggers properly on no ice (and rezzed) + (core/rez state :corp caprice) + (run-on state "Server 1") + (is (prompt-is-card? state :corp caprice) + "Caprice prompt even with no ice, once runner makes run") + (is (prompt-is-card? state :runner caprice) "Runner has Caprice prompt") + (click-prompt state :corp "0 [Credits]") + (click-prompt state :runner "1 [Credits]") + (take-credits state :runner) + (play-from-hand state :corp "Quandary" "Server 1") + (play-from-hand state :corp "Quandary" "Server 1") + (take-credits state :corp) + ;; Check Caprice triggers properly on multiple ice + (run-on state "Server 1") + (run-continue state) + (is (empty? (get-in @state [:corp :prompt])) "Caprice not trigger on first ice") + (run-continue state) ; Caprice prompt after this + (is (prompt-is-card? state :corp caprice) + "Corp has Caprice prompt (triggered automatically as runner passed last ice)") + (is (prompt-is-card? state :runner caprice) "Runner has Caprice prompt") + (click-prompt state :corp "0 [Credits]") + (click-prompt state :runner "1 [Credits]") + (is (not (:run @state)) "Run ended by Caprice") + (is (empty? (get-in @state [:corp :prompt])) "Caprice prompted cleared") + ;; Check Caprice does not trigger on other servers + (run-on state "HQ") + (is (empty? (get-in @state [:corp :prompt])) "Caprice does not trigger on other servers")))) (deftest chilo-city-grid ;; ChiLo City Grid - Give 1 tag for successful traces during runs on its server (do-game - (new-game (default-corp [(qty "Caduceus" 2) "ChiLo City Grid"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Caduceus" 2) "ChiLo City Grid"]}}) (play-from-hand state :corp "ChiLo City Grid" "New remote") (play-from-hand state :corp "Caduceus" "Server 1") (take-credits state :corp) @@ -488,8 +472,7 @@ (deftest code-replicator ;; Code Replicator - trash to make runner approach passed (rezzed) ice again (do-game - (new-game (default-corp [(qty "Ice Wall" 3) "Code Replicator"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Ice Wall" 3) "Code Replicator"]}}) (core/gain state :corp :click 1) (core/gain state :corp :credit 5) (play-from-hand state :corp "Ice Wall" "HQ") @@ -516,8 +499,7 @@ (deftest corporate-troubleshooter ;; Corporate Troubleshooter - Pay X credits and trash to add X strength to a piece of rezzed ICE (do-game - (new-game (default-corp [(qty "Quandary" 2) "Corporate Troubleshooter"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Quandary" 2) "Corporate Troubleshooter"]}}) (core/gain state :corp :credit 5) (play-from-hand state :corp "Corporate Troubleshooter" "HQ") (play-from-hand state :corp "Quandary" "HQ") @@ -544,8 +526,8 @@ ;; Crisium Grid (testing "Basic test" (do-game - (new-game (default-corp [(qty "Crisium Grid" 2)]) - (default-runner ["Desperado" "Temüjin Contract"])) + (new-game {:corp {:deck [(qty "Crisium Grid" 2)]} + :runner {:deck ["Desperado" "Temüjin Contract"]}}) (play-from-hand state :corp "Crisium Grid" "HQ") (core/rez state :corp (get-content state :hq 0)) (take-credits state :corp) @@ -559,8 +541,8 @@ (is (not (:successful-run (:register (get-runner)))) "No successful run in register"))) (testing "with Gauntlet, #3082" (do-game - (new-game (default-corp [(qty "Crisium Grid" 2)(qty "Vanilla" 2)]) - (default-runner ["The Gauntlet" "Temüjin Contract"])) + (new-game {:corp {:deck [(qty "Crisium Grid" 2)(qty "Vanilla" 2)]} + :runner {:deck ["The Gauntlet" "Temüjin Contract"]}}) (play-from-hand state :corp "Crisium Grid" "HQ") (play-from-hand state :corp "Vanilla" "HQ") (core/rez state :corp (get-ice state :hq 0)) @@ -576,8 +558,8 @@ ;; Cyberdex Virus Suite (testing "Purge ability" (do-game - (new-game (default-corp [(qty "Cyberdex Virus Suite" 3)]) - (default-runner ["Cache" "Medium"])) + (new-game {:corp {:deck [(qty "Cyberdex Virus Suite" 3)]} + :runner {:deck ["Cache" "Medium"]}}) (play-from-hand state :corp "Cyberdex Virus Suite" "HQ") (take-credits state :corp 2) ;; runner's turn @@ -600,8 +582,8 @@ "Medium has no counters")))) (testing "Purge on access" (do-game - (new-game (default-corp [(qty "Cyberdex Virus Suite" 3)]) - (default-runner ["Cache" "Medium"])) + (new-game {:corp {:deck [(qty "Cyberdex Virus Suite" 3)]} + :runner {:deck ["Cache" "Medium"]}}) (play-from-hand state :corp "Cyberdex Virus Suite" "New remote") (take-credits state :corp 2) ;; runner's turn @@ -624,8 +606,8 @@ "Medium has no counters")))) (testing "Don't interrupt archives access, #1647" (do-game - (new-game (default-corp ["Cyberdex Virus Suite" "Braintrust"]) - (default-runner ["Cache"])) + (new-game {:corp {:deck ["Cyberdex Virus Suite" "Braintrust"]} + :runner {:deck ["Cache"]}}) (trash-from-hand state :corp "Cyberdex Virus Suite") (trash-from-hand state :corp "Braintrust") (take-credits state :corp) @@ -645,8 +627,7 @@ (deftest drone-screen ;; Drone Screen (do-game - (new-game (default-corp ["Drone Screen"]) - (default-runner)) + (new-game {:corp {:deck ["Drone Screen"]}}) (play-from-hand state :corp "Drone Screen" "New remote") (let [drone (get-content state :remote1 0)] (core/rez state :corp drone) @@ -661,8 +642,7 @@ (deftest forced-connection ;; Forced Connection - ambush, trace(3) give the runner 2 tags (do-game - (new-game (default-corp [(qty "Forced Connection" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Forced Connection" 3)]}}) (starting-hand state :corp ["Forced Connection" "Forced Connection"]) (play-from-hand state :corp "Forced Connection" "New remote") (take-credits state :corp) @@ -683,8 +663,7 @@ (deftest georgia-emelyov ;; Georgia Emelyov (do-game - (new-game (default-corp ["Georgia Emelyov"]) - (default-runner)) + (new-game {:corp {:deck ["Georgia Emelyov"]}}) (play-from-hand state :corp "Georgia Emelyov" "New remote") (let [geo (get-content state :remote1 0)] (core/rez state :corp geo) @@ -706,8 +685,8 @@ (deftest giordano-memorial-field ;; Giordano Memorial Field (do-game - (new-game (default-corp ["Giordano Memorial Field" "Hostile Takeover"]) - (default-corp [(qty "Fan Site" 3)])) + (new-game {:corp {:deck ["Giordano Memorial Field" "Hostile Takeover"]} + :runner {:deck [(qty "Fan Site" 3)]}}) (play-from-hand state :corp "Giordano Memorial Field" "New remote") (core/rez state :corp (get-content state :remote1 0)) (take-credits state :corp) @@ -731,9 +710,8 @@ (deftest helheim-servers ;; Helheim Servers - Full test (do-game - (new-game (default-corp ["Helheim Servers" "Gutenberg" "Vanilla" - "Jackson Howard" "Hedge Fund"]) - (default-runner)) + (new-game {:corp {:deck ["Helheim Servers" "Gutenberg" "Vanilla" + "Jackson Howard" "Hedge Fund"]}}) (play-from-hand state :corp "Helheim Servers" "R&D") (play-from-hand state :corp "Gutenberg" "R&D") (play-from-hand state :corp "Vanilla" "R&D") @@ -766,8 +744,7 @@ (deftest hokusai-grid ;; Hokusai Grid - Do 1 net damage when run successful on its server (do-game - (new-game (default-corp ["Hokusai Grid"]) - (default-runner)) + (new-game {:corp {:deck ["Hokusai Grid"]}}) (play-from-hand state :corp "Hokusai Grid" "HQ") (take-credits state :corp) (core/rez state :corp (get-content state :hq 0)) @@ -779,8 +756,8 @@ (deftest intake ;; Intake - Trace4, add an installed program or virtual resource to the grip (do-game - (new-game (default-corp [(qty "Intake" 3)]) - (default-runner ["Corroder" "Fester" "Daily Casts"])) + (new-game {:corp {:deck [(qty "Intake" 3)]} + :runner {:deck ["Corroder" "Fester" "Daily Casts"]}}) (starting-hand state :corp ["Intake" "Intake"]) (play-from-hand state :corp "Intake" "New remote") (take-credits state :corp) @@ -826,26 +803,25 @@ ;; Jinja City Grid - install drawn ice, lowering install cost by 4 (testing "Single draws" (do-game - (new-game (default-corp ["Jinja City Grid" (qty "Vanilla" 3) (qty "Ice Wall" 3)]) - (default-runner)) - (starting-hand state :corp ["Jinja City Grid"]) - (core/gain state :corp :click 6) - (play-from-hand state :corp "Jinja City Grid" "New remote") - (core/rez state :corp (get-content state :remote1 0)) - (dotimes [n 5] + (new-game {:corp {:deck ["Jinja City Grid" (qty "Vanilla" 3) (qty "Ice Wall" 3)]}}) + (starting-hand state :corp ["Jinja City Grid"]) + (core/gain state :corp :click 6) + (play-from-hand state :corp "Jinja City Grid" "New remote") + (core/rez state :corp (get-content state :remote1 0)) + (dotimes [n 5] + (core/click-draw state :corp 1) + (click-prompt state :corp (-> (get-corp) :prompt first :choices first)) + (is (= 4 (:credit (get-corp))) "Not charged to install ice") + (is (= (inc n) (count (get-in @state [:corp :servers :remote1 :ices]))) (str n " ICE protecting Remote1"))) (core/click-draw state :corp 1) (click-prompt state :corp (-> (get-corp) :prompt first :choices first)) - (is (= 4 (:credit (get-corp))) "Not charged to install ice") - (is (= (inc n) (count (get-in @state [:corp :servers :remote1 :ices]))) (str n " ICE protecting Remote1"))) - (core/click-draw state :corp 1) - (click-prompt state :corp (-> (get-corp) :prompt first :choices first)) - (is (= 3 (:credit (get-corp))) "Charged to install ice") - (is (= 6 (count (get-in @state [:corp :servers :remote1 :ices]))) "6 ICE protecting Remote1"))) + (is (= 3 (:credit (get-corp))) "Charged to install ice") + (is (= 6 (count (get-in @state [:corp :servers :remote1 :ices]))) "6 ICE protecting Remote1"))) (testing "Drawing non-ice on runner's turn" (do-game - (new-game - (default-corp ["Jinja City Grid" (qty "Hedge Fund" 3)]) - (make-deck "Laramy Fisk: Savvy Investor" ["Eden Shard"])) + (new-game {:corp {:deck ["Jinja City Grid" (qty "Hedge Fund" 3)]} + :runner {:id "Laramy Fisk: Savvy Investor" + :deck ["Eden Shard"]}}) (starting-hand state :corp ["Jinja City Grid"]) (play-from-hand state :corp "Jinja City Grid" "HQ") (core/rez state :corp (get-content state :hq 0)) @@ -859,8 +835,8 @@ (deftest keegan-lane ;; Keegan Lane - Trash self and remove 1 Runner tag to trash a program (do-game - (new-game (default-corp ["Keegan Lane"]) - (default-runner ["Corroder"])) + (new-game {:corp {:deck ["Keegan Lane"]} + :runner {:deck ["Corroder"]}}) (play-from-hand state :corp "Keegan Lane" "HQ") (take-credits state :corp) (play-from-hand state :runner "Corroder") @@ -879,8 +855,7 @@ (deftest manta-grid ;; If the Runner has fewer than 6 or no unspent clicks on successful run, corp gains a click next turn. (do-game - (new-game (default-corp ["Manta Grid"]) - (default-runner)) + (new-game {:corp {:deck ["Manta Grid"]}}) (starting-hand state :runner []) (is (= 3 (:click (get-corp))) "Corp has 3 clicks") (play-from-hand state :corp "Manta Grid" "HQ") @@ -909,8 +884,8 @@ ;; Marcus Batty (testing "Simultaneous Interaction with Security Nexus" (do-game - (new-game (default-corp ["Marcus Batty" "Enigma"]) - (default-runner ["Security Nexus"])) + (new-game {:corp {:deck ["Marcus Batty" "Enigma"]} + :runner {:deck ["Security Nexus"]}}) (play-from-hand state :corp "Marcus Batty" "HQ") (play-from-hand state :corp "Enigma" "HQ") (take-credits state :corp) @@ -936,8 +911,7 @@ ;; Mumbad City Grid - when runner passes a piece of ice, swap that ice with another from this server (testing "1 ice" (do-game - (new-game (default-corp ["Mumbad City Grid" "Quandary"]) - (default-runner)) + (new-game {:corp {:deck ["Mumbad City Grid" "Quandary"]}}) (play-from-hand state :corp "Mumbad City Grid" "New remote") (play-from-hand state :corp "Quandary" "Server 1") (let [mcg (get-content state :remote1 0)] @@ -952,8 +926,7 @@ (is (= 1 (count (get-in @state [:corp :servers :remote1 :ices]))) "Still 1 ice on server")))) (testing "fire before pass" (do-game - (new-game (default-corp ["Mumbad City Grid" "Quandary" "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Mumbad City Grid" "Quandary" "Ice Wall"]}}) (play-from-hand state :corp "Mumbad City Grid" "New remote") (play-from-hand state :corp "Quandary" "Server 1") (play-from-hand state :corp "Ice Wall" "Server 1") @@ -979,8 +952,7 @@ (deftest mumbad-virtual-tour ;; Tests that Mumbad Virtual Tour forces trash when no :slow-trash (do-game - (new-game (default-corp [(qty "Mumbad Virtual Tour" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Mumbad Virtual Tour" 2)]}}) (play-from-hand state :corp "Mumbad Virtual Tour" "New remote") (take-credits state :corp) (run-empty-server state "HQ") @@ -995,8 +967,8 @@ (is (= "Mumbad Virtual Tour" (:title (first (:discard (get-corp))))) "MVT trashed")) (testing "interaction with Imp" (do-game - (new-game (default-corp [(qty "Mumbad Virtual Tour" 2)]) - (default-runner ["Imp"])) + (new-game {:corp {:deck [(qty "Mumbad Virtual Tour" 2)]} + :runner {:deck ["Imp"]}}) (play-from-hand state :corp "Mumbad Virtual Tour" "New remote") (play-from-hand state :corp "Mumbad Virtual Tour" "New remote") (take-credits state :corp) @@ -1016,8 +988,8 @@ (is (not (core/any-flag-fn? state :runner :slow-trash true)))))) (testing "interactions with Imp and various amounts of money" (do-game - (new-game (default-corp [(qty "Mumbad Virtual Tour" 3)]) - (default-runner ["Imp"])) + (new-game {:corp {:deck [(qty "Mumbad Virtual Tour" 3)]} + :runner {:deck ["Imp"]}}) (play-from-hand state :corp "Mumbad Virtual Tour" "New remote") (take-credits state :corp) (play-from-hand state :runner "Imp") @@ -1044,8 +1016,8 @@ (is (= 2 (->> (get-corp) :discard count)) "Runner was not forced to trash MVT"))) (testing "not forced to trash when credits below 5" (do-game - (new-game (default-corp [(qty "Mumbad Virtual Tour" 3)]) - (default-runner ["Cache"])) + (new-game {:corp {:deck [(qty "Mumbad Virtual Tour" 3)]} + :runner {:deck ["Cache"]}}) (play-from-hand state :corp "Mumbad Virtual Tour" "New remote") (take-credits state :corp) (play-from-hand state :runner "Cache") @@ -1057,8 +1029,7 @@ ;; Mwanza City Grid - runner accesses 3 additional cards, gain 2C for each card accessed (testing "Basic test" (do-game - (new-game (default-corp ["Mwanza City Grid" (qty "Hedge Fund" 5)]) - (default-runner)) + (new-game {:corp {:deck ["Mwanza City Grid" (qty "Hedge Fund" 5)]}}) (play-from-hand state :corp "Mwanza City Grid") (is (= #{"R&D" "HQ"} (-> (get-corp) :prompt first :choices set)) "Mwanza can only be installed in root of HQ or R&D") (click-prompt state :corp "HQ") @@ -1077,8 +1048,7 @@ (is (= 17 (:credit (get-corp))) "Corp gains 10 credits")))) (testing "effect persists through current run after trash" (do-game - (new-game (default-corp ["Mwanza City Grid" (qty "Hedge Fund" 5)]) - (default-runner)) + (new-game {:corp {:deck ["Mwanza City Grid" (qty "Hedge Fund" 5)]}}) (play-from-hand state :corp "Mwanza City Grid" "HQ") (take-credits state :corp) (run-on state "HQ") @@ -1096,8 +1066,8 @@ (testing "works well with replacement effects" ;; Regression test for #3456 (do-game - (new-game (default-corp ["Mwanza City Grid" "Hedge Fund"]) - (default-runner ["Embezzle"])) + (new-game {:corp {:deck ["Mwanza City Grid" "Hedge Fund"]} + :runner {:deck ["Embezzle"]}}) (play-from-hand state :corp "Mwanza City Grid" "HQ") (take-credits state :corp) (core/rez state :corp (get-content state :hq 0)) @@ -1110,9 +1080,8 @@ (testing "interaction with Kitsune" ;; Regression test for #3469 (do-game - (new-game (default-corp ["Mwanza City Grid" "Breached Dome" - (qty "Kitsune" 2) (qty "Hedge Fund" 3)]) - (default-runner)) + (new-game {:corp {:deck ["Mwanza City Grid" "Breached Dome" + (qty "Kitsune" 2) (qty "Hedge Fund" 3)]}}) (core/draw state :corp 1) ; Draw last card of deck (play-from-hand state :corp "Mwanza City Grid" "HQ") (play-from-hand state :corp "Kitsune" "HQ") @@ -1149,9 +1118,8 @@ (deftest neotokyo-grid ;; NeoTokyo Grid - Gain 1c the first time per turn a card in this server gets an advancement (do-game - (new-game (default-corp ["NeoTokyo Grid" "Nisei MK II" - "Shipment from SanSan" "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["NeoTokyo Grid" "Nisei MK II" + "Shipment from SanSan" "Ice Wall"]}}) (core/gain state :corp :click 2) (play-from-hand state :corp "NeoTokyo Grid" "New remote") (play-from-hand state :corp "Nisei MK II" "Server 1") @@ -1174,8 +1142,7 @@ (deftest oberth-protocol ;; Oberth Protocol (do-game - (new-game (default-corp ["Hostile Takeover" "Oberth Protocol" "Oaktown Renovation"]) - (default-runner)) + (new-game {:corp {:deck ["Hostile Takeover" "Oberth Protocol" "Oaktown Renovation"]}}) (play-and-score state "Hostile Takeover") (play-from-hand state :corp "Oberth Protocol" "Server 1") (play-from-hand state :corp "Oaktown Renovation" "Server 1") @@ -1191,31 +1158,29 @@ (deftest off-the-grid ;; Off the Grid run restriction - and interaction with RP (do-game - (new-game - (make-deck "Jinteki: Replicating Perfection" [(qty "Off the Grid" 3) - (qty "Mental Health Clinic" 3)]) - (default-runner)) - (play-from-hand state :corp "Off the Grid" "New remote") - (play-from-hand state :corp "Mental Health Clinic" "Server 1") - (let [otg (get-content state :remote1 0)] - (take-credits state :corp) - (core/rez state :corp (refresh otg)) - (is (not (core/can-run-server? state "Server 1")) "Runner can only run on centrals") - (run-empty-server state "R&D") - (is (not (core/can-run-server? state "Server 1")) "Runner cannot run on Off the Grid") - (take-credits state :runner) - (take-credits state :corp) - (is (not (core/can-run-server? state "Server 1")) "Off the Grid prevention persisted") - (run-empty-server state "HQ") - (is (boolean (core/can-run-server? state "Server 1")) "Runner can run on Server 1") - (is (= nil (refresh otg)) "Off the Grid trashed")))) + (new-game {:corp {:id "Jinteki: Replicating Perfection" + :deck [(qty "Off the Grid" 3) + (qty "Mental Health Clinic" 3)]}}) + (play-from-hand state :corp "Off the Grid" "New remote") + (play-from-hand state :corp "Mental Health Clinic" "Server 1") + (let [otg (get-content state :remote1 0)] + (take-credits state :corp) + (core/rez state :corp (refresh otg)) + (is (not (core/can-run-server? state "Server 1")) "Runner can only run on centrals") + (run-empty-server state "R&D") + (is (not (core/can-run-server? state "Server 1")) "Runner cannot run on Off the Grid") + (take-credits state :runner) + (take-credits state :corp) + (is (not (core/can-run-server? state "Server 1")) "Off the Grid prevention persisted") + (run-empty-server state "HQ") + (is (boolean (core/can-run-server? state "Server 1")) "Runner can run on Server 1") + (is (= nil (refresh otg)) "Off the Grid trashed")))) (deftest old-hollywood-grid ;; Old Hollywood Grid (testing "Basic test" (do-game - (new-game (default-corp ["Old Hollywood Grid" (qty "House of Knives" 3)]) - (default-runner)) + (new-game {:corp {:deck ["Old Hollywood Grid" (qty "House of Knives" 3)]}}) (play-from-hand state :corp "Old Hollywood Grid" "New remote") (play-from-hand state :corp "House of Knives" "Server 1") (take-credits state :corp 1) @@ -1237,8 +1202,7 @@ (is (= 2 (count (:scored (get-runner)))) "2 stolen agendas")))) (testing "Central server" (do-game - (new-game (default-corp ["Old Hollywood Grid" (qty "House of Knives" 3)]) - (default-runner)) + (new-game {:corp {:deck ["Old Hollywood Grid" (qty "House of Knives" 3)]}}) (play-from-hand state :corp "Old Hollywood Grid" "HQ") (take-credits state :corp 2) (let [ohg (get-content state :hq 0)] @@ -1256,8 +1220,8 @@ (is (= 1 (count (:scored (get-runner)))) "1 stolen agenda")))) (testing "Gang Sign interaction. Prevent the steal outside of a run. #2169" (do-game - (new-game (default-corp ["Old Hollywood Grid" (qty "Project Beale" 2)]) - (default-runner ["Gang Sign"])) + (new-game {:corp {:deck ["Old Hollywood Grid" (qty "Project Beale" 2)]} + :runner {:deck ["Gang Sign"]}}) (play-from-hand state :corp "Old Hollywood Grid" "HQ") (play-from-hand state :corp "Project Beale" "New remote") (take-credits state :corp) @@ -1271,8 +1235,7 @@ (is (zero? (count (:scored (get-runner)))) "No stolen agendas"))) (testing "Trash order" (do-game - (new-game (default-corp ["Old Hollywood Grid" "Project Beale"]) - (default-runner)) + (new-game {:corp {:deck ["Old Hollywood Grid" "Project Beale"]}}) (play-from-hand state :corp "Old Hollywood Grid" "New remote") (play-from-hand state :corp "Project Beale" "Server 1") (take-credits state :corp) @@ -1293,8 +1256,7 @@ (is (= 1 (count (:scored (get-runner)))) "1 stolen agenda")))) (testing "Steal other agendas" (do-game - (new-game (default-corp ["Old Hollywood Grid" (qty "Project Beale" 2)]) - (default-runner)) + (new-game {:corp {:deck ["Old Hollywood Grid" (qty "Project Beale" 2)]}}) (play-from-hand state :corp "Old Hollywood Grid" "New remote") (play-from-hand state :corp "Project Beale" "Server 1") (play-from-hand state :corp "Project Beale" "New remote") @@ -1310,8 +1272,7 @@ ;; Overseer Matrix - corp takes a tag when trashing a card in this server (testing "Basic functionality" (do-game - (new-game (default-corp ["Overseer Matrix" "Red Herrings"]) - (default-runner)) + (new-game {:corp {:deck ["Overseer Matrix" "Red Herrings"]}}) (play-from-hand state :corp "Overseer Matrix" "New remote") (play-from-hand state :corp "Red Herrings" "Server 1") (take-credits state :corp) @@ -1331,8 +1292,7 @@ (is (= 2 (count-tags state)) "Runner takes a tag")))) (testing "Effect persists after trash" (do-game - (new-game (default-corp ["Overseer Matrix" (qty "Red Herrings" 3)]) - (default-runner)) + (new-game {:corp {:deck ["Overseer Matrix" (qty "Red Herrings" 3)]}}) (play-from-hand state :corp "Overseer Matrix" "New remote") (play-from-hand state :corp "Red Herrings" "Server 1") (take-credits state :corp) @@ -1352,8 +1312,7 @@ (is (= 2 (count-tags state)) "Runner takes a tag")))) (testing "Effect ends after current run" (do-game - (new-game (default-corp ["Overseer Matrix" (qty "Red Herrings" 3)]) - (default-runner)) + (new-game {:corp {:deck ["Overseer Matrix" (qty "Red Herrings" 3)]}}) (play-from-hand state :corp "Overseer Matrix" "New remote") (play-from-hand state :corp "Red Herrings" "Server 1") (take-credits state :corp) @@ -1379,8 +1338,8 @@ (deftest port-anson-grid ;; Port Anson Grid - Prevent the Runner from jacking out until they trash a program (do-game - (new-game (default-corp ["Port Anson Grid" "Data Raven"]) - (default-runner ["Faerie" "Technical Writer"])) + (new-game {:corp {:deck ["Port Anson Grid" "Data Raven"]} + :runner {:deck ["Faerie" "Technical Writer"]}}) (play-from-hand state :corp "Port Anson Grid" "New remote") (play-from-hand state :corp "Data Raven" "Server 1") (take-credits state :corp) @@ -1403,8 +1362,7 @@ ;; Prisec (testing "Basic test - Pay 2 credits to give runner 1 tag and do 1 meat damage, only when installed" (do-game - (new-game (default-corp [(qty "Prisec" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Prisec" 2)]}}) (play-from-hand state :corp "Prisec" "New remote") (take-credits state :corp) (run-empty-server state "Server 1") @@ -1419,8 +1377,8 @@ (is (not (:prompt @state)) "Prisec does not trigger from HQ"))) (testing "Multiple unrezzed upgrades in Archives interaction with DRT" (do-game - (new-game (default-corp [(qty "Prisec" 2) "Dedicated Response Team"]) - (default-runner [(qty "Sure Gamble" 3) (qty "Diesel" 3)])) + (new-game {:corp {:deck [(qty "Prisec" 2) "Dedicated Response Team"]} + :runner {:deck [(qty "Sure Gamble" 3) (qty "Diesel" 3)]}}) (play-from-hand state :corp "Dedicated Response Team" "New remote") (play-from-hand state :corp "Prisec" "Archives") (play-from-hand state :corp "Prisec" "Archives") @@ -1443,8 +1401,7 @@ (deftest product-placement ;; Product Placement - Gain 2 credits when Runner accesses it (do-game - (new-game (default-corp ["Product Placement"]) - (default-runner)) + (new-game {:corp {:deck ["Product Placement"]}}) (play-from-hand state :corp "Product Placement" "New remote") (take-credits state :corp) (is (= 7 (:credit (get-corp)))) @@ -1460,8 +1417,7 @@ ;; Red Herrings (testing "Basic test" (do-game - (new-game (default-corp ["Red Herrings" "House of Knives"]) - (default-runner)) + (new-game {:corp {:deck ["Red Herrings" "House of Knives"]}}) (play-from-hand state :corp "Red Herrings" "New remote") (play-from-hand state :corp "House of Knives" "Server 1") (take-credits state :corp 1) @@ -1486,8 +1442,7 @@ (is (= 1 (count (:scored (get-runner)))) "1 scored agenda")))) (testing "Cost increase even when trashed" (do-game - (new-game (default-corp [(qty "Red Herrings" 3) (qty "House of Knives" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Red Herrings" 3) (qty "House of Knives" 3)]}}) (play-from-hand state :corp "Red Herrings" "New remote") (play-from-hand state :corp "House of Knives" "Server 1") (take-credits state :corp 1) @@ -1506,8 +1461,7 @@ (is (= 1 (count (:scored (get-runner)))) "1 scored agenda")))) (testing "Trashed from HQ" (do-game - (new-game (default-corp ["Red Herrings" "House of Knives"]) - (default-runner)) + (new-game {:corp {:deck ["Red Herrings" "House of Knives"]}}) (trash-from-hand state :corp "Red Herrings") (is (= 1 (count (:discard (get-corp)))) "1 card in Archives") (take-credits state :corp) @@ -1517,8 +1471,7 @@ "Runner being asked to Steal"))) (testing "Don't affect runs on other servers" (do-game - (new-game (default-corp ["Red Herrings" "House of Knives"]) - (default-runner)) + (new-game {:corp {:deck ["Red Herrings" "House of Knives"]}}) (play-from-hand state :corp "Red Herrings" "New remote") (play-from-hand state :corp "House of Knives" "New remote") (take-credits state :corp 1) @@ -1534,8 +1487,7 @@ ;; Ruhr Valley (testing "Basic test - As an additional cost to make a run on this server, the Runner must spend a click." (do-game - (new-game (default-corp ["Ruhr Valley"]) - (default-runner)) + (new-game {:corp {:deck ["Ruhr Valley"]}}) (play-from-hand state :corp "Ruhr Valley" "HQ") (take-credits state :corp) (let [ruhr (get-content state :hq 0)] @@ -1561,8 +1513,7 @@ (is (= 1 (:click (get-runner))))))) (testing "If the runner trashes with one click left, the ability to run is enabled" (do-game - (new-game (default-corp ["Ruhr Valley"]) - (default-runner)) + (new-game {:corp {:deck ["Ruhr Valley"]}}) (play-from-hand state :corp "Ruhr Valley" "HQ") (take-credits state :corp) (let [ruhr (get-content state :hq 0)] @@ -1580,8 +1531,7 @@ (deftest ryon-knight ;; Ryon Knight - Trash during run to do 1 brain damage if Runner has no clicks remaining (do-game - (new-game (default-corp ["Ryon Knight"]) - (default-runner)) + (new-game {:corp {:deck ["Ryon Knight"]}}) (play-from-hand state :corp "Ryon Knight" "HQ") (take-credits state :corp) (let [ryon (get-content state :hq 0)] @@ -1602,8 +1552,7 @@ (deftest satellite-grid ;; Satellite Grid - Add 1 fake advancement on all ICE protecting server (do-game - (new-game (default-corp ["Satellite Grid" (qty "Ice Wall" 2)]) - (default-runner)) + (new-game {:corp {:deck ["Satellite Grid" (qty "Ice Wall" 2)]}}) (play-from-hand state :corp "Satellite Grid" "HQ") (play-from-hand state :corp "Ice Wall" "HQ") (play-from-hand state :corp "Ice Wall" "R&D") @@ -1625,8 +1574,7 @@ (deftest self-destruct ;; Self-destruct (do-game - (new-game (default-corp ["Self-destruct" "Dedicated Response Team" "Ice Wall"]) - (default-runner)) + (new-game {:corp {:deck ["Self-destruct" "Dedicated Response Team" "Ice Wall"]}}) (core/gain state :corp :credit 100 :click 4) (play-from-hand state :corp "Self-destruct" "New remote") (play-from-hand state :corp "Dedicated Response Team" "Server 1") @@ -1645,8 +1593,8 @@ (deftest signal-jamming ;; Trash to stop installs for the rest of the run (do-game - (new-game (default-corp [(qty "Signal Jamming" 3)]) - (default-runner [(qty "Self-modifying Code" 3) "Reaver"])) + (new-game {:corp {:deck [(qty "Signal Jamming" 3)]} + :runner {:deck [(qty "Self-modifying Code" 3) "Reaver"]}}) (starting-hand state :runner ["Self-modifying Code" "Self-modifying Code"]) (play-from-hand state :corp "Signal Jamming" "HQ") (take-credits state :corp) @@ -1669,8 +1617,7 @@ ;; Strongbox (testing "Basic test" (do-game - (new-game (default-corp ["Strongbox" "House of Knives"]) - (default-runner)) + (new-game {:corp {:deck ["Strongbox" "House of Knives"]}}) (play-from-hand state :corp "Strongbox" "New remote") (play-from-hand state :corp "House of Knives" "Server 1") (take-credits state :corp 1) @@ -1693,8 +1640,7 @@ (is (= 1 (count (:scored (get-runner)))) "1 scored agenda")))) (testing "Click cost even when trashed" (do-game - (new-game (default-corp [(qty "Strongbox" 3) (qty "House of Knives" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Strongbox" 3) (qty "House of Knives" 3)]}}) (play-from-hand state :corp "Strongbox" "New remote") (play-from-hand state :corp "House of Knives" "Server 1") (take-credits state :corp 1) @@ -1713,9 +1659,8 @@ (deftest surat-city-grid ;; Surat City Grid - Trigger on rez of a card in/protecting same server to rez another card at 2c discount (do-game - (new-game (default-corp [(qty "Surat City Grid" 2) (qty "Cyberdex Virus Suite" 2) - "Enigma" "Wraparound"]) - (default-runner)) + (new-game {:corp {:deck [(qty "Surat City Grid" 2) (qty "Cyberdex Virus Suite" 2) + "Enigma" "Wraparound"]}}) (core/gain state :corp :credit 15 :click 8) (play-from-hand state :corp "Surat City Grid" "New remote") (play-from-hand state :corp "Wraparound" "Server 1") @@ -1747,8 +1692,8 @@ (deftest tempus ;; Tempus - Trace^3, the runner chooses to lose 2 clicks or take 1 brain damage (do-game - (new-game (default-corp [(qty "Tempus" 3)]) - (default-runner [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Tempus" 3)]} + :runner {:deck [(qty "Sure Gamble" 3)]}}) (starting-hand state :corp ["Tempus"]) (play-from-hand state :corp "Tempus" "New remote") (take-credits state :corp) @@ -1790,8 +1735,8 @@ (deftest the-twins ;; The Twins (do-game - (new-game (default-corp ["The Twins" (qty "Ice Wall" 10)]) - (default-runner ["Corroder"])) + (new-game {:corp {:deck ["The Twins" (qty "Ice Wall" 10)]} + :runner {:deck ["Corroder"]}}) (starting-hand state :corp ["The Twins" "Ice Wall" "Ice Wall"]) (play-from-hand state :corp "The Twins" "New remote") (play-from-hand state :corp "Ice Wall" "Server 1") @@ -1814,8 +1759,8 @@ ;; Tori Hanzō - Pay to do 1 brain damage instead of net damage (testing "Basic test" (do-game - (new-game (default-corp ["Pup" "Tori Hanzō"]) - (default-runner [(qty "Sure Gamble" 3) "Net Shield"])) + (new-game {:corp {:deck ["Pup" "Tori Hanzō"]} + :runner {:deck [(qty "Sure Gamble" 3) "Net Shield"]}}) (core/gain state :corp :credit 10) (play-from-hand state :corp "Pup" "HQ") (play-from-hand state :corp "Tori Hanzō" "HQ") @@ -1843,8 +1788,7 @@ (is (= 1 (:brain-damage (get-runner))))))) (testing "with Hokusai Grid: Issue #2702" (do-game - (new-game (default-corp ["Tori Hanzō" "Hokusai Grid"]) - (default-runner)) + (new-game {:corp {:deck ["Tori Hanzō" "Hokusai Grid"]}}) (core/gain state :corp :credit 5) (play-from-hand state :corp "Hokusai Grid" "Archives") (play-from-hand state :corp "Tori Hanzō" "Archives") @@ -1873,8 +1817,7 @@ (is (and (empty (:prompt (get-runner))) (not (:run @state))) "No prompts, run ended")))) (testing "breaking subsequent net damage: Issue #3176" (do-game - (new-game (default-corp ["Tori Hanzō" (qty "Pup" 2) (qty "Neural EMP" 2)]) - (default-runner)) + (new-game {:corp {:deck ["Tori Hanzō" (qty "Pup" 2) (qty "Neural EMP" 2)]}}) (core/gain state :corp :credit 8) (play-from-hand state :corp "Tori Hanzō" "New remote") (play-from-hand state :corp "Pup" "Server 1") @@ -1896,9 +1839,9 @@ (deftest underway-grid ;; Underway Grid - prevent expose of cards in server (do-game - (new-game (default-corp ["Eve Campaign" - "Underway Grid"]) - (default-runner ["Drive By"])) + (new-game {:corp {:deck ["Eve Campaign" + "Underway Grid"]} + :runner {:deck ["Drive By"]}}) (play-from-hand state :corp "Underway Grid" "New remote") (play-from-hand state :corp "Eve Campaign" "Server 1") (take-credits state :corp) @@ -1912,8 +1855,7 @@ ;; Valley Grid (testing "Reduce Runner max hand size and restore it even if trashed" (do-game - (new-game (default-corp [(qty "Valley Grid" 3) (qty "Ice Wall" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Valley Grid" 3) (qty "Ice Wall" 3)]}}) (play-from-hand state :corp "Valley Grid" "New remote") (take-credits state :corp 2) (run-on state "Server 1") @@ -1932,8 +1874,8 @@ ;; Warroid Tracker (testing "Trashing Warroid starts trace" (do-game - (new-game (default-corp ["Warroid Tracker"]) - (default-runner ["Corroder" "Dyson Mem Chip"])) + (new-game {:corp {:deck ["Warroid Tracker"]} + :runner {:deck ["Corroder" "Dyson Mem Chip"]}}) (play-from-hand state :corp "Warroid Tracker" "New remote") (take-credits state :corp) (core/gain state :runner :credit 10) @@ -1954,8 +1896,8 @@ (testing "Trashing from central triggers Warroid in root" ;; Regression test for #3725 (do-game - (new-game (default-corp ["Warroid Tracker" (qty "Hedge Fund" 3)]) - (default-runner ["Clan Vengeance" "Corroder" "Dyson Mem Chip"])) + (new-game {:corp {:deck ["Warroid Tracker" (qty "Hedge Fund" 3)]} + :runner {:deck ["Clan Vengeance" "Corroder" "Dyson Mem Chip"]}}) (play-from-hand state :corp "Warroid Tracker" "HQ") (take-credits state :corp) (core/gain state :runner :credit 10) diff --git a/test/clj/game_test/core.clj b/test/clj/game_test/core.clj index 60b0a0ffb2..2afc9a8a10 100644 --- a/test/clj/game_test/core.clj +++ b/test/clj/game_test/core.clj @@ -2,65 +2,158 @@ (:require [game.core :as core] [game.utils :as utils :refer [make-cid]] [jinteki.cards :refer [all-cards]] - [game-test.utils :refer [load-cards]] + [hawk.core :as hawk] [clojure.test :refer :all])) +;; Card information and definitions +(defn load-cards [] + (->> (clojure.java.io/file "data/cards") + file-seq + (filter #(.isFile %)) + (map slurp) + (map read-string) + merge)) + +(defn load-all-cards [] + (when (empty? @all-cards) + (->> (load-cards) + (map #(assoc % :cid (make-cid))) + (map (juxt :title identity)) + (into {}) + (reset! all-cards)) + (core/reset-card-defs))) +(load-all-cards) + +(hawk/watch! [{:paths ["src/clj/game/cards"] + :filter hawk/file? + :handler (fn [ctx e] + (load-file (-> e :file str)))}]) + +;; General utilities necessary for starting a new game +(defn find-card + "Return a card with given title from given sequence" + [title from] + (some #(when (= (:title %) title) %) from)) + +(defn starting-hand + "Moves all cards in the player's hand to their draw pile, then moves the specified card names + back into the player's hand." + [state side cards] + (doseq [c (get-in @state [side :hand])] + (core/move state side c :deck)) + (doseq [ctitle cards] + (core/move state side (find-card ctitle (get-in @state [side :deck])) :hand))) -;;; Click action functions (defn take-credits "Take credits for n clicks, or if no n given, for all remaining clicks of a side. If all clicks are used up, end turn and start the opponent's turn." ([state side] (take-credits state side nil)) ([state side n] - (let [remaining-clicks (get-in @state [side :click]) - n (or n remaining-clicks) - other (if (= side :corp) :runner :corp)] - (dotimes [i n] (core/click-credit state side nil)) - (if (= (get-in @state [side :click]) 0) - (do (core/end-turn state side nil) - (core/start-turn state other nil)))))) - -(defn new-game + (let [remaining-clicks (get-in @state [side :click]) + n (or n remaining-clicks) + other (if (= side :corp) :runner :corp)] + (dotimes [i n] (core/click-credit state side nil)) + (if (= (get-in @state [side :click]) 0) + (do (core/end-turn state side nil) + (core/start-turn state other nil)))))) + + +;; Deck construction helpers +(defn qty [card amt] + (when (pos? amt) + (repeat amt card))) + +(defn card-vec->card-map + [[card amt]] + (let [loaded-card (if (string? card) (@all-cards card) card)] + (when-not loaded-card + (throw (Exception. (str card " not found in @all-cards")))) + {:card loaded-card + :qty amt})) + +(defn transform + [cards] + (->> cards + flatten + (filter string?) + frequencies + (map card-vec->card-map) + seq)) + +(defn make-decks + [{:keys [corp runner options]}] + {:corp {:deck (or (transform (conj (:deck corp) + (:hand corp) + (:discard corp))) + (transform (qty "Hedge Fund" 3))) + :hand (flatten (:hand corp)) + :discard (flatten (:discard corp)) + :identity (@all-cards + (or (:id corp) + "Custom Biotics: Engineered for Success")) + :credits (:credits corp)} + :runner {:deck (or (transform (conj (:deck runner) + (:hand runner) + (:discard runner))) + (transform (qty "Sure Gamble" 3))) + :hand (flatten (:hand runner)) + :discard (flatten (:discard runner)) + :identity (@all-cards + (or (:id runner) + "The Professor: Keeper of Knowledge")) + :credits (:credits runner)} + :mulligan (:mulligan options) + :start-as (:start-as options) + :dont-start-turn (:dont-start-turn options) + :dont-start-game (:dont-start-game options)}) + +(defn- new-game-internal "Init a new game using given corp and runner. Keep starting hands (no mulligan) and start Corp's turn." - ([corp runner] (new-game corp runner nil)) - ([corp runner {:keys [mulligan start-as dont-start-turn dont-start-game] :as args}] - (let [state (core/init-game - {:gameid 1 - :players [{:side "Corp" - :deck {:identity (@all-cards (:identity corp)) - :cards (:deck corp)}} - {:side "Runner" - :deck {:identity (@all-cards (:identity runner)) - :cards (:deck runner)}}]})] - (when-not dont-start-game - (if (#{:both :corp} mulligan) - (core/resolve-prompt state :corp {:choice "Mulligan"}) - (core/resolve-prompt state :corp {:choice "Keep"})) - (if (#{:both :runner} mulligan) - (core/resolve-prompt state :runner {:choice "Mulligan"}) - (core/resolve-prompt state :runner {:choice "Keep"})) - (when-not dont-start-turn (core/start-turn state :corp nil)) - (when (= start-as :runner) (take-credits state :corp))) - state))) - -(defn load-all-cards [tests] - (when (empty? @all-cards) - (core/reset-card-defs) - (reset! all-cards (into {} (map (juxt :title identity) (map #(assoc % :cid (make-cid)) (load-cards)))))) - (tests)) -(use-fixtures :once load-all-cards) - -(defn reset-card-defs [card-type tests] - (core/reset-card-defs card-type) - (tests)) + [{:keys [corp runner mulligan start-as dont-start-turn dont-start-game] :as players}] + (let [state (core/init-game + {:gameid 1 + :players [{:side "Corp" + :user "player1" + :deck {:identity (:identity corp) + :cards (:deck corp)}} + {:side "Runner" + :user "player2" + :deck {:identity (:identity runner) + :cards (:deck runner)}}]})] + (when-not dont-start-game + (if (#{:both :corp} mulligan) + (core/resolve-prompt state :corp {:choice "Mulligan"}) + (core/resolve-prompt state :corp {:choice "Keep"})) + (if (#{:both :runner} mulligan) + (core/resolve-prompt state :runner {:choice "Mulligan"}) + (core/resolve-prompt state :runner {:choice "Keep"})) + (when-not dont-start-turn (core/start-turn state :corp nil)) + (when (= start-as :runner) (take-credits state :corp))) + ;; Gotta move cards where they need to go + (doseq [side [:corp :runner]] + (let [side-map (if (= :corp side) corp runner)] + (when-let [hand (seq (:hand side-map))] + (starting-hand state side hand)) + (when (seq (:discard side-map)) + (doseq [card (:discard side-map)] + (core/move state side + (find-card (:card card) (get-in @state [side :deck])) :discard))) + (when (:credits side-map) + (swap! state assoc-in [side :credit] (:credits side-map))))) + ;; These are side independent so they happen ouside the loop + (when (:bad-pub corp) + (swap! state assoc-in [:corp :bad-publicity] (:bad-pub corp))) + (when (:tags runner) + (swap! state assoc-in [:runner :tag] (:tags runner))) + state)) +(defn new-game + "A small wrapper so we can unpack in the parameters and not in a let" + ([] (new-game-internal (make-decks nil))) + ([players] + (new-game-internal (make-decks players)))) ;;; Card related functions -(defn find-card - "Return a card with given title from given sequence" - [title from] - (some #(when (= (:title %) title) %) from)) - (defn card-ability "Trigger a card's ability with its 0-based index. Refreshes the card argument before triggering the ability." @@ -85,8 +178,8 @@ :ability ability :targets targets}] (if (= :corp side) - (core/play-corp-ability state side ab) - (core/play-runner-ability state side ab))))) + (core/play-corp-ability state side ab) + (core/play-runner-ability state side ab))))) (defn get-ice "Get installed ice protecting server by position. If no pos, get all ice on the server." @@ -247,15 +340,6 @@ [state title] (core/trash state :runner (find-card title (get-in @state [:runner :rig :resource])))) -(defn starting-hand - "Moves all cards in the player's hand to their draw pile, then moves the specified card names - back into the player's hand." - [state side cards] - (doseq [c (get-in @state [side :hand])] - (core/move state side c :deck)) - (doseq [ctitle cards] - (core/move state side (find-card ctitle (get-in @state [side :deck])) :hand))) - (defn accessing "Checks to see if the runner has a prompt accessing the given card title" [state title] diff --git a/test/clj/game_test/rules.clj b/test/clj/game_test/engine/rules.clj similarity index 71% rename from test/clj/game_test/rules.clj rename to test/clj/game_test/engine/rules.clj index b616028a42..920c8c2b5b 100644 --- a/test/clj/game_test/rules.clj +++ b/test/clj/game_test/engine/rules.clj @@ -1,16 +1,13 @@ -(ns game-test.rules +(ns game-test.engine.rules (:require [game.core :as core] [game-test.core :refer :all] [game-test.utils :refer :all] [game-test.macros :refer :all] [clojure.test :refer :all])) -(use-fixtures :once load-all-cards (partial reset-card-defs nil)) - (deftest undo-turn (do-game - (new-game (default-corp) - (default-runner)) + (new-game) (play-from-hand state :corp "Hedge Fund") (play-from-hand state :corp "Hedge Fund") (is (= 1 (:click (get-corp))) "Corp spent 2 clicks") @@ -24,8 +21,8 @@ (deftest undo-click (do-game - (new-game (default-corp ["Ikawah Project"]) - (default-runner ["Day Job"])) + (new-game {:corp {:deck ["Ikawah Project"]} + :runner {:deck ["Day Job"]}}) (play-from-hand state :corp "Ikawah Project" "New remote") (take-credits state :corp) (is (= 5 (:credit (get-runner))) "Runner has 5 credits") @@ -52,8 +49,7 @@ (deftest corp-rez-unique ;; Rezzing a second copy of a unique Corp card (do-game - (new-game (default-corp [(qty "Caprice Nisei" 2)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Caprice Nisei" 2)]}}) (play-from-hand state :corp "Caprice Nisei" "HQ") (play-from-hand state :corp "Caprice Nisei" "R&D") (core/rez state :corp (get-content state :hq 0)) @@ -64,8 +60,7 @@ (deftest runner-install-program ;; runner-install - Program; ensure costs are paid (do-game - (new-game (default-corp) - (default-runner ["Gordian Blade"])) + (new-game {:runner {:deck ["Gordian Blade"]}}) (take-credits state :corp) (play-from-hand state :runner "Gordian Blade") (let [gord (get-program state 0)] @@ -75,9 +70,8 @@ (deftest runner-installing-uniques ;; Installing a copy of an active unique Runner card is prevented (do-game - (new-game (default-corp) - (default-runner [(qty "Kati Jones" 2) (qty "Scheherazade" 2) - "Off-Campus Apartment" (qty "Hivemind" 2)])) + (new-game {:runner {:deck [(qty "Kati Jones" 2) (qty "Scheherazade" 2) + "Off-Campus Apartment" (qty "Hivemind" 2)]}}) (take-credits state :corp) (core/gain state :runner :click 1 :memory 2) (core/draw state :runner 2) @@ -106,8 +100,7 @@ (deftest deactivate-program ;; deactivate - Program; ensure MU are restored (do-game - (new-game (default-corp) - (default-runner ["Gordian Blade"])) + (new-game {:runner {:deck ["Gordian Blade"]}}) (take-credits state :corp) (play-from-hand state :runner "Gordian Blade") (let [gord (get-program state 0)] @@ -117,8 +110,8 @@ (deftest agenda-forfeit-runner ;; forfeit - Don't deactivate agenda to trigger leave play effects if Runner forfeits a stolen agenda (do-game - (new-game (default-corp ["Mandatory Upgrades"]) - (default-runner ["Data Dealer"])) + (new-game {:corp {:deck ["Mandatory Upgrades"]} + :runner {:deck ["Data Dealer"]}}) (take-credits state :corp) (play-from-hand state :runner "Data Dealer") (run-empty-server state "HQ") @@ -132,8 +125,7 @@ (deftest agenda-forfeit-corp ;; forfeit - Deactivate agenda to trigger leave play effects if Corp forfeits a scored agenda (do-game - (new-game (default-corp ["Mandatory Upgrades" "Corporate Town"]) - (default-runner)) + (new-game {:corp {:deck ["Mandatory Upgrades" "Corporate Town"]}}) (play-from-hand state :corp "Mandatory Upgrades" "New remote") (score-agenda state :corp (get-content state :remote1 0)) (is (= 4 (:click-per-turn (get-corp))) "Up to 4 clicks per turn") @@ -146,8 +138,8 @@ (deftest refresh-recurring-credits-hosted ;; host - Recurring credits on cards hosted after install refresh properly (do-game - (new-game (default-corp [(qty "Ice Wall" 3) (qty "Hedge Fund" 3)]) - (default-runner ["Compromised Employee" "Off-Campus Apartment"])) + (new-game {:corp {:deck [(qty "Ice Wall" 3) (qty "Hedge Fund" 3)]} + :runner {:deck ["Compromised Employee" "Off-Campus Apartment"]}}) (play-from-hand state :corp "Ice Wall" "HQ") (take-credits state :corp 2) (play-from-hand state :runner "Off-Campus Apartment") @@ -155,8 +147,7 @@ (let [iwall (get-ice state :hq 0) apt (get-resource state 0)] (card-ability state :runner apt 1) ; use Off-Campus option to host an installed card - (click-card state :runner (find-card "Compromised Employee" - (get-resource state))) + (click-card state :runner (find-card "Compromised Employee" (get-resource state))) (let [cehosted (first (:hosted (refresh apt)))] (card-ability state :runner cehosted 0) ; take Comp Empl credit (is (= 4 (:credit (get-runner)))) @@ -171,11 +162,8 @@ (deftest card-str-test-simple ;; ensure card-str names cards in simple situations properly (do-game - (new-game (default-corp [(qty "Ice Wall" 3) (qty "Jackson Howard" 2)]) - (default-runner ["Corroder" - "Clone Chip" - "Paparazzi" - "Parasite"])) + (new-game {:corp {:deck [(qty "Ice Wall" 3) (qty "Jackson Howard" 2)]} + :runner {:deck ["Corroder" "Clone Chip" "Paparazzi" "Parasite"]}}) (core/gain state :corp :click 2) (play-from-hand state :corp "Ice Wall" "HQ") (play-from-hand state :corp "Ice Wall" "R&D") @@ -215,8 +203,7 @@ (deftest invalid-score-attempt ;; Test scoring with an incorrect number of advancement tokens (do-game - (new-game (default-corp ["Ancestral Imager"]) - (default-runner)) + (new-game {:corp {:deck ["Ancestral Imager"]}}) (play-from-hand state :corp "Ancestral Imager" "New remote") (let [ai (get-content state :remote1 0)] ;; Trying to score without any tokens does not do anything @@ -229,8 +216,7 @@ (deftest trash-corp-hosted ;; Hosted Corp cards are included in all-installed and fire leave-play effects when trashed (do-game - (new-game (default-corp ["Full Immersion RecStudio" "Worlds Plaza" "Director Haas"]) - (default-runner)) + (new-game {:corp {:deck ["Full Immersion RecStudio" "Worlds Plaza" "Director Haas"]}}) (play-from-hand state :corp "Full Immersion RecStudio" "New remote") (let [fir (get-content state :remote1 0)] (core/rez state :corp fir) @@ -255,8 +241,8 @@ (deftest trash-remove-per-turn-restriction ;; Trashing a card should remove it from [:per-turn] - Issue #1345 (do-game - (new-game (default-corp [(qty "Hedge Fund" 3)]) - (default-runner [(qty "Imp" 2) "Scavenge"])) + (new-game {:corp {:deck [(qty "Hedge Fund" 3)]} + :runner {:deck [(qty "Imp" 2) "Scavenge"]}}) (take-credits state :corp) (core/gain state :runner :click 1) (play-from-hand state :runner "Imp") @@ -279,8 +265,7 @@ (deftest trash-seen-and-unseen ;; Trash installed assets that are both seen and unseen by runner (do-game - (new-game (default-corp [(qty "PAD Campaign" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "PAD Campaign" 3)]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (play-from-hand state :corp "PAD Campaign" "New remote") (take-credits state :corp 1) @@ -301,8 +286,7 @@ (deftest reinstall-seen-asset ;; Install a faceup card in Archives, make sure it is not :seen (do-game - (new-game (default-corp ["PAD Campaign" "Interns"]) - (default-runner)) + (new-game {:corp {:deck ["PAD Campaign" "Interns"]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (take-credits state :corp 2) ;; run and trash the asset @@ -318,8 +302,8 @@ (deftest all-installed-runner-test ;; Tests all-installed for programs hosted on ICE, nested hosted programs, and non-installed hosted programs (do-game - (new-game (default-corp ["Wraparound"]) - (default-runner ["Omni-drive" "Personal Workshop" "Leprechaun" "Corroder" "Mimic" "Knight"])) + (new-game {:corp {:deck ["Wraparound"]} + :runner {:deck ["Omni-drive" "Personal Workshop" "Leprechaun" "Corroder" "Mimic" "Knight"]}}) (play-from-hand state :corp "Wraparound" "HQ") (let [wrap (get-ice state :hq 0)] (core/rez state :corp wrap) @@ -358,9 +342,7 @@ (deftest log-accessed-names ;; Check that accessed card names are logged - except those on R&D, and no logs on archives (do-game - (new-game - (default-corp [(qty "PAD Campaign" 7)]) - (default-runner)) + (new-game {:corp {:deck [(qty "PAD Campaign" 7)]}}) (play-from-hand state :corp "PAD Campaign" "New remote") (trash-from-hand state :corp "PAD Campaign") (take-credits state :corp) @@ -376,10 +358,9 @@ (deftest counter-manipulation-commands ;; Test interactions of various cards with /counter and /adv-counter commands (do-game - (new-game (default-corp ["Adonis Campaign" + (new-game {:corp {:deck ["Adonis Campaign" (qty "Public Support" 2) - "Oaktown Renovation"]) - (default-runner)) + "Oaktown Renovation"]}}) ;; Turn 1 Corp, install oaktown and assets (core/gain state :corp :click 4) (play-from-hand state :corp "Adonis Campaign" "New remote") @@ -390,77 +371,76 @@ publics1 (get-content state :remote2 0) publics2 (get-content state :remote3 0) oaktown (get-content state :remote4 0)] - (core/advance state :corp {:card (refresh oaktown)}) - (core/advance state :corp {:card (refresh oaktown)}) - (core/advance state :corp {:card (refresh oaktown)}) - (is (= 8 (:credit (get-corp))) "Corp 5+3 creds from Oaktown") - (core/end-turn state :corp nil) - (testing "Turn 1 Runner" - (core/start-turn state :runner nil) - (take-credits state :runner 3) - (core/click-credit state :runner nil) - (core/end-turn state :runner nil) - (core/rez state :corp (refresh adonis)) - (core/rez state :corp (refresh publics1))) - (testing "Turn 2 Corp" - (core/start-turn state :corp nil) - (core/rez state :corp (refresh publics2)) - (is (= 3 (:click (get-corp)))) - (is (= 3 (:credit (get-corp))) "only Adonis money") - (is (= 9 (get-counters (refresh adonis) :credit))) - (is (= 2 (get-counters (refresh publics1) :power))) - (is (= 3 (get-counters (refresh publics2) :power)))) - ;; oops, forgot to rez 2nd public support before start of turn, - ;; let me fix it with a /command - (testing "Advancement and Scoring checks" - (core/command-counter state :corp ["power" 2]) - (click-card state :corp (refresh publics2)) - (is (= 2 (get-counters (refresh publics2) :power))) - ;; Oaktown checks and manipulation - (is (= 3 (get-counters (refresh oaktown) :advancement))) - (core/command-adv-counter state :corp 2) - (click-card state :corp (refresh oaktown)) - ;; score should fail, shouldn't be able to score with 2 advancement tokens - (core/score state :corp (refresh oaktown)) - (is (zero? (:agenda-point (get-corp)))) - (core/command-adv-counter state :corp 4) - (click-card state :corp (refresh oaktown)) - (is (= 4 (get-counters (refresh oaktown) :advancement))) - (is (= 3 (:credit (get-corp)))) - (is (= 3 (:click (get-corp)))) - (core/score state :corp (refresh oaktown)) ; now the score should go through - (is (= 2 (:agenda-point (get-corp)))) - (take-credits state :corp)) - (testing "Modifying publics1 and adonis for brevity" - (is (= 2 (get-counters (refresh publics1) :power))) - (core/command-counter state :corp ["power" 1]) - (click-card state :corp (refresh publics1)) - (is (= 1 (get-counters (refresh publics1) :power))) - ;; let's adjust Adonis while at it - (is (= 9 (get-counters (refresh adonis) :credit))) - (core/command-counter state :corp ["credit" 3]) - (click-card state :corp (refresh adonis)) - (is (= 3 (get-counters (refresh adonis) :credit)))) - (testing "Turn 2 Runner" - (take-credits state :runner)) - (testing "Turn 3 Corp" - (is (= 3 (:agenda-point (get-corp)))) ; cheated PS1 should get scored - (is (= 9 (:credit (get-corp)))) - ; (is (= :scored (:zone (refresh publics1)))) - (is (= [:servers :remote3 :content] (:zone (refresh publics2)))) - ; (is (= :discard (:zone (refresh adonis)))) - (take-credits state :corp)) - (testing "Turn 3 Runner" - (take-credits state :runner)) - (testing "Turn 4 Corp" - (is (= 4 (:agenda-point (get-corp)))) ; PS2 should get scored - (is (= 12 (:credit (get-corp)))))))) + (core/advance state :corp {:card (refresh oaktown)}) + (core/advance state :corp {:card (refresh oaktown)}) + (core/advance state :corp {:card (refresh oaktown)}) + (is (= 8 (:credit (get-corp))) "Corp 5+3 creds from Oaktown") + (core/end-turn state :corp nil) + (testing "Turn 1 Runner" + (core/start-turn state :runner nil) + (take-credits state :runner 3) + (core/click-credit state :runner nil) + (core/end-turn state :runner nil) + (core/rez state :corp (refresh adonis)) + (core/rez state :corp (refresh publics1))) + (testing "Turn 2 Corp" + (core/start-turn state :corp nil) + (core/rez state :corp (refresh publics2)) + (is (= 3 (:click (get-corp)))) + (is (= 3 (:credit (get-corp))) "only Adonis money") + (is (= 9 (get-counters (refresh adonis) :credit))) + (is (= 2 (get-counters (refresh publics1) :power))) + (is (= 3 (get-counters (refresh publics2) :power)))) + ;; oops, forgot to rez 2nd public support before start of turn, + ;; let me fix it with a /command + (testing "Advancement and Scoring checks" + (core/command-counter state :corp ["power" 2]) + (click-card state :corp (refresh publics2)) + (is (= 2 (get-counters (refresh publics2) :power))) + ;; Oaktown checks and manipulation + (is (= 3 (get-counters (refresh oaktown) :advancement))) + (core/command-adv-counter state :corp 2) + (click-card state :corp (refresh oaktown)) + ;; score should fail, shouldn't be able to score with 2 advancement tokens + (core/score state :corp (refresh oaktown)) + (is (zero? (:agenda-point (get-corp)))) + (core/command-adv-counter state :corp 4) + (click-card state :corp (refresh oaktown)) + (is (= 4 (get-counters (refresh oaktown) :advancement))) + (is (= 3 (:credit (get-corp)))) + (is (= 3 (:click (get-corp)))) + (core/score state :corp (refresh oaktown)) ; now the score should go through + (is (= 2 (:agenda-point (get-corp)))) + (take-credits state :corp)) + (testing "Modifying publics1 and adonis for brevity" + (is (= 2 (get-counters (refresh publics1) :power))) + (core/command-counter state :corp ["power" 1]) + (click-card state :corp (refresh publics1)) + (is (= 1 (get-counters (refresh publics1) :power))) + ;; let's adjust Adonis while at it + (is (= 9 (get-counters (refresh adonis) :credit))) + (core/command-counter state :corp ["credit" 3]) + (click-card state :corp (refresh adonis)) + (is (= 3 (get-counters (refresh adonis) :credit)))) + (testing "Turn 2 Runner" + (take-credits state :runner)) + (testing "Turn 3 Corp" + (is (= 3 (:agenda-point (get-corp)))) ; cheated PS1 should get scored + (is (= 9 (:credit (get-corp)))) + ; (is (= :scored (:zone (refresh publics1)))) + (is (= [:servers :remote3 :content] (:zone (refresh publics2)))) + ; (is (= :discard (:zone (refresh adonis)))) + (take-credits state :corp)) + (testing "Turn 3 Runner" + (take-credits state :runner)) + (testing "Turn 4 Corp" + (is (= 4 (:agenda-point (get-corp)))) ; PS2 should get scored + (is (= 12 (:credit (get-corp)))))))) (deftest counter-manipulation-commands-smart ;; Test interactions of smart counter advancement command (do-game - (new-game (default-corp ["House of Knives"]) - (default-runner)) + (new-game {:corp {:deck ["House of Knives"]}}) (play-from-hand state :corp "House of Knives" "New remote") (let [hok (get-content state :remote1 0)] (core/command-counter state :corp [3]) @@ -482,8 +462,9 @@ (deftest run-bad-publicity-credits ;; Should not lose BP credits until a run is completely over. Issue #1721. (do-game - (new-game (default-corp [(qty "Cyberdex Virus Suite" 3)]) - (make-deck "Valencia Estevez: The Angel of Cayambe" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Cyberdex Virus Suite" 3)]} + :runner {:id "Valencia Estevez: The Angel of Cayambe" + :deck [(qty "Sure Gamble" 3)]}}) (is (= 1 (:bad-publicity (get-corp))) "Corp starts with 1 BP") (play-from-hand state :corp "Cyberdex Virus Suite" "New remote") (play-from-hand state :corp "Cyberdex Virus Suite" "R&D") @@ -505,8 +486,9 @@ (deftest run-psi-bad-publicity-credits ;; Should pay from Bad Pub for Psi games during run #2374 (do-game - (new-game (default-corp [(qty "Caprice Nisei" 3)]) - (make-deck "Valencia Estevez: The Angel of Cayambe" [(qty "Sure Gamble" 3)])) + (new-game {:corp {:deck [(qty "Caprice Nisei" 3)]} + :runner {:id "Valencia Estevez: The Angel of Cayambe" + :deck [(qty "Sure Gamble" 3)]}}) (is (= 1 (:bad-publicity (get-corp))) "Corp starts with 1 BP") (play-from-hand state :corp "Caprice Nisei" "New remote") (take-credits state :corp) @@ -523,8 +505,8 @@ (deftest purge-nested ;; Purge nested-hosted virus counters (do-game - (new-game (default-corp ["Cyberdex Trial"]) - (default-runner ["Djinn" "Imp" "Leprechaun"])) + (new-game {:corp {:deck ["Cyberdex Trial"]} + :runner {:deck ["Djinn" "Imp" "Leprechaun"]}}) (take-credits state :corp) (core/gain state :runner :credit 100) (play-from-hand state :runner "Leprechaun") @@ -543,10 +525,10 @@ (deftest multi-access-rd ;; multi-access of R&D sees all cards and upgrades (do-game - (new-game (default-corp ["Keegan Lane" "Midway Station Grid" + (new-game {:corp {:deck ["Keegan Lane" "Midway Station Grid" "Sweeps Week" "Manhunt" - "Hedge Fund" "Big Brother"]) - (default-runner ["Medium"])) + "Hedge Fund" "Big Brother"]} + :runner {:deck ["Medium"]}}) (play-from-hand state :corp "Keegan Lane" "R&D") (play-from-hand state :corp "Midway Station Grid" "R&D") (core/move state :corp (find-card "Hedge Fund" (:hand (get-corp))) :deck) @@ -583,8 +565,7 @@ (deftest multi-steal-archives ;; stealing multiple agendas from archives (do-game - (new-game (default-corp [(qty "Breaking News" 3)]) - (default-runner)) + (new-game {:corp {:deck [(qty "Breaking News" 3)]}}) (trash-from-hand state :corp "Breaking News") (trash-from-hand state :corp "Breaking News") (trash-from-hand state :corp "Breaking News") @@ -598,3 +579,84 @@ (click-prompt state :runner "Steal") (is (= 3 (count (:scored (get-runner)))) "3 agendas stolen") (is (empty (:discard (get-corp))) "0 agendas left in archives"))) + +(deftest virus-counter-flags + (testing "Set counter flag when virus card enters play with counters" + (do-game + (new-game {:runner {:deck ["Surge" "Imp" "Crypsis"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Imp") + (let [imp (get-program state 0)] + (is (get-in imp [:added-virus-counter]) "Counter flag was set on Imp")))) + (testing "Set counter flag when add-prop is called on a virus" + (do-game + (new-game {:runner {:deck ["Crypsis"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Crypsis") + (let [crypsis (get-program state 0)] + (card-ability state :runner crypsis 2) ;click to add a virus counter + (is (= 1 (get-counters (refresh crypsis) :virus)) "Crypsis added a virus token") + (is (get-in (refresh crypsis) [:added-virus-counter]) + "Counter flag was set on Crypsis")))) + (testing "Clear the virus counter flag at the end of each turn" + (do-game + (new-game {:runner {:deck ["Crypsis"]}}) + (take-credits state :corp) + (play-from-hand state :runner "Crypsis") + (let [crypsis (get-program state 0)] + (card-ability state :runner crypsis 2) ; click to add a virus counter + (take-credits state :runner 2) + (take-credits state :corp 1) + (is (not (get-in (refresh crypsis) [:added-virus-counter])) + "Counter flag was cleared on Crypsis"))))) + +(deftest end-the-run-test + ;; Since all ETR ice share a common ability, we only need one test + (do-game + (new-game {:corp {:deck [(qty "Ice Wall" 3) + (qty "Hedge Fund" 3) + (qty "Restructure" 2)]}}) + (play-from-hand state :corp "Ice Wall" "HQ") + (take-credits state :corp 2) + (run-on state "HQ") + (is (= [:hq] (get-in @state [:run :server]))) + (let [iwall (get-ice state :hq 0)] + (core/rez state :corp iwall) + (card-subroutine state :corp iwall 0) + (is (not (:run @state)) "Run is ended") + (is (get-in @state [:runner :register :unsuccessful-run]) "Run was unsuccessful")))) + +(deftest auto-pump-breakers + ;; Breaker get a dynamic ability that matches the strength of the encountered ice + (testing "Single pump" + (do-game + (new-game {:corp {:deck ["Masvingo"]} + :runner {:deck ["Laamb"]}}) + (play-from-hand state :corp "Masvingo" "HQ") + (core/rez state :corp (get-ice state :hq 0)) + (take-credits state :corp) + (core/gain state :runner :credit 5) + (play-from-hand state :runner "Laamb") + (run-on state "HQ") + (let [laamb (get-program state 0)] + (is (= 2 (:current-strength (refresh laamb))) "Laamb starts at 2 strength") + (is (= 6 (:credit (get-runner))) "Spent 4 to install") + (core/play-dynamic-ability state :runner {:dynamic "auto-pump" :card (refresh laamb)}) + (is (= 8 (:current-strength (refresh laamb))) "Laamb is at 8 strength") + (is (= 3 (:credit (get-runner))) "Spent 3 to pump")))) + (testing "Multi pump" + (do-game + (new-game {:corp {:deck ["Masvingo"]} + :runner {:deck ["Ankusa"]}}) + (play-from-hand state :corp "Masvingo" "HQ") + (core/rez state :corp (get-ice state :hq 0)) + (take-credits state :corp) + (core/gain state :runner :credit 5) + (play-from-hand state :runner "Ankusa") + (run-on state "HQ") + (let [ank (get-program state 0)] + (is (zero? (:current-strength (refresh ank))) "Ankusa starts at 1 strength") + (is (= 4 (:credit (get-runner))) "Spent 6 to install") + (core/play-dynamic-ability state :runner {:dynamic "auto-pump" :card (refresh ank)}) + (is (= 3 (:current-strength (refresh ank))) "Ankusa is at 3 strength") + (is (= 1 (:credit (get-runner))) "Spent 3 to pump"))))) diff --git a/test/clj/game_test/games/scenarios.clj b/test/clj/game_test/engine/scenarios.clj similarity index 88% rename from test/clj/game_test/games/scenarios.clj rename to test/clj/game_test/engine/scenarios.clj index b580087655..3815565150 100644 --- a/test/clj/game_test/games/scenarios.clj +++ b/test/clj/game_test/engine/scenarios.clj @@ -1,4 +1,4 @@ -(ns game-test.games.scenarios +(ns game-test.engine.scenarios (:require [game.core :as core] [game-test.core :refer :all] [game-test.utils :refer :all] @@ -6,15 +6,12 @@ [jinteki.utils :refer [count-tags]] [clojure.test :refer :all])) -(use-fixtures :once load-all-cards (partial reset-card-defs nil)) - (deftest minigame-prevent-netdmg-resourcetrash (testing "Mini-game testing prevention of net damage and resource trashing, with hosted Fall Guy" (do-game - (new-game - (default-corp ["Neural EMP" (qty "Hedge Fund" 3) "SEA Source"]) - (default-runner ["Fall Guy" "Off-Campus Apartment" "Net Shield" - "Wireless Net Pavilion" "Sure Gamble"])) + (new-game {:corp {:deck ["Neural EMP" (qty "Hedge Fund" 3) "SEA Source"]} + :runner {:deck ["Fall Guy" "Off-Campus Apartment" "Net Shield" + "Wireless Net Pavilion" "Sure Gamble"]}}) (play-from-hand state :corp "Hedge Fund") (play-from-hand state :corp "Hedge Fund") (take-credits state :corp 1) @@ -52,20 +49,20 @@ (deftest hb-glacier (testing "HB Glacier econ and server protection with upgrades - Ash, Caprice, Breaker Bay Grid, positional ice strength boost" (do-game - (new-game (make-deck "Haas-Bioroid: Engineering the Future" - ["Adonis Campaign" - "Global Food Initiative" - "Breaker Bay Grid" - "Caprice Nisei" - "Ash 2X3ZB9CY" - "Turing" - "Hedge Fund"]) - (default-runner ["Desperado" + (new-game {:corp {:id "Haas-Bioroid: Engineering the Future" + :deck ["Adonis Campaign" + "Global Food Initiative" + "Breaker Bay Grid" + "Caprice Nisei" + "Ash 2X3ZB9CY" + "Turing" + "Hedge Fund"]} + :runner {:deck ["Desperado" "Dirty Laundry" "Emergency Shutdown" "Lamprey" "Data Folding" - "Career Fair"])) + "Career Fair"]}}) (core/draw state :corp 1) (core/gain state :corp :click 1) (play-from-hand state :corp "Hedge Fund") diff --git a/test/clj/game_test/macros.clj b/test/clj/game_test/macros.clj index bbfa5d8bbc..f3401bf2c0 100644 --- a/test/clj/game_test/macros.clj +++ b/test/clj/game_test/macros.clj @@ -31,18 +31,18 @@ (defmacro deftest-pending [name & body] (let [message (str "\n" name " is pending")] - `(clojure.test/deftest ~name (println ~message)))) + `(clojure.test/deftest- ~name (println ~message)))) (defmacro changes-val-macro [change-amt val-form body-form msg] `(let [start-val# ~val-form] - ~body-form - (let [end-val# ~val-form - actual-change# (- end-val# start-val#)] - (clojure.test/do-report - {:type (if (= actual-change# ~change-amt) :pass :fail) - :actual actual-change# - :expected ~change-amt - :message (str "Changed from " start-val# " to " end-val# ", Expected end result of " (+ start-val# ~change-amt) " " ~msg " " '~body-form)})))) + ~body-form + (let [end-val# ~val-form + actual-change# (- end-val# start-val#)] + (clojure.test/do-report + {:type (if (= actual-change# ~change-amt) :pass :fail) + :actual actual-change# + :expected ~change-amt + :message (str "Changed from " start-val# " to " end-val# ", Expected end result of " (+ start-val# ~change-amt) " " ~msg " " '~body-form)})))) (defmethod clojure.test/assert-expr 'changes-val [msg form] (let [change-amt (nth form 1) diff --git a/test/clj/game_test/utils.clj b/test/clj/game_test/utils.clj index fae5038a63..0ed544654c 100644 --- a/test/clj/game_test/utils.clj +++ b/test/clj/game_test/utils.clj @@ -3,46 +3,9 @@ [game.utils :as utils :refer [side-str]] [clojure.test :refer :all] [clojure.string :refer [lower-case split]] - [monger.core :as mg] - [monger.collection :as mc] [jinteki.cards :refer [all-cards]])) -(defn load-card [title] - (let [conn (mg/connect {:host "127.0.0.1" :port 27017}) - db (mg/get-db conn "netrunner") - card (mc/find-maps db "cards" {:title title}) - ret (first card)] - (mg/disconnect conn) - ret)) - -(defn load-cards [] - (let [conn (mg/connect {:host "127.0.0.1" :port 27017}) - db (mg/get-db conn "netrunner") - cards (doall (mc/find-maps db "cards"))] - (mg/disconnect conn) - cards)) - -(defn qty [card amt] - (let [loaded-card (if (string? card) (@all-cards card) card)] - (when-not loaded-card - (throw (Exception. (str card " not found in @all-cards")))) - {:card loaded-card :qty amt})) - -(defn make-deck [identity deck] - {:identity identity - :deck (map #(if (string? %) (qty % 1) %) deck)}) - -(defn default-corp - ([] (default-corp [(qty "Hedge Fund" 3)])) - ([deck] (make-deck "Custom Biotics: Engineered for Success" deck))) - -(defn default-runner - ([] (default-runner [(qty "Sure Gamble" 3)])) - ([deck] (make-deck "The Professor: Keeper of Knowledge" deck))) - - ;;; helper functions for prompt interaction - (defn assert-prompt [state side] (let [prompt (-> @state side :prompt)] (is (first prompt) (str "Expected an open " (side-str side) " prompt"))