Skip to content

Commit

Permalink
Merge pull request #4338 from NoahTheDuke/nb/fix-hernando-building-bl…
Browse files Browse the repository at this point in the history
…ocks

Fix Hernando Cortez/Building Blocks interaction
  • Loading branch information
NoahTheDuke authored Aug 3, 2019
2 parents 239f323 + 9d2d100 commit d21d1f0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
9 changes: 7 additions & 2 deletions src/clj/game/cards/operations.clj
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,16 @@
:effect (effect (damage eid :meat 7 {:card card}))}

"Building Blocks"
{:choices {:req #(and (corp? %)
{:req (req (pos? (count (filter #(has-subtype? % "Barrier") (:hand corp)))))
:prompt "Select a Barrier to install and rez"
:choices {:req #(and (corp? %)
(has-subtype? % "Barrier")
(in-hand? %))}
:async true
:effect (req (corp-install state side eid target nil {:ignore-all-cost true :install-state :rezzed-no-cost}))}
:msg (msg "reveal " (:title target))
:effect (effect (reveal target)
(corp-install eid target nil {:ignore-all-cost true
:install-state :rezzed-no-cost}))}

"Casting Call"
{:choices {:req #(and (agenda? %)
Expand Down
3 changes: 2 additions & 1 deletion src/clj/game/cards/resources.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,8 @@
:abilities [ability]})

"Hernando Cortez"
{:events {:pre-rez-cost {:req (req (and (>= (:credit corp) 10) (ice? target)))
{:events {:pre-rez-cost {:req (req (and (<= 10 (:credit corp))
(ice? target)))
:effect (effect (rez-additional-cost-bonus
[:credit (count (:subroutines target))]))
:msg (msg "increase the rez cost by " (count (:subroutines target)) " [Credit]")}}}
Expand Down
5 changes: 3 additions & 2 deletions src/clj/game/core/actions.clj
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@
(trigger-event state side :pre-rez card)
(if (or (#{"Asset" "ICE" "Upgrade"} (:type card))
(:install-rezzed (card-def card)))
(do (trigger-event state side :pre-rez-cost card)
(do (when-not (= ignore-cost :all-costs)
(trigger-event state side :pre-rez-cost card))
(if (and altcost (can-pay? state side eid card nil altcost) (not ignore-cost))
(let [curr-bonus (get-rez-cost-bonus state side)]
(prompt! state side card (str "Pay the alternative Rez cost?") ["Yes" "No"]
Expand All @@ -536,7 +537,7 @@
(when (and (not= ignore-cost :all-costs)
(not (:disabled card)))
additional-costs))]
(wait-for (apply pay-sync state side (make-eid state eid) card costs)
(wait-for (pay-sync state side (make-eid state eid) card costs)
(when-let [cost-str (and (string? async-result) async-result)]
;; Deregister the derezzed-events before rezzing card
(when (:derezzed-events cdef)
Expand Down
8 changes: 2 additions & 6 deletions test/clj/game_test/cards/operations.clj
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
(is (= 6 (:credit (get-corp))) "Corp starts with 6 credits")
(play-from-hand state :corp "Building Blocks")
(is (= 1 (:credit (get-corp))) "Spent 5 credits on Building Blocks")
(click-card state :corp (find-card "Ice Wall" (:hand (get-corp))))
(click-card state :corp "Ice Wall")
(click-prompt state :corp "New remote")
(let [iw (get-ice state :remote1 0)]
(is (= 1 (:credit (get-corp))) "Corp spent no credits installing ice")
Expand All @@ -233,11 +233,7 @@
(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")
(click-card state :corp (find-card "Hedge Fund" (:hand (get-corp))))
(is (= "Select a target for Building Blocks" (:msg (first (:prompt (get-corp))))) "Cannot select non-ICE")
(click-card state :corp (find-card "Cortex Lock" (:hand (get-corp))))
(is (= "Select a target for Building Blocks" (:msg (first (:prompt (get-corp))))) "Cannot select non-barrier ICE"))))
(is (empty? (:prompt (get-corp))) "Can't play Building Blocks without a Barrier in hand"))))

(deftest casting-call
;; Casting Call - Only do card-init on the Public agendas. Issue #1128
Expand Down

0 comments on commit d21d1f0

Please sign in to comment.