diff --git a/Mage.Sets/src/mage/sets/shardsofalara/MayaelTheAnima.java b/Mage.Sets/src/mage/sets/shardsofalara/MayaelTheAnima.java index 8c95ceb0a6e..41fdd6c5dee 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/MayaelTheAnima.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/MayaelTheAnima.java @@ -38,6 +38,7 @@ import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; @@ -45,6 +46,7 @@ import mage.cards.CardsImpl; import mage.filter.Filter.ComparisonType; import mage.filter.FilterCard; import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.PowerPredicate; import mage.game.Game; import mage.players.Player; @@ -56,6 +58,12 @@ import mage.target.TargetCard; */ public class MayaelTheAnima extends CardImpl { + private static final FilterCreatureCard filter = new FilterCreatureCard("a creature card with power 5 or greater to put onto the battlefield"); + static { + filter.add(new CardTypePredicate(CardType.CREATURE)); + filter.add(new PowerPredicate(ComparisonType.GreaterThan, 4)); + } + public MayaelTheAnima(UUID ownerId) { super(ownerId, 179, "Mayael the Anima", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{R}{G}{W}"); this.expansionSetCode = "ALA"; @@ -73,7 +81,7 @@ public class MayaelTheAnima extends CardImpl { // You may put a creature card with power 5 or greater from among them onto the battlefield. // Put the rest on the bottom of your library in any order. SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, - new MayaelTheAnimaEffect(), + new LookLibraryAndPickControllerEffect(5,1, filter,false), new ManaCostsImpl("{3}{R}{G}{W}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); @@ -88,74 +96,3 @@ public class MayaelTheAnima extends CardImpl { return new MayaelTheAnima(this); } } - -class MayaelTheAnimaEffect extends OneShotEffect { - - public MayaelTheAnimaEffect() { - super(Outcome.PutCreatureInPlay); - this.staticText = "Look at the top five cards of your library. You may put a creature card with power 5 or greater from among them onto the battlefield. Put the rest on the bottom of your library in any order"; - } - - public MayaelTheAnimaEffect(final MayaelTheAnimaEffect effect) { - super(effect); - } - - @Override - public MayaelTheAnimaEffect copy() { - return new MayaelTheAnimaEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { - return false; - } - FilterCreatureCard filterCreatureCard = new FilterCreatureCard("creature card with power 5 or greater to put onto the battlefield"); - filterCreatureCard.add(new PowerPredicate(ComparisonType.GreaterThan, 4)); - - Cards cards = new CardsImpl(Zone.PICK); - boolean creatureCardFound = false; - int count = Math.min(player.getLibrary().size(), 5); - for (int i = 0; i < count; i++) { - Card card = player.getLibrary().removeFromTop(game); - if (card != null) { - cards.add(card); - game.setZone(card.getId(), Zone.PICK); - if (filterCreatureCard.match(card, game)) { - creatureCardFound = true; - } - } - } - player.lookAtCards("Mayael the Anima", cards, game); - - if (creatureCardFound && player.chooseUse(Outcome.DrawCard, "Do you wish to put a creature card with power 5 or greater from among them onto the battlefield?", game)) { - TargetCard target = new TargetCard(Zone.PICK, filterCreatureCard); - if (player.choose(this.outcome, cards, target, game)) { - Card card = cards.get(target.getFirstTarget(), game); - if (card != null) { - cards.remove(card); - card.putOntoBattlefield(game, Zone.PICK, source.getId(), player.getId()); - } - } - } - - TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); - target.setRequired(true); - while (cards.size() > 1) { - player.choose(Outcome.Neutral, cards, target, game); - Card card = cards.get(target.getFirstTarget(), game); - if (card != null) { - cards.remove(card); - card.moveToZone(Zone.LIBRARY, source.getId(), game, false); - } - target.clearChosen(); - } - if (cards.size() == 1) { - Card card = cards.get(cards.iterator().next(), game); - card.moveToZone(Zone.LIBRARY, source.getId(), game, false); - } - - return true; - } -}