diff --git a/Mage.Sets/src/mage/cards/b/BreachTheMultiverse.java b/Mage.Sets/src/mage/cards/b/BreachTheMultiverse.java new file mode 100644 index 0000000000..fac2a975b7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BreachTheMultiverse.java @@ -0,0 +1,95 @@ +package mage.cards.b; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.MillCardsEachPlayerEffect; +import mage.abilities.effects.common.continuous.AddCardSubtypeAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BreachTheMultiverse extends CardImpl { + + public BreachTheMultiverse(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{B}{B}"); + + // Each player mills ten cards. For each player, choose a creature or planeswalker card in that player's graveyard. Put those cards onto the battlefield under your control. Then each creature you control becomes a Phyrexian in addition to its other types. + this.getSpellAbility().addEffect(new MillCardsEachPlayerEffect(10, TargetController.EACH_PLAYER)); + this.getSpellAbility().addEffect(new BreachTheMultiverseEffect()); + this.getSpellAbility().addEffect(new AddCardSubtypeAllEffect( + StaticFilters.FILTER_CONTROLLED_CREATURE, SubType.PHYREXIAN, DependencyType.AddingCreatureType + ).setText("Then each creature you control becomes a Phyrexian in addition to its other types")); + } + + private BreachTheMultiverse(final BreachTheMultiverse card) { + super(card); + } + + @Override + public BreachTheMultiverse copy() { + return new BreachTheMultiverse(this); + } +} + +class BreachTheMultiverseEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterCard("creature or planeswalker card"); + + static { + filter.add(Predicates.or( + CardType.CREATURE.getPredicate(), + CardType.PLANESWALKER.getPredicate() + )); + } + + BreachTheMultiverseEffect() { + super(Outcome.Benefit); + staticText = "For each player, choose a creature or planeswalker card in that player's graveyard. " + + "Put those cards onto the battlefield under your control"; + } + + private BreachTheMultiverseEffect(final BreachTheMultiverseEffect effect) { + super(effect); + } + + @Override + public BreachTheMultiverseEffect copy() { + return new BreachTheMultiverseEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + Cards cards = new CardsImpl(); + TargetCard target = new TargetCardInGraveyard(filter); + target.setNotTarget(true); + for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null || player.getGraveyard().count(filter, game) < 1) { + continue; + } + target.clearChosen(); + target.withChooseHint("from " + player.getName() + "'s graveyard"); + controller.choose(Outcome.PutCreatureInPlay, player.getGraveyard(), target, game); + cards.add(target.getFirstTarget()); + } + return controller.moveCards(cards, Zone.BATTLEFIELD, source, game); + } +} diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java index aa9986d8cf..7d67ef84e6 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java @@ -58,6 +58,7 @@ public final class MarchOfTheMachine extends ExpansionSet { cards.add(new SetCardInfo("Bonded Herdbeast", 178, Rarity.COMMON, mage.cards.b.BondedHerdbeast.class)); cards.add(new SetCardInfo("Boon-Bringer Valkyrie", 9, Rarity.RARE, mage.cards.b.BoonBringerValkyrie.class)); cards.add(new SetCardInfo("Borborygmos and Fblthp", 219, Rarity.MYTHIC, mage.cards.b.BorborygmosAndFblthp.class)); + cards.add(new SetCardInfo("Breach the Multiverse", 94, Rarity.RARE, mage.cards.b.BreachTheMultiverse.class)); cards.add(new SetCardInfo("Burning Sun's Fury", 133, Rarity.COMMON, mage.cards.b.BurningSunsFury.class)); cards.add(new SetCardInfo("Burnished Dunestomper", 43, Rarity.COMMON, mage.cards.b.BurnishedDunestomper.class)); cards.add(new SetCardInfo("Captive Weird", 49, Rarity.UNCOMMON, mage.cards.c.CaptiveWeird.class));