diff --git a/Mage.Sets/src/mage/cards/m/MezzioMugger.java b/Mage.Sets/src/mage/cards/m/MezzioMugger.java new file mode 100644 index 00000000000..226beed5919 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MezzioMugger.java @@ -0,0 +1,92 @@ +package mage.cards.m; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.BlitzAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.players.Player; +import mage.util.CardUtil; + +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class MezzioMugger extends CardImpl { + + public MezzioMugger(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}"); + + this.subtype.add(SubType.VIASHINO); + this.subtype.add(SubType.ROGUE); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Whenever Mezzio Mugger attacks, exile the top card of each player's library. You may play those cards this turn, and you may spend mana as though it were mana of any color to cast those spells. + this.addAbility(new AttacksTriggeredAbility(new MezzioMuggerEffect())); + + // Blitz {2}{R} + this.addAbility(new BlitzAbility(this, "{2}{R}")); + } + + private MezzioMugger(final MezzioMugger card) { + super(card); + } + + @Override + public MezzioMugger copy() { + return new MezzioMugger(this); + } +} + +class MezzioMuggerEffect extends OneShotEffect { + + MezzioMuggerEffect() { + super(Outcome.Benefit); + staticText = "exile the top card of each player's library. You may play those cards this turn, " + + "and you may spend mana as though it were mana of any color to cast those spells"; + } + + private MezzioMuggerEffect(final MezzioMuggerEffect effect) { + super(effect); + } + + @Override + public MezzioMuggerEffect copy() { + return new MezzioMuggerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Set cards = game + .getOpponents(source.getControllerId()) + .stream() + .map(game::getPlayer) + .filter(Objects::nonNull) + .map(Player::getLibrary) + .map(library -> library.getFromTop(game)) + .filter(Objects::nonNull) + .collect(Collectors.toSet()); + if (cards.isEmpty()) { + return false; + } + player.moveCards(cards, Zone.EXILED, source, game); + for (Card card : cards) { + CardUtil.makeCardPlayable(game, source, card, Duration.EndOfTurn, true); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/NewCapennaCommander.java b/Mage.Sets/src/mage/sets/NewCapennaCommander.java index 46cf5c6d8fe..9f60fd50236 100644 --- a/Mage.Sets/src/mage/sets/NewCapennaCommander.java +++ b/Mage.Sets/src/mage/sets/NewCapennaCommander.java @@ -190,6 +190,7 @@ public final class NewCapennaCommander extends ExpansionSet { cards.add(new SetCardInfo("Martial Coup", 206, Rarity.RARE, mage.cards.m.MartialCoup.class)); cards.add(new SetCardInfo("Mask of Riddles", 347, Rarity.UNCOMMON, mage.cards.m.MaskOfRiddles.class)); cards.add(new SetCardInfo("Mask of the Schemer", 28, Rarity.RARE, mage.cards.m.MaskOfTheSchemer.class)); + cards.add(new SetCardInfo("Mezzio Mugger", 49, Rarity.RARE, mage.cards.m.MezzioMugger.class)); cards.add(new SetCardInfo("Midnight Clock", 226, Rarity.RARE, mage.cards.m.MidnightClock.class)); cards.add(new SetCardInfo("Migration Path", 301, Rarity.UNCOMMON, mage.cards.m.MigrationPath.class)); cards.add(new SetCardInfo("Mimic Vat", 372, Rarity.RARE, mage.cards.m.MimicVat.class));