Skip to content

Commit

Permalink
Merge pull request #7039 from francescopellegrini/valentao
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahTheDuke authored Aug 12, 2023
2 parents c6a479b + 601ced5 commit a75586a
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/clj/game/cards/ice.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3956,8 +3956,8 @@
:subroutines [(gain-credits-sub 2)
(runner-loses-credits 2)
(assoc end-the-run
:label "End the run if you are richer than the Runner"
:req (req (> (:credit corp) (* 1 (:credit runner)))))]})
:label "End the run if you have more credits than the Runner"
:req (req (> (:credit corp) (:credit runner))))]})

(defcard "Vampyronassa"
{:subroutines [(runner-loses-credits 2)
Expand Down
10 changes: 5 additions & 5 deletions src/clj/game/core/costs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,13 @@
:type :tag
:value (value cost)})))

;; Tag-or-bp
;; Tag-or-bad-pub
(defmethod cost-name :tag-or-bad-pub [_] :tag-or-bad-pub)
(defmethod value :tag-or-bad-pub [[_ cost-value]] cost-value)
(defmethod label :tag-or-bad-pub [cost] (str "remove " (quantify (value cost) "tag") " or take " (value cost) " bad publicity"))
(defmethod payable? :tag-or-bad-pub
[cost state side eid card]
true)
;; (<= 0 (- (get-in @state [:runner :tag :base] 0) (value cost))))
(defmethod handler :tag-or-bad-pub
[cost state side eid card actions]
(if-not (<= 0 (- (get-in @state [:runner :tag :base] 0) (value cost)))
Expand All @@ -326,10 +325,11 @@
:value (value cost)}))
(continue-ability
state side
{:prompt "remove tag or take bad pub?"
:choices ["tag" "bad pub"]
{:prompt "Choose one"
:choices [(str "Remove " (quantify (value cost) "tag"))
(str "Gain " (value cost) "bad publicity")]
:async true
:effect (req (if (= target "bad pub")
:effect (req (if (= target (str "Gain " (value cost) "bad publicity"))
(wait-for (gain-bad-publicity state side (make-eid state eid) (value cost) nil)
(complete-with-result state side eid {:msg (str "gains " (value cost) "bad publicity")
:type :tag-or-bad-pub
Expand Down
51 changes: 44 additions & 7 deletions test/clj/game/cards/ice_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7182,18 +7182,55 @@
(do-game
(new-game {:corp {:hand ["Valentão"]}})
(play-from-hand state :corp "Valentão" "HQ")
(rez state :corp (get-ice state :hq 0))
(is (= 1 (count-bad-pub state)) "Gained 1 bad pub")))
(changes-val-macro
1 (count-bad-pub state)
"Corp got 1 bad publicity"
(rez state :corp (get-ice state :hq 0)))))

(deftest valentao-spend-tag
(do-game
(new-game {:corp {:hand ["Valentão"]}})
(new-game {:corp {:hand [(qty "Valentão" 2)]
:credits 20}
:runner {:hand ["Paparazzi"]}})
(play-from-hand state :corp "Valentão" "HQ")
(play-from-hand state :corp "Valentão" "R&D")
(gain-tags state :runner 1)
(rez state :corp (get-ice state :hq 0))
(click-prompt state :corp "tag")
(is (zero? (count-tags state)) "spent tag to rez")
(is (= 0 (count-bad-pub state)) "Gained 1 bad pub")))
(changes-val-macro
-1 (count-tags state)
"Removed 1 tag"
(rez state :corp (get-ice state :hq 0))
(click-prompt state :corp "Remove 1 tag"))
(is (zero? (count-bad-pub state)) "Got no bad publicity")
(take-credits state :corp)
(play-from-hand state :runner "Paparazzi")
(changes-val-macro
1 (count-bad-pub state)
"Corp got 1 bad publicity even if runner is considered tagged"
(rez state :corp (get-ice state :rd 0)))))

(deftest valentao-subs
(do-game
(new-game {:corp {:hand ["Valentão"]
:credits 10}})
(play-from-hand state :corp "Valentão" "HQ")
(take-credits state :corp)
(let [val (get-ice state :hq 0)]
(run-on state :hq)
(rez state :corp val)
(run-continue state)
(changes-val-macro
-2 (:credit (get-runner))
"Runner lost 2 credits"
(changes-val-macro
2 (:credit (get-corp))
"Corp gained 2 credits"
(fire-subs state (refresh val))))
(is (not (:run @state)) "Run ended")
(core/gain state :runner :credit 10)
(run-on state :hq)
(run-continue state)
(fire-subs state (refresh val))
(is (:run @state) "Run didn't end"))))

(deftest vampyronassa
;; Vampyronassa
Expand Down

0 comments on commit a75586a

Please sign in to comment.