Skip to content

Commit

Permalink
Merge pull request #4290 from lostgeek/pay-credits
Browse files Browse the repository at this point in the history
Bugfixes around pay-credits prompts
  • Loading branch information
NoahTheDuke authored Jul 12, 2019
2 parents c4f0014 + d0beba4 commit 5ba3dd5
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 55 deletions.
31 changes: 16 additions & 15 deletions src/clj/game/cards/events.clj
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
{:prompt "Select a resource to install from your Grip"
:choices {:req #(and (resource? %)
(in-hand? %))}
:effect (effect (install-cost-bonus [:credit -3]) (runner-install target))}
:effect (effect (install-cost-bonus [:credit -3]) (runner-install (assoc eid :source card :source-type :runner-install) target nil))}

"Careful Planning"
{:prompt "Choose a card in or protecting a remote server"
Expand Down Expand Up @@ -303,7 +303,7 @@
:effect (effect (trigger-event :searched-stack nil)
(shuffle! :deck)
(install-cost-bonus [:credit (* -3 (count (get-in corp [:servers :rd :ices])))])
(runner-install target)
(runner-install (assoc eid :source card :source-type :runner-install) target nil)
(gain-tags eid 1))}}
card))}

Expand Down Expand Up @@ -334,7 +334,8 @@
:effect (req (when (= :deck where)
(trigger-event state side :searched-stack nil)
(shuffle! state side :deck))
(runner-install state side (assoc-in target [:special :compile-installed] true) {:ignore-all-cost true}))})]
(runner-install state side (make-eid state {:source card :source-type :runner-install})
(assoc-in target [:special :compile-installed] true) {:ignore-all-cost true}))})]
{:implementation "Trigger only on first encounter not enforced"
:prompt "Choose a server"
:msg "make a run and install a program on encounter with the first piece of ICE"
Expand Down Expand Up @@ -423,7 +424,7 @@
(in-hand? %))}
:async true
:effect (req (install-cost-bonus state :runner [:credit -8])
(wait-for (runner-install state :runner target nil)
(wait-for (runner-install state :runner (make-eid state {:source card :source-type :runner-install}) target nil)
(gain-tags state eid :runner 1)))}

