Implemented Winding Way

This commit is contained in:
Evan Kranzler 2019-06-01 19:17:07 -04:00
parent d6a3711811
commit fc9c8287c3
2 changed files with 78 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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("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("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("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("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("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)); cards.add(new SetCardInfo("Winter's Rest", 78, Rarity.COMMON, mage.cards.w.WintersRest.class));