diff --git a/Mage.Sets/src/mage/cards/h/HeartlessConscription.java b/Mage.Sets/src/mage/cards/h/HeartlessConscription.java new file mode 100644 index 00000000000..ae645702c35 --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HeartlessConscription.java @@ -0,0 +1,85 @@ +package mage.cards.h; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileSpellEffect; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class HeartlessConscription extends CardImpl { + + public HeartlessConscription(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{6}{B}{B}"); + + // Exile all creatures. For each card exiled this way, you may play that card for as long as it remains exiled, and mana of any type can be spent to cast that spell. Exile Heartless Conscription. + this.getSpellAbility().addEffect(new HeartlessConscriptionEffect()); + this.getSpellAbility().addEffect(new ExileSpellEffect()); + } + + private HeartlessConscription(final HeartlessConscription card) { + super(card); + } + + @Override + public HeartlessConscription copy() { + return new HeartlessConscription(this); + } +} + +class HeartlessConscriptionEffect extends OneShotEffect { + + HeartlessConscriptionEffect() { + super(Outcome.Exile); + staticText = "Exile all creatures. " + + "For each card exiled this way, you may play that card for as long as it remains exiled, " + + "and mana of any type can be spent to cast that spell."; + } + + private HeartlessConscriptionEffect(final HeartlessConscriptionEffect effect) { + super(effect); + } + + @Override + public HeartlessConscriptionEffect copy() { + return new HeartlessConscriptionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Cards cards = new CardsImpl(); + game.getBattlefield() + .getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), source, game) + .stream() + .forEach(cards::add); + if (cards.isEmpty()) { + return false; + } + player.moveCardsToExile( + cards.getCards(game), source, game, true, + CardUtil.getExileZoneId(game, source), CardUtil.getSourceName(game, source) + ); + game.getState().processAction(game); + cards.retainZone(Zone.EXILED, game); + for (Card card : cards.getCards(game)) { + CardUtil.makeCardPlayable(game, source, card, Duration.EndOfGame, true); + } + return true; + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/OutlawsOfThunderJunctionCommander.java b/Mage.Sets/src/mage/sets/OutlawsOfThunderJunctionCommander.java index ef935b9ea8e..15c9d363fd1 100644 --- a/Mage.Sets/src/mage/sets/OutlawsOfThunderJunctionCommander.java +++ b/Mage.Sets/src/mage/sets/OutlawsOfThunderJunctionCommander.java @@ -137,6 +137,7 @@ public final class OutlawsOfThunderJunctionCommander extends ExpansionSet { cards.add(new SetCardInfo("Hashep Oasis", 299, Rarity.UNCOMMON, mage.cards.h.HashepOasis.class)); cards.add(new SetCardInfo("Haughty Djinn", 99, Rarity.RARE, mage.cards.h.HaughtyDjinn.class)); cards.add(new SetCardInfo("Hazezon, Shaper of Sand", 229, Rarity.RARE, mage.cards.h.HazezonShaperOfSand.class)); + cards.add(new SetCardInfo("Heartless Conscription", 21, Rarity.RARE, mage.cards.h.HeartlessConscription.class)); cards.add(new SetCardInfo("Heaven // Earth", 230, Rarity.RARE, mage.cards.h.HeavenEarth.class)); cards.add(new SetCardInfo("Heliod's Intervention", 81, Rarity.RARE, mage.cards.h.HeliodsIntervention.class)); cards.add(new SetCardInfo("Hex", 136, Rarity.RARE, mage.cards.h.Hex.class)); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/otc/HeartlessConscriptionTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/otc/HeartlessConscriptionTest.java new file mode 100644 index 00000000000..18abdb368e1 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/otc/HeartlessConscriptionTest.java @@ -0,0 +1,45 @@ +package org.mage.test.cards.single.otc; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author Susucr + */ +public class HeartlessConscriptionTest extends CardTestPlayerBase { + + /** + * {@link mage.cards.h.HeartlessConscription Heartless Conscription} {6}{B}{B} + * Sorcery + * Exile all creatures. For each card exiled this way, you may play that card for as long as it remains exiled, and mana of any type can be spent to cast that spell. Exile Heartless Conscription. + */ + private static final String conscription = "Heartless Conscription"; + + @Test + public void test_Simple() { + setStrictChooseMode(true); + + addCard(Zone.HAND, playerA, conscription); + addCard(Zone.BATTLEFIELD, playerA, "Elite Vanguard"); + addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker"); + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, conscription, true); + checkExileCount("Elite Vanguard in exile", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Elite Vanguard", 1); + checkExileCount("Goblin Piker in exile", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Goblin Piker", 1); + checkExileCount(conscription + " in exile", 1, PhaseStep.PRECOMBAT_MAIN, playerA, conscription, 1); + + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Goblin Piker"); + + castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Elite Vanguard"); + + setStopAt(3, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, "Goblin Piker", 1); + assertPermanentCount(playerA, "Elite Vanguard", 1); + assertTappedCount("Swamp", true, 1); + } +}