From c1ac2ac6aea6b2ce8735bb15e2328572f7bfbe21 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 28 Jul 2020 16:28:23 +0200 Subject: [PATCH] * Conduit of Ruin - Fixed a problem with the spell cost reduction not working (#6698). --- Mage.Sets/src/mage/cards/c/ConduitOfRuin.java | 7 +-- .../cards/single/bfz/ConduitOfRuinTest.java | 51 +++++++++++++++++++ 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/ConduitOfRuinTest.java diff --git a/Mage.Sets/src/mage/cards/c/ConduitOfRuin.java b/Mage.Sets/src/mage/cards/c/ConduitOfRuin.java index 3e857fc82d..7a86616f97 100644 --- a/Mage.Sets/src/mage/cards/c/ConduitOfRuin.java +++ b/Mage.Sets/src/mage/cards/c/ConduitOfRuin.java @@ -10,6 +10,7 @@ import mage.abilities.effects.Effect; import mage.abilities.effects.common.CastSourceTriggeredAbility; import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect; import mage.abilities.effects.common.search.SearchLibraryPutOnLibraryEffect; +import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -71,7 +72,7 @@ public final class ConduitOfRuin extends CardImpl { class ConduitOfRuinWatcher extends Watcher { - private Map playerCreatureSpells; + private final Map playerCreatureSpells; public ConduitOfRuinWatcher() { super(WatcherScope.GAME); @@ -103,8 +104,8 @@ class FirstCastCreatureSpellPredicate implements ObjectPlayerPredicate input, Game game) { - if (input.getObject() instanceof Spell - && ((Spell) input.getObject()).isCreature()) { + if (input.getObject() instanceof Card + && ((Card) input.getObject()).isCreature()) { ConduitOfRuinWatcher watcher = game.getState().getWatcher(ConduitOfRuinWatcher.class); return watcher != null && watcher.creatureSpellsCastThisTurn(input.getPlayerId()) == 0; } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/ConduitOfRuinTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/ConduitOfRuinTest.java new file mode 100644 index 0000000000..44aca020c9 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/ConduitOfRuinTest.java @@ -0,0 +1,51 @@ +package org.mage.test.cards.single.bfz; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ + +public class ConduitOfRuinTest extends CardTestPlayerBase { + + @Test + public void testCast() { + setStrictChooseMode(true); + + // Emrakul, the Aeons Torn can't be countered. + // When you cast Emrakul, take an extra turn after this one. + // Flying, protection from colored spells, annihilator 6 + // When Emrakul is put into a graveyard from anywhere, its owner shuffles their graveyard into their library. + addCard(Zone.LIBRARY, playerA, "Emrakul, the Aeons Torn"); // Creature {15} 15/15 + + // When you cast Conduit of Ruin, you may search your library for a colorless creature card with converted mana cost 7 or greater, then shuffle your library and put that card on top of it. + // The first creature spell you cast each turn costs {2} less to cast. + addCard(Zone.HAND, playerA, "Conduit of Ruin"); // Creature {6} 5/5 + addCard(Zone.BATTLEFIELD, playerA, "Plains", 13); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Conduit of Ruin"); + setChoice(playerA, "Yes"); // When you cast this spell, you may search... + addTarget(playerA, "Emrakul, the Aeons Torn"); + + setStopAt(3, PhaseStep.DRAW); + + execute(); + + assertLibraryCount(playerA, "Emrakul, the Aeons Torn", 0); + assertHandCount(playerA, "Emrakul, the Aeons Torn", 1); + + castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Emrakul, the Aeons Torn"); + + setStopAt(3, PhaseStep.BEGIN_COMBAT); + execute(); + + assertAllCommandsUsed(); + + assertPermanentCount(playerA, "Conduit of Ruin", 1); + assertPermanentCount(playerA, "Emrakul, the Aeons Torn", 1); + } +} \ No newline at end of file