* Conduit of Ruin - Fixed a problem with the spell cost reduction not working (#6698).

This commit is contained in:
LevelX2 2020-07-28 16:28:23 +02:00
parent af5a0bb405
commit c1ac2ac6ae
2 changed files with 55 additions and 3 deletions

View file

@ -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<UUID, Integer> playerCreatureSpells;
private final Map<UUID, Integer> playerCreatureSpells;
public ConduitOfRuinWatcher() {
super(WatcherScope.GAME);
@ -103,8 +104,8 @@ class FirstCastCreatureSpellPredicate implements ObjectPlayerPredicate<ObjectPla
@Override
public boolean apply(ObjectPlayer<Controllable> 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;
}

View file

@ -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);
}
}