"Cyber Threat"
Expand Down Expand Up @@ -555,7 +556,7 @@
(in-hand? %))}
:msg (msg "install " (:title target))
:effect (req (let [diana-card (assoc-in target [:special :diana-installed] true)]
(runner-install state side diana-card {:ignore-all-cost true})
(runner-install state side (make-eid state {:source card :source-type :runner-install}) diana-card {:ignore-all-cost true})
(swap! state update :diana #(conj % diana-card))))}
card nil))}]
:effect (effect (make-run target nil card)
Expand Down Expand Up @@ -708,7 +709,7 @@
(doseq [c to-trash]
(trash state side c {:unpreventable true}))
(install-cost-bonus state side [:credit (- trash-cost)])
(runner-install state side target)
(runner-install state side (make-eid state {:source card :source-type :runner-install}) target nil)
(effect-completed state side eid))})]
{:prompt "Choose Hardware and Programs to trash from your Grip"
:choices {:req #(and (or (hardware? %)
Expand Down Expand Up @@ -945,7 +946,7 @@
(assoc card :zone '(:discard)))
(install-cost-bonus state side [:credit -5])
(let [to-trash (remove #(same-card? % target) topten)]
(wait-for (runner-install state side target nil)
(wait-for (runner-install state side (make-eid state {:source card :source-type :runner-install}) target nil)
(let [card (get-card state (assoc card :zone '(:discard)))]
(if (not (:shuffle-occurred card))
(do (system-msg state side (str "trashes " (join ", " (map :title to-trash))))
Expand Down Expand Up @@ -1053,7 +1054,7 @@
(let [connection target]
{:optional
{:prompt (str "Install " (:title connection) "?")
:yes-ability {:effect (effect (runner-install connection)
:yes-ability {:effect (effect (runner-install (assoc eid :source card :source-type :runner-install) connection)
(shuffle! :deck))}
:no-ability {:effect (effect (move connection :hand)
(shuffle! :deck))}}})
Expand Down Expand Up @@ -1534,7 +1535,7 @@
(let [mhelper (fn mi [n] {:prompt "Select a program to install"
:choices {:req #(and (program? %)
(in-hand? %))}
:effect (req (runner-install state side target)
:effect (req (runner-install state side (make-eid state {:source card :source-type :runner-install}) target nil)
(when (< n 3)
(resolve-ability state side (mi (inc n)) card nil)))})]
{:effect (effect (resolve-ability (mhelper 1) card nil))})
Expand Down Expand Up @@ -1594,7 +1595,7 @@
:choices {:req #(and (or (hardware? %)
(program? %))
(in-hand? %))}
:effect (effect (install-cost-bonus [:credit -3]) (runner-install target))}
:effect (effect (install-cost-bonus [:credit -3]) (runner-install (assoc eid :source card :source-type :runner-install) target nil))}

"Net Celebrity"
{:recurring 1
Expand Down Expand Up @@ -1867,7 +1868,7 @@
"Reboot"
(letfn [(install-cards [state side eid card to-install titles]
(if-let [f (first to-install)]
(wait-for (runner-install state :runner f {:facedown true :no-msg true})
(wait-for (runner-install state :runner (make-eid state {:source card :source-type :runner-install}) f {:facedown true :no-msg true})
(install-cards state side eid card (rest to-install) titles))
(do
(move state side (find-latest state card) :rfg)
Expand Down Expand Up @@ -1910,7 +1911,7 @@
:choices {:req #(and (valid-target? %)
(can-pay? st si eid card nil (modified-install-cost st si % [:credit (- bonus)])))}
:effect (effect (install-cost-bonus [:credit (- bonus)])
(runner-install eid target nil))})]
(runner-install (assoc eid :source card :source-type :runner-install) target nil))})]
{:req (req (some valid-target? (all-installed state :runner)))
:effect (req (wait-for (resolve-ability state side pick-up card nil)
(continue-ability state side
Expand All @@ -1933,7 +1934,7 @@
{:prompt "Choose a program to install"
:msg (msg "install " (:title target))
:choices (req (filter program? (:discard runner)))
:effect (effect (runner-install target {:ignore-all-cost true}))}}
:effect (effect (runner-install (assoc eid :source card :source-type :runner-install) target {:ignore-all-cost true}))}}
card))}

"Rigged Results"
Expand Down Expand Up @@ -2062,7 +2063,7 @@
(#{[:hand] [:discard]} (:zone %))
(can-pay? st si e c nil (modified-install-cost st si % [:credit tcost])))}
:effect (effect (install-cost-bonus [:credit (- (:cost trashed))])
(runner-install target))
(runner-install (assoc eid :source card :source-type :runner-install) target nil))
:msg (msg "trash " (:title trashed) " and install " (:title target))} card nil)))}

"Scrubbed"
Expand Down Expand Up @@ -2238,7 +2239,7 @@
(filter program? ((if (= where "Heap") :discard :deck) runner))))
:effect (effect (trigger-event :searched-stack nil)
(shuffle! :deck)
(runner-install eid
(runner-install (assoc eid :source card :source-type :runner-install)
(assoc-in target [:special :test-run] true)
{:ignore-all-cost true}))})
card nil))})
Expand Down
8 changes: 4 additions & 4 deletions src/clj/game/cards/identities.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns game.cards.identities
(:require [game.core :refer :all]
[game.core.eid :refer [effect-completed]]
[game.core.eid :refer [effect-completed make-eid]]
[game.utils :refer :all]
[game.macros :refer [effect req msg wait-for continue-ability]]
[clojure.string :refer [split-lines split join lower-case includes? starts-with?]]
Expand Down Expand Up @@ -177,7 +177,7 @@
(in-hand? %))}
:req (req (and (pos? (count (:hand runner)))
(:runner-phase-12 @state)))
:effect (effect (runner-install eid target {:facedown true}))}]
:effect (effect (runner-install (assoc eid :source card :source-type :runner-install) target {:facedown true}))}]
{:events {:runner-turn-begins ability}
:flags {:runner-phase-12 (req true)}
:abilities [ability]})
Expand Down Expand Up @@ -559,7 +559,7 @@
:choices {:req #(and (is-type? % type)
(in-hand? %))}
:msg (msg "install " (:title target))
:effect (effect (runner-install eid target nil))}}}
:effect (effect (runner-install (assoc eid :source card :source-type :runner-install) target nil))}}}
card nil)))}}}

