Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/clj/game/cards/programs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2858,22 +2858,15 @@

(defcard "Read-Write Share"
(let [ab {:interactive (req true)
:req (req (< (count (:hosted card)) 4))
:prompt "Host a card from your grip to draw a card?"
:choices {:req (req (and (runner? target)
(in-hand? target)))}
:skippable true
:msg "host a card facedown from the Grip and draw a card"
:async true
:effect (req (host state side (get-card state card) target {:facedown true})
(wait-for (draw state side 1)
(if (>= (count (:hosted (get-card state card))) 5)
(continue-ability
state side
{:msg "trash itself"
:async true
:effect (req (trash state side eid card))}
card nil)
(effect-completed state side eid))))}]
(draw state side eid 1))}]
{:on-install ab
:events [(assoc ab :event :runner-turn-begins)]
:abilities [{:fake-cost [(->c :trash-can)]
Expand Down
23 changes: 23 additions & 0 deletions test/clj/game/cards/programs_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7480,6 +7480,29 @@
(card-ability state :runner (get-program state 0) 0)
(is-deck? state :runner ["Corroder" "Rezeki"])))

(deftest read-write-share-limit-4-hosted
;; Should not allow hosting a 5th card (limit 4 hosted cards)
(do-game
(new-game {:runner {:hand ["Read-Write Share" "Sure Gamble" "Sure Gamble" "Sure Gamble" "Sure Gamble"]
:deck [(qty "Sure Gamble" 10)]}})
(take-credits state :corp)
(play-from-hand state :runner "Read-Write Share")
;; host 1st card on install
(click-card state :runner (first (:hand (get-runner))))
(is (= 1 (count (:hosted (get-program state 0)))) "1 hosted card")
;; host 2nd-4th cards on turn begins
(dotimes [i 3]
(take-credits state :runner)
(take-credits state :corp)
(start-turn state :runner)
(click-card state :runner (first (:hand (get-runner))))
(is (= (+ 2 i) (count (:hosted (get-program state 0)))) (str (+ 2 i) " hosted cards")))
;; should not prompt to host a 5th card
(take-credits state :runner)
(take-credits state :corp)
(start-turn state :runner)
(is (no-prompt? state :runner) "No prompt to host a 5th card")))

(deftest reaver
;; Reaver - Draw a card the first time you trash an installed card each turn
(do-game
Expand Down
Loading