Skip to content

Commit

Permalink
Merge pull request #4354 from NoahTheDuke/nb/small-refactor
Browse files Browse the repository at this point in the history
Refactor Mr Li and Muertos Gang Member
  • Loading branch information
NoahTheDuke authored Aug 12, 2019
2 parents b8705e2 + 6d6218d commit 13ddf97
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
41 changes: 20 additions & 21 deletions src/clj/game/cards/resources.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1421,33 +1421,32 @@
:msg (msg "draw 2 cards")
:async true
:effect (req (wait-for (draw state side 2 nil)
(if-let [drawn (get-in @state [:runner :register :most-recent-drawn])]
(continue-ability
state side
(continue-ability
state side
(if-let [drawn (get-in @state [:runner :register :most-recent-drawn])]
{:prompt "Select 1 card to add to the bottom of the Stack"
:choices {:req #(and (in-hand? %)
(some (fn [c] (same-card? c %)) drawn))}
:msg (msg "add 1 card to the bottom of the Stack")
:effect (req (move state side target :deck))}
card nil)
(effect-completed state side eid))))}]}
:effect (req (move state side target :deck))})
card nil)))}]}

"Muertos Gang Member"
{:effect (req (resolve-ability
state :corp
{:prompt "Select a card to derez"
:choices {:req #(and (corp? %)
(not (agenda? %))
(:rezzed %))}
:effect (req (derez state side target))}
card nil))
:leave-play (req (resolve-ability
state :corp
{:prompt "Select a card to rez, ignoring the rez cost"
:choices {:req #(not (:rezzed %))}
:effect (req (rez state side target {:ignore-cost :rez-cost})
(system-msg state side (str "rezzes " (:title target) " at no cost")))}
card nil))
{:effect (effect (continue-ability
:corp
{:prompt "Select a card to derez"
:choices {:req #(and (corp? %)
(not (agenda? %))
(:rezzed %))}
:effect (effect (derez target))}
card nil))
:leave-play (effect (continue-ability
:corp
{:prompt "Select a card to rez, ignoring the rez cost"
:choices {:req (complement rezzed?)}
:effect (effect (rez target {:ignore-cost :rez-cost :no-msg true})
(system-say (str (:title card) " allows the Corp to rez " (:title target) " at no cost")))}
card nil))
:abilities [{:msg "draw 1 card"
:async true
:cost [:trash]
Expand Down
17 changes: 8 additions & 9 deletions src/clj/game/core/actions.clj
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,8 @@
([state side card] (rez state side (make-eid state) card nil))
([state side card args]
(rez state side (make-eid state) card args))
([state side eid {:keys [disabled] :as card} {:keys [ignore-cost no-warning force no-get-card paid-alt cached-bonus] :as args}]
([state side eid {:keys [disabled] :as card}
{:keys [ignore-cost no-warning force no-get-card paid-alt cached-bonus no-msg] :as args}]
(let [eid (eid-set-defaults eid :source nil :source-type :rez)
card (if no-get-card
card
Expand Down Expand Up @@ -549,14 +550,12 @@
(update! state side (-> h
(update-in [:zone] #(map to-keyword %))
(update-in [:host :zone] #(map to-keyword %)))))
(system-msg state side (str (build-spend-msg cost-str "rez" "rezzes")
(:title card)
(cond
paid-alt
" by paying its alternative cost"

ignore-cost
" at no cost")))
(when-not no-msg
(system-msg state side (str (build-spend-msg cost-str "rez" "rezzes")
(:title card)
(cond
paid-alt " by paying its alternative cost"
ignore-cost " at no cost"))))
(when (and (not no-warning) (:corp-phase-12 @state))
(toast state :corp "You are not allowed to rez cards between Start of Turn and Mandatory Draw.
Please rez prior to clicking Start Turn in the future." "warning"
Expand Down

0 comments on commit 13ddf97

Please sign in to comment.