"Hoshiko Shiro"
Expand Down Expand Up @@ -732,7 +732,7 @@
:effect (effect (trigger-event :searched-stack nil)
(shuffle! :deck)
(install-cost-bonus [:credit -1])
(runner-install eid (assoc-in target [:special :kabonesa] true) nil))}]})
(runner-install (assoc eid :source card :source-type :runner-install) (assoc-in target [:special :kabonesa] true) nil))}]})

"Kate \"Mac\" McCaffrey: Digital Tinker"
;; Effect marks Kate's ability as "used" if it has already met it's trigger condition this turn
Expand Down
16 changes: 8 additions & 8 deletions src/clj/game/cards/programs.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns game.cards.programs
(:require [game.core :refer :all]
[game.core.eid :refer [effect-completed]]
[game.core.eid :refer [effect-completed make-eid]]
[game.utils :refer :all]
[game.macros :refer [effect req msg wait-for continue-ability when-let*]]
[clojure.string :refer [split-lines split join lower-case includes? starts-with?]]
Expand Down Expand Up @@ -765,7 +765,7 @@
(:hosted card))))
:msg (msg "install " (:title target))
:effect (req (when (can-pay? state side eid card nil :credit (:cost target))
(runner-install state side target)))}]})
(runner-install state side (make-eid state {:source card :source-type :runner-install}) target nil)))}]})

"Cyber-Cypher"
(auto-icebreaker ["Code Gate"]
Expand Down Expand Up @@ -838,7 +838,7 @@
:req (req (not (install-locked? state side)))
:msg (msg "install " (:title target) " at no cost")
:effect (effect (trash card {:cause :ability-cost})
(runner-install target {:ignore-install-cost true}))}
(runner-install (assoc eid :source card :source-type :runner-install) target {:ignore-install-cost true}))}
card nil)))}]}

"Deep Thought"
Expand Down Expand Up @@ -882,7 +882,7 @@
", lowering its cost by 1 [Credit]")))
:effect (effect (when (-> target :cost pos?)
(install-cost-bonus state side [:credit -1]))
(runner-install target {:host-card card :no-mu true})
(runner-install (assoc eid :source card :source-type :runner-install) target {:host-card card :no-mu true})
(update! (assoc-in (get-card state card) [:special :dheg-prog] (:cid target))))}
card nil))}
{:label "Host an installed program on Dhegdheer with [Credit] discount"
Expand Down Expand Up @@ -1214,7 +1214,7 @@
{:req (req (not-any? #{:facedown :hand} (:previous-zone card)))
:effect (req (let [lock (get-in @state [:runner :locked :discard])]
(swap! state assoc-in [:runner :locked] nil)
(runner-install state :runner card {:facedown true})
(runner-install state :runner (assoc eid :source card :source-type :runner-install) card {:facedown true})
(swap! state assoc-in [:runner :locked] lock)))}}

"Hemorrhage"
Expand Down Expand Up @@ -2006,7 +2006,7 @@
:prompt "Choose a program to install from your grip"
:choices {:req #(and (program? %)
(in-hand? %))}
:effect (effect (runner-install target))}]}
:effect (effect (runner-install (assoc eid :source card :source-type :runner-install) target nil))}]}

"Scheherazade"
{:abilities [{:label "Install and host a program from Grip"
Expand All @@ -2017,7 +2017,7 @@
(runner-can-install? state side % false)
(in-hand? %))}
:msg (msg "host " (:title target) " and gain 1 [Credits]")
:effect (effect (runner-install target {:host-card card}) (gain-credits 1))}
:effect (effect (runner-install (assoc eid :source card :source-type :runner-install) target {:host-card card}) (gain-credits 1))}
card nil))}
{:label "Host an installed program"
:prompt "Choose a program to host on Scheherazade" :priority 2
Expand All @@ -2044,7 +2044,7 @@
:effect (req (trigger-event state side :searched-stack nil)
(shuffle! state side :deck)
(when (not= target "No install")
(runner-install state side target)))} card nil)))}]}
(runner-install state side (make-eid state {:source card :source-type :runner-install}) target nil)))} card nil)))}]}

"Sharpshooter"
(auto-icebreaker ["Destroyer"]
Expand Down
Loading

0 comments on commit 5ba3dd5

Please sign in to comment.