Skip to content

Commit

Permalink
Switch from manual counter costs to integrated
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahTheDuke committed Jul 29, 2019
1 parent e58f86b commit a57e156
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 188 deletions.
45 changes: 20 additions & 25 deletions src/clj/game/cards/agendas.clj
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@
{:implementation "Runner must trash cards manually when required"
:effect (effect (add-counter card :agenda 1))
:silent (req true)
:abilities [{:counter-cost [:agenda 1]
:abilities [{:cost [:agenda 1]
:req (req (:run @state))
:msg "make the Runner trash a card from their grip to jack out or break subroutines for the remainder of the run"}]}

"AstroScript Pilot Program"
{:effect (effect (add-counter card :agenda 1))
:silent (req true)
:abilities [{:counter-cost [:agenda 1]
:abilities [{:cost [:agenda 1]
:msg (msg "place 1 advancement token on " (card-str state target))
:choices {:req can-be-advanced?}
:effect (effect (add-prop target :advance-counter 1 {:placed true}))}]}
Expand Down Expand Up @@ -339,8 +339,7 @@
(add-counters state side card eid)))}
:no-ability {:effect (effect (add-counters card eid))}}}
card nil))
:abilities [{:cost [:click 1]
:counter-cost [:agenda 1]
:abilities [{:cost [:click 1 :agenda 1]
:async true
:label "Do 2 meat damage"
:once :per-turn
Expand Down Expand Up @@ -511,7 +510,7 @@
"Efficiency Committee"
{:silent (req true)
:effect (effect (add-counter card :agenda 3))
:abilities [{:cost [:click 1] :counter-cost [:agenda 1]
:abilities [{:cost [:click 1 :agenda 1]
:effect (effect (gain :click 2)
(register-turn-flag!
card :can-advance
Expand All @@ -523,8 +522,7 @@
"Elective Upgrade"
{:silent (req true)
:effect (effect (add-counter card :agenda 2))
:abilities [{:cost [:click 1]
:counter-cost [:agenda 1]
:abilities [{:cost [:click 1 :agenda 1]
:once :per-turn
:effect (effect (gain :click 2))
:msg "gain [Click][Click]"}]}
Expand All @@ -543,8 +541,7 @@
{:effect (effect (add-counter card :agenda 1)
(shuffle-into-deck :hand))
:interactive (req true)
:abilities [{:cost [:click 1]
:counter-cost [:agenda 1]
:abilities [{:cost [:click 1 :agenda 1]
:msg "draw 5 cards"
:effect (effect (draw 5))}]}

Expand Down Expand Up @@ -577,7 +574,7 @@
"Firmware Updates"
{:silent (req true)
:effect (effect (add-counter card :agenda 3))
:abilities [{:counter-cost [:agenda 1]
:abilities [{:cost [:agenda 1]
:choices {:req #(and (ice? %)
(can-be-advanced? %))}
:req (req (pos? (get-counters card :agenda)))
Expand All @@ -599,8 +596,7 @@
"Geothermal Fracking"
{:effect (effect (add-counter card :agenda 2))
:silent (req true)
:abilities [{:cost [:click 1]
:counter-cost [:agenda 1]
:abilities [{:cost [:click 1 :agenda 1]
:msg "gain 7 [Credits] and take 1 bad publicity"
:effect (effect (gain-credits 7)
(gain-bad-publicity :corp 1))}]}
Expand Down Expand Up @@ -686,8 +682,7 @@
"High-Risk Investment"
{:effect (effect (add-counter card :agenda 1))
:silent (req true)
:abilities [{:cost [:click 1]
:counter-cost [:agenda 1]
:abilities [{:cost [:click 1 :agenda 1]
:msg (msg "gain " (:credit runner) " [Credits]")
:effect (effect (gain-credits (:credit runner)))}]}

Expand Down Expand Up @@ -716,7 +711,7 @@
"House of Knives"
{:effect (effect (add-counter card :agenda 3))
:silent (req true)
:abilities [{:counter-cost [:agenda 1]
:abilities [{:cost [:agenda 1]
:msg "do 1 net damage"
:req (req (:run @state))
:once :per-run
Expand Down Expand Up @@ -781,7 +776,7 @@
:silent (req true)
:effect (effect (add-counter card :power 2))
:abilities [{:req (req (:run @state))
:counter-cost [:power 1]
:cost [:power 1]
:effect (req (let [ls (filter #(= "Labyrinthine Servers" (:title %)) (:scored corp))]
(jack-out-prevent state side)
(when (zero? (reduce + (for [c ls] (get-counters c :power))))
Expand Down Expand Up @@ -916,7 +911,7 @@
{:silent (req true)
:effect (effect (add-counter card :agenda 1))
:abilities [{:req (req (:run @state))
:counter-cost [:agenda 1]
:cost [:agenda 1]
:msg "end the run"
:async true
:effect (effect (end-run eid card))}]}
Expand Down Expand Up @@ -1013,7 +1008,7 @@
"Project Atlas"
{:silent (req true)
:effect (effect (add-counter card :agenda (max 0 (- (get-counters card :advancement) 3))))
:abilities [{:counter-cost [:agenda 1]
:abilities [{:cost [:agenda 1]
:prompt "Choose a card"
:label "Search R&D and add 1 card to HQ"
;; we need the req or the prompt will still show
Expand All @@ -1035,13 +1030,13 @@
"Project Kusanagi"
{:silent (req true)
:effect (effect (add-counter card :agenda (- (get-counters card :advancement) 2)))
:abilities [{:counter-cost [:agenda 1]
:abilities [{:cost [:agenda 1]
:msg "make a piece of ICE gain \"[Subroutine] Do 1 net damage\" after all its other subroutines for the remainder of the run"}]}

"Project Vitruvius"
{:silent (req true)
:effect (effect (add-counter card :agenda (- (get-counters card :advancement) 3)))
:abilities [{:counter-cost [:agenda 1]
:abilities [{:cost [:agenda 1]
:prompt "Choose a card in Archives to add to HQ"
:show-discard true
:choices {:req #(and (in-discard? %)
Expand All @@ -1059,7 +1054,7 @@
:abilities [{:req (req (and (ice? current-ice)
(rezzed? current-ice)
(has-subtype? current-ice "Bioroid")))
:counter-cost [:agenda 1]
:cost [:agenda 1]
:msg (str "make the approached piece of Bioroid ICE gain \"[Subroutine] End the run\""
"after all its other subroutines for the remainder of this run")}]}

Expand Down Expand Up @@ -1093,7 +1088,7 @@
(clear-wait-prompt :runner))})]
{:silent (req true)
:effect (effect (add-counter card :agenda (- (get-counters card :advancement) 3)))
:abilities [{:counter-cost [:agenda 1]
:abilities [{:cost [:agenda 1]
:req (req run)
:effect (effect (show-wait-prompt :runner "Corp to use Project Yagi-Uda")
(continue-ability (choose-card (:server run))
Expand Down Expand Up @@ -1191,7 +1186,7 @@
"Remastered Edition"
{:effect (effect (add-counter card :agenda 1))
:silent (req true)
:abilities [{:counter-cost [:agenda 1]
:abilities [{:cost [:agenda 1]
:msg (msg "place 1 advancement token on " (card-str state target))
:choices {:req installed?}
:effect (effect (add-prop target :advance-counter 1 {:placed true}))}]}
Expand Down Expand Up @@ -1278,7 +1273,7 @@
"Sensor Net Activation"
{:effect (effect (add-counter card :agenda 1))
:silent (req true)
:abilities [{:counter-cost [:agenda 1]
:abilities [{:cost [:agenda 1]
:req (req (some #(and (has-subtype? % "Bioroid") (not (rezzed? %))) (all-installed state :corp)))
:prompt "Choose a bioroid to rez, ignoring all costs"
:choices {:req #(and (has-subtype? % "Bioroid") (not (rezzed? %)))}
Expand Down Expand Up @@ -1414,7 +1409,7 @@
"Timely Public Release"
{:silent (req true)
:effect (effect (add-counter card :agenda 1))
:abilities [{:counter-cost [:agenda 1]
:abilities [{:cost [:agenda 1]
:label "Install a piece of ice in any position, ignoring all costs"
:prompt "Select a piece of ice to install"
:show-discard true
Expand Down
58 changes: 26 additions & 32 deletions src/clj/game/cards/assets.clj
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,7 @@
{:abilities [{:label "Add 1 power counter"
:effect (effect (add-counter card :power 1)
(system-msg (str "adds 1 power counter to Chief Slee")))}
{:counter-cost [:power 5]
:cost [:click 1]
{:cost [:click 1 :power 5]
:async true
:msg "do 5 meat damage"
:effect (effect (damage eid :meat 5 {:card card}))}]}
Expand Down Expand Up @@ -584,8 +583,7 @@

"Drudge Work"
{:effect (effect (add-counter card :power 3))
:abilities [{:cost [:click 1]
:counter-cost [:power 1]
:abilities [{:cost [:click 1 :power 1]
:async true
:choices {:req #(and (agenda? %)
(or (in-hand? %)
Expand All @@ -600,7 +598,7 @@
(gain-credits state :corp (get-agenda-points state :corp target))
(move state :corp target :deck)
(shuffle! state :corp :deck)
(if (zero? (get-counters card :power))
(if (not (pos? (get-counters (get-card state card) :power)))
(trash state side eid card nil)
(effect-completed state side eid)))}]}

Expand Down Expand Up @@ -725,8 +723,7 @@
:msg (msg "give the runner " (quantify (tag-count (get-card state card)) "tag"))
:async true
:effect (effect (gain-tags :corp eid (tag-count (get-card state card))))}
:abilities [{:cost [:click 1]
:advance-counter-cost 7
:abilities [{:cost [:click 1 :advancement 7]
:label "Add False Flag to your score area as an agenda worth 3 agenda points"
:msg "add it to their score area as an agenda worth 3 agenda points"
:async true
Expand Down Expand Up @@ -776,8 +773,7 @@
:async true
:effect (effect (damage eid :net (get-counters (get-card state card) :advancement)
{:card card}))}
:abilities [{:cost [:click 1]
:advance-counter-cost 3
:abilities [{:cost [:click 1 :advancement 2]
:label "Add Gene Splicing to your score area as an agenda worth 1 agenda point"
:msg "add it to their score area as an agenda worth 1 agenda point"
:async true
Expand Down Expand Up @@ -809,8 +805,7 @@
:abilities [{:label "Gain [Click][Click]"
:once :per-turn
:msg "gain [Click][Click]"
:cost [:click 1]
:advance-counter-cost 1
:cost [:click 1 :advancement 1]
:effect (effect (gain :click 2))}]}

"Honeyfarm"
Expand Down Expand Up @@ -890,7 +885,7 @@
:effect (effect (move target :hand))}]}

"IT Department"
{:abilities [{:counter-cost [:power 1]
{:abilities [{:cost [:power 1]
:label "Add strength to a rezzed ICE"
:choices {:req #(and (ice? %) (:rezzed %))}
:req (req (pos? (get-counters card :power)))
Expand Down Expand Up @@ -1074,18 +1069,19 @@
:move-zone re-enable-target})

"Marilyn Campaign"
(let [ability {:msg "gain 2 [Credits]"
:counter-cost [:credit 2]
:once :per-turn
(let [ability {:once :per-turn
:interactive (req true)
:req (req (:corp-phase-12 @state))
:label (str "Gain 2 [Credits] (start of turn)")
:msg (msg "gain " (min 2 (get-counters card :credit)) " [Credits]")
:async true
:effect (req (gain-credits state :corp 2)
(if (zero? (get-counters (get-card state card) :credit))
:effect (req (let [credits (min 2 (get-counters card :credit))]
(add-counter state side card :credit (- credits))
(gain-credits state :corp credits))
(if (not (pos? (get-counters (get-card state card) :credit)))
(trash state :corp eid card {:unpreventable true})
(effect-completed state :corp eid)))}]
{:effect (effect (add-counter card :credit 8))
{:data {:counter {:credit 8}}
:derezzed-events {:runner-turn-ends corp-rez-toast}
:events {:corp-turn-begins ability}
:abilities [(set-autoresolve :auto-reshuffle "Marilyn reshuffle")]
Expand Down Expand Up @@ -1122,8 +1118,8 @@
(let [ability {:msg "take 1 [Credits]"
:label "Take 1 [Credits] (start of turn)"
:once :per-turn
:counter-cost [:credit 1]
:effect (effect (gain-credits 1))}]
:effect (effect (add-counter card :credit -1)
(gain-credits 1))}]
{:abilities [ability
{:cost [:click 1]
:msg "store 3 [Credits]"
Expand All @@ -1136,8 +1132,7 @@
:msg "to force the Runner to lose a [Click] next turn and place a power counter on itself"
:effect (req (swap! state update-in [:runner :extra-click-temp] (fnil dec 0))
(add-counter state side card :power 1))}
{:cost [:click 1 :trash]
:counter-cost [:power 3]
{:cost [:click 1 :power 3 :trash]
:msg "gain 4 [Click] and trash itself"
:effect (effect (gain :click 4))}]}

Expand Down Expand Up @@ -1328,8 +1323,7 @@

"NGO Front"
(letfn [(builder [cost cred]
{:advance-counter-cost cost
:cost [:trash]
{:cost [:advancement cost :trash]
:effect (effect (gain-credits cred))
:label (str "Gain " cred " [Credits]")
:msg (str "gain " cred " [Credits]")})]
Expand Down Expand Up @@ -1466,10 +1460,11 @@
"Private Contracts"
{:effect (effect (add-counter card :credit 14))
:abilities [{:cost [:click 1]
:counter-cost [:credit 2]
:msg "gain 2 [Credits]"
:effect (req (gain-credits state :corp 2)
(when (zero? (get-counters (get-card state card) :credit))
:msg (msg "gain " (min 2 (get-counters card :credit)) " [Credits]")
:effect (req (let [credits (min 2 (get-counters card :credit))]
(add-counter state side card :credit (- credits))
(gain-credits state :corp credits))
(when (not (pos? (get-counters (get-card state card) :credit)))
(trash state :corp card)))}]}

"Project Junebug"
Expand Down Expand Up @@ -1631,7 +1626,7 @@
:req (req (:corp-phase-12 @state))
:label "Remove 1 counter (start of turn)"
:effect (req (add-counter state side card :power -1)
(when (zero? (get-counters (get-card state card) :power))
(when (not (pos? (get-counters (get-card state card) :power)))
(trash state side card)
(resolve-ability
state side
Expand Down Expand Up @@ -1867,8 +1862,7 @@
card nil))}}

"Storgotic Resonator"
{:abilities [{:cost [:click 1]
:counter-cost [:power 1]
{:abilities [{:cost [:click 1 :power 1]
:label "Do 1 net damage"
:msg "do 1 net damage"
:async true
Expand Down Expand Up @@ -2068,7 +2062,7 @@
:events {:corp-turn-begins
{:async true
:effect (req (add-counter state side card :power -1)
(if (zero? (get-counters (get-card state card) :power))
(if (not (pos? (get-counters (get-card state card) :power)))
(wait-for (trash state side card nil)
(do (system-msg state :corp "uses Urban Renewal to do 4 meat damage")
(damage state side eid :meat 4 {:card card})))
Expand Down
14 changes: 6 additions & 8 deletions src/clj/game/cards/hardware.clj
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,7 @@

"Dorm Computer"
{:data {:counter {:power 4}}
:abilities [{:counter-cost [:power 1]
:cost [:click 1]
:abilities [{:cost [:click 1 :power 1]
:req (req (not run))
:prompt "Choose a server"
:choices (req runnable-servers)
Expand Down Expand Up @@ -474,8 +473,8 @@
:abilities [{:label "Take 1 [Credits] from Flame-out"
:req (req (and (not-empty (:hosted card))
(pos? (get-counters card :credit))))
:counter-cost [:credit 1]
:effect (req (gain-credits state :runner 1)
:effect (req (add-counter state side card :credit -1)
(gain-credits state :runner 1)
(system-msg state :runner "takes 1 [Credits] from Flame-out")
(register-events
state :runner
Expand Down Expand Up @@ -736,7 +735,7 @@
"Mâché"
{:abilities [{:label "Draw 1 card"
:msg "draw 1 card"
:counter-cost [:power 3]
:cost [:power 3]
:async true
:effect (effect (draw :runner eid 1 nil))}]
:events {:runner-trash {:once :per-turn
Expand Down Expand Up @@ -833,8 +832,7 @@
:req (req (= target :rd))
:effect (effect (add-counter card :power 1))}}
:abilities [{:async true
:cost [:click 1]
:counter-cost [:power 3]
:cost [:click 1 :power 3]
:msg "access the top card of R&D"
:effect (req (do-access state side eid [:rd] {:no-root true}))}]}

Expand Down Expand Up @@ -1069,7 +1067,7 @@
{:data [:counter {:power 4}]
:interactions {:prevent [{:type #{:meat}
:req (req true)}]}
:abilities [{:counter-cost [:power 1]
:abilities [{:cost [:power 1]
:msg "prevent 1 meat damage"
:effect (req (damage-prevent state side :meat 1)
(when (zero? (get-counters (get-card state card) :power))
Expand Down
Loading

0 comments on commit a57e156

Please sign in to comment.