Skip to content

Commit

Permalink
Merge pull request #6951 from francescopellegrini/fix-fc-subs-when-ru…
Browse files Browse the repository at this point in the history
…nner-cannot-pay

fix Fairchild N.0 subs when runner cannot pay either costs
  • Loading branch information
NoahTheDuke authored Jul 8, 2023
2 parents caf2476 + 3948222 commit 95e555f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/clj/game/cards/assets.clj
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,8 @@
:waiting-prompt true
:choices (req [(when (can-pay? state :runner eid card nil [:credit 1])
"Pay 1 [Credits]")
(when (seq (:deck runner))
(when (or (not (can-pay? state :runner eid card nil [:credit 1]))
(seq (:deck runner)))
"Trash the top card of the stack")])
:label "make the Runner pay 1 [Credits] or trash the top card of the stack (start of turn)"
:msg (msg "force the Runner to " (decapitalize target))
Expand Down
12 changes: 9 additions & 3 deletions src/clj/game/cards/ice.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,9 @@
:waiting-prompt true
:choices (req [(when (can-pay? state :runner eid card nil [:credit 1])
"Pay 1 [Credits]")
"Trash an installed card"])
(when (or (not (can-pay? state :runner eid card nil [:credit 1]))
(can-pay? state :runner eid card nil [:trash-installed 1]))
"Trash an installed card")])
:async true
:effect (req (if (= target "Pay 1 [Credits]")
(wait-for (pay state side (make-eid state eid) card :credit 1)
Expand All @@ -1489,7 +1491,9 @@
:waiting-prompt true
:choices (req [(when (can-pay? state :runner eid card nil [:credit 2])
"Pay 2 [Credits]")
"Trash an installed card"])
(when (or (not (can-pay? state :runner eid card nil [:credit 2]))
(can-pay? state :runner eid card nil [:trash-installed 1]))
"Trash an installed card")])
:async true
:effect (req (if (= target "Pay 2 [Credits]")
(wait-for (pay state side (make-eid state eid) card :credit 2)
Expand All @@ -1509,7 +1513,9 @@
:waiting-prompt true
:choices (req [(when (can-pay? state :runner eid card nil [:credit 3])
"Pay 3 [Credits]")
"Trash an installed card"])
(when (or (not (can-pay? state :runner eid card nil [:credit 3]))
(can-pay? state :runner eid card nil [:trash-installed 1]))
"Trash an installed card")])
:async true
:effect (req (if (= target "Pay 3 [Credits]")
(wait-for (pay state side (make-eid state eid) card :credit 3)
Expand Down
22 changes: 22 additions & 0 deletions test/clj/game/cards/ice_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,28 @@
(click-card state :runner "Clone Chip")
(is (empty? (get-hardware state)) "Sac Con trashed"))))

(deftest fairchild-1-0-runner-cannoy-pay
;; Fairchild 1.0 - runner has no credits nor cards installed
(do-game
(new-game {:corp {:deck ["Fairchild 1.0"]}
:runner {:credits 1}})
(play-from-hand state :corp "Fairchild 1.0" "HQ")
(take-credits state :corp)
(let [fc1 (get-ice state :hq 0)]
(run-on state "HQ")
(rez state :corp fc1)
(run-continue state)
(card-subroutine state :corp fc1 0)
(is (= 1 (count (:choices (prompt-map :runner)))) "Only 1 choice in prompt")
(changes-val-macro
-1 (:credit (get-runner))
"Paid 1c for subroutine"
(click-prompt state :runner "Pay 1 [Credits]"))
(card-subroutine state :corp fc1 1)
(is (= 1 (count (:choices (prompt-map :runner)))) "Only 1 choice in prompt")
(click-prompt state :runner "Trash an installed card")
(click-prompt state :runner "Done"))))

(deftest fairchild-2-0
;; Fairchild 2.0
(do-game
Expand Down

0 comments on commit 95e555f

Please sign in to comment.