diff --git a/Mage.Sets/src/mage/cards/t/TappingAtTheWindow.java b/Mage.Sets/src/mage/cards/t/TappingAtTheWindow.java new file mode 100644 index 00000000000..5b6fa979fbc --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TappingAtTheWindow.java @@ -0,0 +1,81 @@ +package mage.cards.t; + +import mage.abilities.Ability; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlashbackAbility; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TappingAtTheWindow extends CardImpl { + + public TappingAtTheWindow(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}"); + + // Look at the top three cards of your library. You may reveal a creature card from among them and put it into your hand. Put the rest into your graveyard. + this.getSpellAbility().addEffect(new TappingAtTheWindowEffect()); + + // Flashback {2}{G} + this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{2}{G}"))); + } + + private TappingAtTheWindow(final TappingAtTheWindow card) { + super(card); + } + + @Override + public TappingAtTheWindow copy() { + return new TappingAtTheWindow(this); + } +} + +class TappingAtTheWindowEffect extends OneShotEffect { + + TappingAtTheWindowEffect() { + super(Outcome.Benefit); + staticText = "look at the top three cards of your library. You may reveal a creature card " + + "from among them and put it into your hand. Put the rest into your graveyard"; + } + + private TappingAtTheWindowEffect(final TappingAtTheWindowEffect effect) { + super(effect); + } + + @Override + public TappingAtTheWindowEffect copy() { + return new TappingAtTheWindowEffect(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, 3)); + TargetCard target = new TargetCardInLibrary( + 0, 1, StaticFilters.FILTER_CARD_CREATURE + ); + player.choose(outcome, cards, target, game); + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + player.revealCards(source, new CardsImpl(card), game); + player.moveCards(card, Zone.HAND, source, game); + } + cards.retainZone(Zone.LIBRARY, game); + player.moveCards(card, Zone.GRAVEYARD, source, game); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index 24241a9e772..c11d20e521a 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -279,6 +279,7 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Suspicious Stowaway", 80, Rarity.RARE, mage.cards.s.SuspiciousStowaway.class)); cards.add(new SetCardInfo("Swamp", 272, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Tainted Adversary", 124, Rarity.MYTHIC, mage.cards.t.TaintedAdversary.class)); + cards.add(new SetCardInfo("Tapping at the Window", 201, Rarity.COMMON, mage.cards.t.TappingAtTheWindow.class)); cards.add(new SetCardInfo("Tavern Ruffian", 163, Rarity.COMMON, mage.cards.t.TavernRuffian.class)); cards.add(new SetCardInfo("Tavern Smasher", 163, Rarity.COMMON, mage.cards.t.TavernSmasher.class)); cards.add(new SetCardInfo("The Meathook Massacre", 112, Rarity.MYTHIC, mage.cards.t.TheMeathookMassacre.class));