[KHM] updated Draugr Necromancer, added test (#7620)

This commit is contained in:
Evan Kranzler 2021-02-23 19:11:21 -05:00
parent bac2585d83
commit f5f7638216
2 changed files with 199 additions and 5 deletions

View file

@ -19,6 +19,7 @@ import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken; import mage.game.permanent.PermanentToken;
import mage.players.ManaPoolItem; import mage.players.ManaPoolItem;
import mage.players.Player; import mage.players.Player;
import mage.util.CardUtil;
import java.util.UUID; import java.util.UUID;
@ -83,7 +84,7 @@ class DraugrNecromancerReplacementEffect extends ReplacementEffectImpl {
} }
Card card = game.getCard(permanent.getId()); Card card = game.getCard(permanent.getId());
controller.moveCards(permanent, Zone.EXILED, source, game); controller.moveCards(permanent, Zone.EXILED, source, game);
card.addCounters(CounterType.ICE.createInstance(), source.getControllerId(), source, game); card.getMainCard().addCounters(CounterType.ICE.createInstance(), source.getControllerId(), source, game);
return true; return true;
} }
@ -132,7 +133,7 @@ class DraugrNecromancerCastFromExileEffect extends AsThoughEffectImpl {
return card != null return card != null
&& !card.isLand() && !card.isLand()
&& game.getOpponents(card.getOwnerId()).contains(source.getControllerId()) && game.getOpponents(card.getOwnerId()).contains(source.getControllerId())
&& card.getCounters(game).getCount(CounterType.ICE) > 0; && card.getMainCard().getCounters(game).getCount(CounterType.ICE) > 0;
} }
} }
@ -165,11 +166,11 @@ class DraugrNecromancerSpendAnyManaEffect extends AsThoughEffectImpl implements
} }
Card card = game.getCard(sourceId); Card card = game.getCard(sourceId);
if (card != null if (card != null
&& game.getState().getZone(sourceId) == Zone.EXILED && game.getState().getZone(card.getId()) == Zone.EXILED
&& card.getCounters(game).getCount(CounterType.ICE) > 0) { && card.getMainCard().getCounters(game).getCount(CounterType.ICE) > 0) {
return true; return true;
} }
CardState cardState = game.getLastKnownInformationCard(sourceId, Zone.EXILED); CardState cardState = game.getLastKnownInformationCard(CardUtil.getMainCardId(game, sourceId), Zone.EXILED);
return cardState != null && cardState.getCounters().getCount(CounterType.ICE) > 0; return cardState != null && cardState.getCounters().getCount(CounterType.ICE) > 0;
} }

View file

