From fc9c8287c3fd3d938f6d37dddca0a4e3041041db Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 1 Jun 2019 19:17:07 -0400 Subject: [PATCH] Implemented Winding Way --- Mage.Sets/src/mage/cards/w/WindingWay.java | 77 +++++++++++++++++++++ Mage.Sets/src/mage/sets/ModernHorizons.java | 1 + 2 files changed, 78 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/WindingWay.java diff --git a/Mage.Sets/src/mage/cards/w/WindingWay.java b/Mage.Sets/src/mage/cards/w/WindingWay.java new file mode 100644 index 00000000000..2ae71a6f7d0 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WindingWay.java @@ -0,0 +1,77 @@ +package mage.cards.w; + +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.Zone; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class WindingWay extends CardImpl { + + public WindingWay(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}"); + + // Choose creature or land. Reveal the top four cards of your library. Put all cards of the chosen type revealed this way into your hand and the rest into your graveyard. + this.getSpellAbility().addEffect(new WindingWayEffect()); + } + + private WindingWay(final WindingWay card) { + super(card); + } + + @Override + public WindingWay copy() { + return new WindingWay(this); + } +} + +class WindingWayEffect extends OneShotEffect { + + WindingWayEffect() { + super(Outcome.Benefit); + staticText = "Choose creature or land. Reveal the top four cards of your library. " + + "Put all cards of the chosen type revealed this way into your hand and the rest into your graveyard."; + } + + private WindingWayEffect(final WindingWayEffect effect) { + super(effect); + } + + @Override + public WindingWayEffect copy() { + return new WindingWayEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + boolean isCreature = player.chooseUse( + outcome, "Creature or Land?", "", + "Creature", "Land", source, game + ); + FilterCard filter = (isCreature ? StaticFilters.FILTER_CARD_CREATURE_A : StaticFilters.FILTER_CARD_LAND_A); + Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 4)); + player.revealCards(source, cards, game); + Cards cardsToKeep = new CardsImpl(cards.getCards(filter, game)); + cards.remove(cardsToKeep); + player.moveCards(cardsToKeep, Zone.HAND, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); + return true; + } +} \ 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 fdf62cf8916..51071db87f4 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons.java @@ -259,6 +259,7 @@ public final class ModernHorizons extends ExpansionSet { cards.add(new SetCardInfo("Weather the Storm", 191, Rarity.COMMON, mage.cards.w.WeatherTheStorm.class)); cards.add(new SetCardInfo("Webweaver Changeling", 192, Rarity.UNCOMMON, mage.cards.w.WebweaverChangeling.class)); cards.add(new SetCardInfo("Windcaller Aven", 77, Rarity.COMMON, mage.cards.w.WindcallerAven.class)); + cards.add(new SetCardInfo("Winding Way", 193, Rarity.COMMON, mage.cards.w.WindingWay.class)); cards.add(new SetCardInfo("Winds of Abandon", 37, Rarity.RARE, mage.cards.w.WindsOfAbandon.class)); cards.add(new SetCardInfo("Wing Shards", 38, Rarity.UNCOMMON, mage.cards.w.WingShards.class)); cards.add(new SetCardInfo("Winter's Rest", 78, Rarity.COMMON, mage.cards.w.WintersRest.class));