diff --git a/Mage.Sets/src/mage/cards/g/GlacialRevelation.java b/Mage.Sets/src/mage/cards/g/GlacialRevelation.java new file mode 100644 index 00000000000..1b18825a5c5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GlacialRevelation.java @@ -0,0 +1,84 @@ +package mage.cards.g; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SuperType; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.common.FilterPermanentCard; +import mage.filter.predicate.mageobject.SupertypePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInHand; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GlacialRevelation extends CardImpl { + + public GlacialRevelation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}"); + + // Reveal the top six cards of your library. You may put any number of snow permanent cards from among them into your hand. Put the rest into your graveyard. + this.getSpellAbility().addEffect(new GlacialRevelationEffect()); + } + + private GlacialRevelation(final GlacialRevelation card) { + super(card); + } + + @Override + public GlacialRevelation copy() { + return new GlacialRevelation(this); + } +} + +class GlacialRevelationEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterPermanentCard("snow permanent cards"); + + static { + filter.add(new SupertypePredicate(SuperType.SNOW)); + } + + GlacialRevelationEffect() { + super(Outcome.Benefit); + staticText = "Reveal the top six cards of your library. You may put any number of snow permanent cards " + + "from among them into your hand. Put the rest into your graveyard."; + } + + private GlacialRevelationEffect(final GlacialRevelationEffect effect) { + super(effect); + } + + @Override + public GlacialRevelationEffect copy() { + return new GlacialRevelationEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 6)); + player.revealCards(source, cards, game); + TargetCard targetCard = new TargetCardInHand(0, Integer.MAX_VALUE, filter); + if (player.choose(outcome, cards, targetCard, game)) { + Cards toHand = new CardsImpl(targetCard.getTargets()); + cards.removeAll(targetCard.getTargets()); + player.moveCards(toHand, Zone.HAND, source, game); + } + return player.moveCards(cards, Zone.GRAVEYARD, source, game); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ModernHorizons.java b/Mage.Sets/src/mage/sets/ModernHorizons.java index 4ce6baa24b6..a6c0c1b84bf 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons.java @@ -51,6 +51,7 @@ public final class ModernHorizons extends ExpansionSet { cards.add(new SetCardInfo("Force of Virtue", 10, Rarity.RARE, mage.cards.f.ForceOfVirtue.class)); cards.add(new SetCardInfo("Frostwalk Bastion", 240, Rarity.UNCOMMON, mage.cards.f.FrostwalkBastion.class)); cards.add(new SetCardInfo("Generous Gift", 11, Rarity.UNCOMMON, mage.cards.g.GenerousGift.class)); + cards.add(new SetCardInfo("Glacial Revelation", 167, Rarity.UNCOMMON, mage.cards.g.GlacialRevelation.class)); cards.add(new SetCardInfo("Goblin Engineer", 128, Rarity.RARE, mage.cards.g.GoblinEngineer.class)); cards.add(new SetCardInfo("Goblin Matron", 129, Rarity.UNCOMMON, mage.cards.g.GoblinMatron.class)); cards.add(new SetCardInfo("Goblin War Party", 131, Rarity.COMMON, mage.cards.g.GoblinWarParty.class));