@ -3,6 +3,7 @@ package org.mage.test.cards.single.khm;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
@ -14,6 +15,10 @@ public class DraugrNecromancerTest extends CardTestPlayerBase {
private static final String necromancer = "Draugr Necromancer"; private static final String necromancer = "Draugr Necromancer";
private static final String bolt = "Lightning Bolt"; private static final String bolt = "Lightning Bolt";
private static final String bear = "Grizzly Bears"; private static final String bear = "Grizzly Bears";
private static final String murder = "Murder";
private static final String pair = "Curious Pair";
private static final String birgi = "Birgi, God of Storytelling";
private static final String harnfel = "Harnfel, Horn of Bounty";
@Test @Test
public void testExilesWithCounter() { public void testExilesWithCounter() {
@ -91,4 +96,192 @@ public class DraugrNecromancerTest extends CardTestPlayerBase {
assertCounterOnExiledCardCount(bear, CounterType.ICE, 1); assertCounterOnExiledCardCount(bear, CounterType.ICE, 1);
assertPermanentCount(playerA, bear, 0); assertPermanentCount(playerA, bear, 0);
} }
@Test
public void testCastAdventureCreatureFromExile() {
addCard(Zone.BATTLEFIELD, playerA, necromancer);
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
addCard(Zone.HAND, playerA, bolt);
addCard(Zone.BATTLEFIELD, playerB, pair);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, pair);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, pair);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertExileCount(playerB, pair, 0);
assertPermanentCount(playerA, pair, 1);
}
@Ignore
@Test
public void testCastAdventureSpellFromExile() {
addCard(Zone.BATTLEFIELD, playerA, necromancer);
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Forest");
addCard(Zone.HAND, playerA, bolt);
addCard(Zone.BATTLEFIELD, playerB, pair);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, pair);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Treats to Share");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertExileCount(playerB, pair, 0);
assertGraveyardCount(playerB, pair, 1);
assertPermanentCount(playerA, "Food", 1);
}
@Test
public void testCastAdventureCreatureFromExileWithSnow() {
addCard(Zone.BATTLEFIELD, playerA, necromancer);
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Snow-Covered Swamp", 2);
addCard(Zone.HAND, playerA, bolt);
addCard(Zone.BATTLEFIELD, playerB, pair);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, pair);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, pair);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertExileCount(playerB, pair, 0);
assertPermanentCount(playerA, pair, 1);
}
@Ignore
@Test
public void testCastAdventureSpellFromExileWithSnow() {
addCard(Zone.BATTLEFIELD, playerA, necromancer);
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Snow-Covered Swamp");
addCard(Zone.HAND, playerA, bolt);
addCard(Zone.BATTLEFIELD, playerB, pair);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, pair);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Treats to Share");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertExileCount(playerB, pair, 0);
assertGraveyardCount(playerB, pair, 1);
assertPermanentCount(playerA, "Food", 1);
}
@Test
public void testCastMDFCFrontFromExile() {
addCard(Zone.BATTLEFIELD, playerA, necromancer);
addCard(Zone.BATTLEFIELD, playerA, "Badlands", 6);
addCard(Zone.HAND, playerA, murder);
addCard(Zone.HAND, playerB, birgi);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, birgi);
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, murder, birgi);
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, birgi);
setStrictChooseMode(true);
setStopAt(3, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, birgi, 1);
assertGraveyardCount(playerB, birgi, 0);
assertExileCount(playerB, birgi, 0);
}
@Test
public void testCastMDFCBackFromExile() {
addCard(Zone.BATTLEFIELD, playerA, necromancer);
addCard(Zone.BATTLEFIELD, playerA, "Badlands", 8);
addCard(Zone.HAND, playerA, murder);
addCard(Zone.HAND, playerB, birgi);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, birgi);
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, murder, birgi);
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, harnfel);
setStrictChooseMode(true);
setStopAt(3, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, harnfel, 1);
assertPermanentCount(playerA, birgi, 0);
assertGraveyardCount(playerB, birgi, 0);
assertExileCount(playerB, birgi, 0);
}
@Ignore
@Test
public void testCastMDFCFrontFromExileWithSnow() {
addCard(Zone.BATTLEFIELD, playerA, necromancer);
addCard(Zone.BATTLEFIELD, playerA, "Snow-Covered Swamp", 6);
addCard(Zone.HAND, playerA, murder);
addCard(Zone.HAND, playerB, birgi);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, birgi);
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, murder, birgi);
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, birgi);
setStrictChooseMode(true);
setStopAt(3, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, birgi, 1);
assertGraveyardCount(playerB, birgi, 0);
assertExileCount(playerB, birgi, 0);
}
@Ignore
@Test
public void testCastMDFCBackFromExileWithSnow() {
addCard(Zone.BATTLEFIELD, playerA, necromancer);
addCard(Zone.BATTLEFIELD, playerA, "Snow-Covered Swamp", 8);
addCard(Zone.HAND, playerA, murder);
addCard(Zone.HAND, playerB, birgi);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, birgi);
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, murder, birgi);
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, harnfel);
setStrictChooseMode(true);
setStopAt(3, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, harnfel, 1);
assertPermanentCount(playerA, birgi, 0);
assertGraveyardCount(playerB, birgi, 0);
assertExileCount(playerB, birgi, 0);
}
} }