Skip to content

Commit

Permalink
Merge pull request mtgred#3873 from jwarwick/woke
Browse files Browse the repository at this point in the history
Fix crash using DDoS and Awakening Center
nealterrell authored Sep 24, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents a745526 + 057a0b7 commit bc1375b
Showing 2 changed files with 55 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/clj/game/cards/resources.clj
Original file line number Diff line number Diff line change
@@ -562,11 +562,13 @@
(register-turn-flag!
card :can-rez
(fn [state side card]
(if (and (ice? card)
(= (count (get-in @state (concat [:corp :servers] (:server (:run @state)) [:ices])))
(inc (ice-index state card))))
((constantly false) (toast state :corp "Cannot rez any outermost ICE due to DDoS." "warning"))
true)))
(let [idx (ice-index state card)]
(if (and (ice? card)
idx
(= (count (get-in @state (concat [:corp :servers] (:server (:run @state)) [:ices])))
(inc idx)))
((constantly false) (toast state :corp "Cannot rez any outermost ICE due to DDoS." "warning"))
true))))
(trash card {:cause :ability-cost}))}]}

"Dean Lister"
48 changes: 48 additions & 0 deletions test/clj/game_test/cards/upgrades.clj
Original file line number Diff line number Diff line change
@@ -99,6 +99,54 @@
(click-prompt state :runner "Pay 3 [Credits] to trash")
(is (not (:run @state)) "Accessing Ash then ends the run"))))

(deftest awakening-center
;; Awakening Center
(testing "Basic Operation"
(do-game
(new-game (default-corp ["Awakening Center" "Fairchild"])
(default-runner))
(play-from-hand state :corp "Awakening Center" "New remote")
(let [ac (get-content state :remote1 0)]
(core/rez state :corp ac)
(card-ability state :corp (refresh ac) 0)
(click-card state :corp (find-card "Fairchild" (:hand (get-corp))))
(let [fc (first (:hosted (refresh ac)))]
(is (= "Fairchild" (:title (refresh fc))) "Fairchild hosted on Awakening Center")
(is (not (:rezzed (refresh fc))) "Fairchild is not rezzed")
(is (empty? (:hand (get-corp))) "Fairchild removed from hand")
(take-credits state :corp)
(run-empty-server state "Server 1")
(card-ability state :corp (refresh ac) 1)
(click-prompt state :corp "Fairchild")
(is (:rezzed (refresh fc)) "Fairchild is rezzed")
(click-prompt state :runner "Done")
(is (not (:run @state)) "Run has ended")
(is (= 1 (count (:discard (get-corp)))) "Fairchild in discard")
(is (empty? (:hosted (refresh ac))) "Fairchild no longer hosted")))))
(testing "DDoS Interaction"
(do-game
(new-game (default-corp ["Awakening Center" "Fairchild"])
(default-runner ["DDoS"]))
(play-from-hand state :corp "Awakening Center" "New remote")
(let [ac (get-content state :remote1 0)]
(core/rez state :corp ac)
(card-ability state :corp (refresh ac) 0)
(click-card state :corp (find-card "Fairchild" (:hand (get-corp))))
(let [fc (first (:hosted (refresh ac)))]
(is (= "Fairchild" (:title (refresh fc))) "Fairchild hosted on Awakening Center")
(take-credits state :corp)
(play-from-hand state :runner "DDoS")
(card-ability state :runner (get-resource state 0) 0)
(is (= 1 (count (:discard (get-runner)))) "DDoS trashed")
(run-empty-server state "Server 1")
(card-ability state :corp (refresh ac) 1)
(click-prompt state :corp "Fairchild")
(is (:rezzed (refresh fc)) "Fairchild is rezzed")
(click-prompt state :runner "Done")
(is (not (:run @state)) "Run has ended")
(is (= 1 (count (:discard (get-corp)))) "Fairchild in discard")
(is (empty? (:hosted (refresh ac))) "Fairchild no longer hosted"))))))

(deftest ben-musashi
;; Ben Musashi
(testing "Basic test - pay 2 net damage to steal from this server"

0 comments on commit bc1375b

Please sign in to comment.