Skip to content

Commit

Permalink
prana once per damage instance!
Browse files Browse the repository at this point in the history
  • Loading branch information
NBKelly committed Jul 12, 2024
1 parent e167095 commit bb16ba8
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/clj/game/cards/assets.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2130,8 +2130,11 @@
:abilities [{:label "Prevent 1 net damage to place power counter on Prāna Condenser"
:msg "prevent 1 net damage, place 1 power counter, and gain 3 [Credits]"
:async true
:req (req true)
:req (req (and (= (get-in @state [:prevent :current :type]) :net)
(not= (get-in card [:special :last-prevented-eid])
(get-in @state [:prevent :current :eid :eid]))))
:effect (req (add-counter state side card :power 1)
(update! state side (assoc-in (get-card state card) [:special :last-prevented-eid] (get-in @state [:prevent :current :eid :eid])))
(gain-credits state :corp eid 3)
(damage-prevent state :corp :net 1))}
{:msg (msg "deal " (get-counters card :power) " net damage")
Expand Down
5 changes: 2 additions & 3 deletions src/clj/game/cards/identities.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1072,10 +1072,9 @@
(let [ability {:async true
:req (req (not (:winner @state)))
:msg "do 1 net damage"
:interactive (req true)
:effect (effect (damage eid :net 1 {:card card}))}]
{:events [(assoc ability
:event :agenda-scored
:interactive (req true))
{:events [(assoc ability :event :agenda-scored)
(assoc ability :event :agenda-stolen)]}))

(defcard "Jinteki: Potential Unleashed"
Expand Down
4 changes: 2 additions & 2 deletions src/clj/game/cards/resources.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2225,7 +2225,7 @@
run
(= :corp (:active-player @state))
(#{:psi :trace} (:source-type eid))
(#{:net :meat :brain :tag} (get-in @state [:prevent :current]))))
(#{:net :meat :brain :tag} (get-in @state [:prevent :current :type]))))
:type :credit}}})

(defcard "Network Exchange"
Expand Down Expand Up @@ -2299,7 +2299,7 @@
:req (req (first-chance? state side))}]}
:abilities [{:msg "force the Corp to trace"
:async true
:effect (req (let [prevent-type (get-in @state [:prevent :current])]
:effect (req (let [prevent-type (get-in @state [:prevent :current :type])]
(wait-for (trash state side card {:unpreventable true :cause-card card})
(continue-ability state side (start-trace prevent-type)
card nil))))}]}))
Expand Down
2 changes: 1 addition & 1 deletion src/clj/game/core/bad_publicity.clj
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
(cards-can-prevent? state :corp prevent :bad-publicity))
(do (system-msg state :corp "has the option to avoid bad publicity")
(show-wait-prompt state :runner "Corp to prevent bad publicity")
(swap! state assoc-in [:prevent :current] :bad-publicity)
(swap! state assoc-in [:prevent :current] {:type :bad-publicity :eid eid})
(show-prompt
state :corp nil
(str "Avoid " (when (< 1 n) "any of the ") n " bad publicity?") ["Done"]
Expand Down
2 changes: 1 addition & 1 deletion src/clj/game/core/damage.clj
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
;; player can prevent damage
(do (system-msg state player "has the option to prevent damage")
(show-wait-prompt state other-player (str (side-str player) " to prevent damage"))
(swap! state assoc-in [:prevent :current] type)
(swap! state assoc-in [:prevent :current] {:type type :eid eid})
(show-prompt
state player nil
(str "Prevent " (when (< 1 (- n already-prevented)) "any of the ") (- n already-prevented) " " (damage-name type) " damage?")
Expand Down
2 changes: 1 addition & 1 deletion src/clj/game/core/tags.clj
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
(cards-can-prevent? state :runner prevent :tag))
(do (system-msg state :runner "has the option to avoid tags")
(show-wait-prompt state :corp "Runner to prevent tags")
(swap! state assoc-in [:prevent :current] :tag)
(swap! state assoc-in [:prevent :current] {:type :tag :eid eid})
(show-prompt
state :runner nil
(str "Avoid " (when (< 1 n) "any of the ") (quantify n "tag") "?") ["Done"]
Expand Down
24 changes: 24 additions & 0 deletions test/clj/game/cards/assets_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4153,6 +4153,30 @@
(card-ability state :corp pc 1)
(is (= 3 (count (:hand (get-runner)))) "2 damage dealt"))))

(deftest prana-condenser-once-per-instance
(do-game
(new-game {:corp {:hand ["Prāna Condenser" "Fujii Asset Retrieval"]
:id "Jinteki: Personal Evolution"}
:runner {:hand [(qty "Sure Gamble" 5)]}})
(play-from-hand state :corp "Prāna Condenser" "New remote")
(take-credits state :corp)
(let [pran (get-content state :remote1 0)]
(rez state :corp pran)
(run-empty-server state :hq)
(click-prompt state :runner "Steal")
(click-prompt state :corp "Fujii Asset Retrieval")
(is (changed? [(:credit (get-corp)) 3]
(card-ability state :corp (refresh pran) 0))
"Prevented one damage")
(is (changed? [(:credit (get-corp)) 0]
(card-ability state :corp (refresh pran) 0))
"Couldn't prevent the other!")
(click-prompt state :corp "Done")
(is (= 1 (count (:discard (get-runner)))) "Took 1 net")
(is (changed? [(:credit (get-corp)) 3]
(card-ability state :corp (refresh pran) 0))
"Prevented one damage (PE)"))))

(deftest prana-condenser-refuse-to-prevent-damage
;; Refuse to prevent damage
(do-game
Expand Down

0 comments on commit bb16ba8

Please sign in to comment.