From 51f97ca221124b16f6d216d5bd414ad31a755389 Mon Sep 17 00:00:00 2001 From: Noah Date: Fri, 16 Aug 2019 16:17:34 -0400 Subject: [PATCH] Merge Tithonium subs --- src/clj/game/cards/ice.clj | 27 ++++++++++++++++++++------- test/clj/game_test/cards/ice.clj | 6 +++--- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/clj/game/cards/ice.clj b/src/clj/game/cards/ice.clj index 30d1e89d2a..24b374ac72 100644 --- a/src/clj/game/cards/ice.clj +++ b/src/clj/game/cards/ice.clj @@ -1,7 +1,7 @@ (ns game.cards.ice (:require [game.core :refer :all] [game.core.card :refer :all] - [game.core.eid :refer [make-eid effect-completed]] + [game.core.eid :refer [make-eid effect-completed complete-with-result]] [game.core.card-defs :refer [card-def]] [game.core.prompts :refer [show-wait-prompt clear-wait-prompt]] [game.core.toasts :refer [toast]] @@ -2695,13 +2695,26 @@ :cannot-host true :subroutines [trash-program trash-program - end-the-run - {:label "Trash a resource" - :msg (msg "trash " (:title target)) + {:label "Trash a resource and end the run" :async true - :choices {:req #(and (installed? %) - (resource? %))} - :effect (effect (trash target {:reason :subroutine}))}]} + :effect (req (wait-for + (resolve-ability + state side + {:req (req (pos? (count (filter resource? (all-installed state :runner))))) + :async true + :choices {:all true + :req #(and (installed? %) + (resource? %))} + :effect (req (wait-for (trash state side target {:cause :subroutine}) + (complete-with-result state side eid target)))} + card nil) + (system-msg state side + (str "uses Tithonium to " + (if async-result + (str "trash " (:title async-result) + " and ends the run") + "end the run"))) + (end-run state side eid card)))}]} "TL;DR" {:implementation "Subroutine-adding is manual" diff --git a/test/clj/game_test/cards/ice.clj b/test/clj/game_test/cards/ice.clj index 484d43f3c4..074b9a347f 100644 --- a/test/clj/game_test/cards/ice.clj +++ b/test/clj/game_test/cards/ice.clj @@ -2351,12 +2351,12 @@ (card-ability state :runner (refresh pawn) 0) (click-card state :runner (refresh ti)) (is (= 2 (count (:hosted (refresh ti)))) "2 cards on Tithonium") - (core/derez state :corp (refresh ti)) - (is (= 2 (count (:hosted (refresh ti)))) "2 cards on Tithonium") (run-on state "HQ") - (card-subroutine state :corp ti 3) + (card-subroutine state :corp ti 2) (click-card state :corp (refresh wast)) (is (= 1 (count (:discard (get-runner)))) "1 card trashed") + (is (not (:run @state)) "Run ended") + (run-on state "HQ") (card-subroutine state :corp ti 2) (is (not (:run @state)) "Run ended"))))) (testing "Do not prompt for alt cost #2734"