From 8bbdae4af6f4c8ae5e8531526826098a0e9e9056 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 25 Apr 2020 18:49:23 -0400 Subject: [PATCH] updated "play from top of library" effects --- Mage.Sets/src/mage/cards/b/BolassCitadel.java | 2 +- .../src/mage/cards/c/CourserOfKruphix.java | 23 ++++--- .../src/mage/cards/e/ElshaOfTheInfinite.java | 10 +-- Mage.Sets/src/mage/cards/g/GarruksHorde.java | 21 +++--- .../src/mage/cards/m/MelekIzzetParagon.java | 9 ++- Mage.Sets/src/mage/cards/m/MysticForge.java | 67 +++++-------------- .../src/mage/cards/o/OracleOfMulDaya.java | 28 ++++---- .../src/mage/cards/p/PrecognitionField.java | 64 +++++------------- .../mage/cards/v/VivienMonstersAdvocate.java | 52 ++------------ .../mage/cards/v/VizierOfTheMenagerie.java | 53 ++------------- .../continuous/PlayTheTopCardEffect.java | 9 +-- 11 files changed, 97 insertions(+), 241 deletions(-) diff --git a/Mage.Sets/src/mage/cards/b/BolassCitadel.java b/Mage.Sets/src/mage/cards/b/BolassCitadel.java index 2cb133e3d8..2827e6a935 100644 --- a/Mage.Sets/src/mage/cards/b/BolassCitadel.java +++ b/Mage.Sets/src/mage/cards/b/BolassCitadel.java @@ -69,7 +69,7 @@ class BolassCitadelPlayTheTopCardEffect extends AsThoughEffectImpl { BolassCitadelPlayTheTopCardEffect() { super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.AIDontUseIt); // AI will need help with this - staticText = "You may play the top card of your library. If you cast a spell this way, " + staticText = "You may play lands and cast spells from the top of your library. If you cast a spell this way, " + "pay life equal to its converted mana cost rather than pay its mana cost."; } diff --git a/Mage.Sets/src/mage/cards/c/CourserOfKruphix.java b/Mage.Sets/src/mage/cards/c/CourserOfKruphix.java index 9bc9fd077a..2dcbcb047f 100644 --- a/Mage.Sets/src/mage/cards/c/CourserOfKruphix.java +++ b/Mage.Sets/src/mage/cards/c/CourserOfKruphix.java @@ -1,7 +1,5 @@ - package mage.cards.c; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; @@ -12,32 +10,37 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; import mage.filter.common.FilterLandCard; -import mage.filter.common.FilterLandPermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class CourserOfKruphix extends CardImpl { + private static final FilterCard filter = new FilterLandCard("play land cards"); + public CourserOfKruphix(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT,CardType.CREATURE},"{1}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{1}{G}{G}"); this.subtype.add(SubType.CENTAUR); this.power = new MageInt(2); this.toughness = new MageInt(4); // Play with the top card of your library revealed. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayWithTheTopCardRevealedEffect())); + this.addAbility(new SimpleStaticAbility(new PlayWithTheTopCardRevealedEffect())); + // You may play the top card of your library if it's a land card. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayTheTopCardEffect(new FilterLandCard()))); + this.addAbility(new SimpleStaticAbility(new PlayTheTopCardEffect(filter))); + // Whenever a land enters the battlefield under your control, you gain 1 life. - this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new GainLifeEffect(1), new FilterLandPermanent("a land"))); + this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new GainLifeEffect(1), StaticFilters.FILTER_LAND_A)); } - public CourserOfKruphix(final CourserOfKruphix card) { + private CourserOfKruphix(final CourserOfKruphix card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/e/ElshaOfTheInfinite.java b/Mage.Sets/src/mage/cards/e/ElshaOfTheInfinite.java index 91b80c7af8..5d4f9255c2 100644 --- a/Mage.Sets/src/mage/cards/e/ElshaOfTheInfinite.java +++ b/Mage.Sets/src/mage/cards/e/ElshaOfTheInfinite.java @@ -24,7 +24,7 @@ import java.util.UUID; */ public final class ElshaOfTheInfinite extends CardImpl { - private static final FilterCard filter = new FilterNonlandCard(); + private static final FilterCard filter = new FilterNonlandCard("cast noncreature spells"); static { filter.add(Predicates.not(CardType.CREATURE.getPredicate())); @@ -46,14 +46,10 @@ public final class ElshaOfTheInfinite extends CardImpl { this.addAbility(new SimpleStaticAbility(new LookAtTopCardOfLibraryAnyTimeEffect())); // You may cast the top card of your library if it's a noncreature, nonland card, and you may cast it as though it had flash. - Ability ability = new SimpleStaticAbility( - new PlayTheTopCardEffect(filter).setText( - "you may cast the top card of your library if it's a noncreature, nonland card," - ) - ); + Ability ability = new SimpleStaticAbility(new PlayTheTopCardEffect(filter)); ability.addEffect(new CastAsThoughItHadFlashAllEffect( Duration.WhileOnBattlefield, filter - ).setText("and you may cast it as though it had flash")); + ).setText("If you cast a spell this way, you may cast it as though it had flash.")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GarruksHorde.java b/Mage.Sets/src/mage/cards/g/GarruksHorde.java index 7ac147eb18..a8513fe25f 100644 --- a/Mage.Sets/src/mage/cards/g/GarruksHorde.java +++ b/Mage.Sets/src/mage/cards/g/GarruksHorde.java @@ -1,9 +1,7 @@ package mage.cards.g; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.PlayTheTopCardEffect; import mage.abilities.effects.common.continuous.PlayWithTheTopCardRevealedEffect; import mage.abilities.keyword.TrampleAbility; @@ -11,14 +9,18 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; -import mage.filter.StaticFilters; +import mage.filter.FilterCard; +import mage.filter.common.FilterCreatureCard; + +import java.util.UUID; /** * @author nantuko */ public final class GarruksHorde extends CardImpl { + private static final FilterCard filter = new FilterCreatureCard("cast creature spells"); + public GarruksHorde(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}{G}"); this.subtype.add(SubType.BEAST); @@ -26,16 +28,17 @@ public final class GarruksHorde extends CardImpl { this.power = new MageInt(7); this.toughness = new MageInt(7); + // Trample this.addAbility(TrampleAbility.getInstance()); + // Play with the top card of your library revealed. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayWithTheTopCardRevealedEffect())); + this.addAbility(new SimpleStaticAbility(new PlayWithTheTopCardRevealedEffect())); + // You may cast the top card of your library if it's a creature card. - Effect effect = new PlayTheTopCardEffect(StaticFilters.FILTER_CARD_CREATURE); - effect.setText("You may cast the top card of your library if it's a creature card"); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); + this.addAbility(new SimpleStaticAbility(new PlayTheTopCardEffect(filter))); } - public GarruksHorde(final GarruksHorde card) { + private GarruksHorde(final GarruksHorde card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/m/MelekIzzetParagon.java b/Mage.Sets/src/mage/cards/m/MelekIzzetParagon.java index d6e8b40bf0..bf9dff2fd8 100644 --- a/Mage.Sets/src/mage/cards/m/MelekIzzetParagon.java +++ b/Mage.Sets/src/mage/cards/m/MelekIzzetParagon.java @@ -1,4 +1,3 @@ - package mage.cards.m; import mage.MageInt; @@ -25,21 +24,21 @@ import mage.target.targetpointer.FixedTarget; import java.util.UUID; /** - * * @author jeffwadsworth */ public final class MelekIzzetParagon extends CardImpl { - private static final FilterCard filter = new FilterCard("instant or sorcery card"); + private static final FilterCard filter = new FilterCard("cast instant or sorcery spells"); static { filter.add(Predicates.or( CardType.INSTANT.getPredicate(), - CardType.SORCERY.getPredicate())); + CardType.SORCERY.getPredicate() + )); } public MelekIzzetParagon(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{U}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}{R}"); addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.WEIRD); this.subtype.add(SubType.WIZARD); diff --git a/Mage.Sets/src/mage/cards/m/MysticForge.java b/Mage.Sets/src/mage/cards/m/MysticForge.java index 80eeee2890..2592c37c6e 100644 --- a/Mage.Sets/src/mage/cards/m/MysticForge.java +++ b/Mage.Sets/src/mage/cards/m/MysticForge.java @@ -5,13 +5,17 @@ import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.AsThoughEffectImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continuous.LookAtTopCardOfLibraryAnyTimeEffect; -import mage.cards.Card; +import mage.abilities.effects.common.continuous.PlayTheTopCardEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorlessPredicate; import mage.game.Game; import mage.players.Player; @@ -22,14 +26,23 @@ import java.util.UUID; */ public final class MysticForge extends CardImpl { + private static final FilterCard filter = new FilterCard("cast artifact spells and colorless spells"); + + static { + filter.add(Predicates.or( + ColorlessPredicate.instance, + CardType.ARTIFACT.getPredicate() + )); + } + public MysticForge(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}"); // You may look at the top card of your library any time. this.addAbility(new SimpleStaticAbility(new LookAtTopCardOfLibraryAnyTimeEffect())); - // You may cast the top card of your library if it's an artifact card or a colorless nonland card. - this.addAbility(new SimpleStaticAbility(new MysticForgeTopCardCastEffect())); + // You may cast artifact spells and colorless spells from the top of your library. + this.addAbility(new SimpleStaticAbility(new PlayTheTopCardEffect(filter))); // {T}, Pay 1 life: Exile the top card of your library. Ability ability = new SimpleActivatedAbility(new MysticForgeExileEffect(), new TapSourceCost()); @@ -47,50 +60,6 @@ public final class MysticForge extends CardImpl { } } -class MysticForgeTopCardCastEffect extends AsThoughEffectImpl { - - MysticForgeTopCardCastEffect() { - super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "You may cast the top card of your library if it's an artifact card or a colorless nonland card."; - } - - private MysticForgeTopCardCastEffect(final MysticForgeTopCardCastEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public MysticForgeTopCardCastEffect copy() { - return new MysticForgeTopCardCastEffect(this); - } - - @Override - public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { - if (!affectedControllerId.equals(source.getControllerId())) { - return false; - } - Card card = game.getCard(objectId); - if (card == null) { - return false; - } - Player controller = game.getPlayer(affectedControllerId); - if (controller == null) { - return false; - } - Card topCard = controller.getLibrary().getFromTop(game); - return game.getObject(source.getSourceId()) != null - && topCard != null - && topCard == card - && (topCard.isArtifact() || (!topCard.isLand() && topCard.getColor(game).isColorless())) - && topCard.getSpellAbility() != null - && topCard.getSpellAbility().spellCanBeActivatedRegularlyNow(controller.getId(), game); - } -} - class MysticForgeExileEffect extends OneShotEffect { MysticForgeExileEffect() { diff --git a/Mage.Sets/src/mage/cards/o/OracleOfMulDaya.java b/Mage.Sets/src/mage/cards/o/OracleOfMulDaya.java index d522ada0d5..dcebbc1b06 100644 --- a/Mage.Sets/src/mage/cards/o/OracleOfMulDaya.java +++ b/Mage.Sets/src/mage/cards/o/OracleOfMulDaya.java @@ -1,8 +1,5 @@ - - package mage.cards.o; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.continuous.PlayAdditionalLandsControllerEffect; @@ -11,35 +8,41 @@ import mage.abilities.effects.common.continuous.PlayWithTheTopCardRevealedEffect import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; -import mage.constants.Zone; +import mage.constants.SubType; +import mage.filter.FilterCard; import mage.filter.common.FilterLandCard; +import java.util.UUID; + /** - * * @author nantuko, BetaSteward_at_googlemail.com */ public final class OracleOfMulDaya extends CardImpl { + private static final FilterCard filter = new FilterLandCard("play land cards"); + public OracleOfMulDaya(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}"); this.subtype.add(SubType.ELF); this.subtype.add(SubType.SHAMAN); - this.power = new MageInt(2); this.toughness = new MageInt(2); // You may play an additional land on each of your turns. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayAdditionalLandsControllerEffect(1, Duration.WhileOnBattlefield))); + this.addAbility(new SimpleStaticAbility( + new PlayAdditionalLandsControllerEffect(1, Duration.WhileOnBattlefield) + )); + // Play with the top card of your library revealed. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayWithTheTopCardRevealedEffect())); + this.addAbility(new SimpleStaticAbility(new PlayWithTheTopCardRevealedEffect())); + // You may play the top card of your library if it's a land card. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayTheTopCardEffect(new FilterLandCard()))); + this.addAbility(new SimpleStaticAbility(new PlayTheTopCardEffect(filter))); } - public OracleOfMulDaya(final OracleOfMulDaya card) { + private OracleOfMulDaya(final OracleOfMulDaya card) { super(card); } @@ -47,5 +50,4 @@ public final class OracleOfMulDaya extends CardImpl { public OracleOfMulDaya copy() { return new OracleOfMulDaya(this); } - } diff --git a/Mage.Sets/src/mage/cards/p/PrecognitionField.java b/Mage.Sets/src/mage/cards/p/PrecognitionField.java index 80a9b352d4..6a4bd15000 100644 --- a/Mage.Sets/src/mage/cards/p/PrecognitionField.java +++ b/Mage.Sets/src/mage/cards/p/PrecognitionField.java @@ -1,17 +1,20 @@ package mage.cards.p; -import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.AsThoughEffectImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continuous.LookAtTopCardOfLibraryAnyTimeEffect; +import mage.abilities.effects.common.continuous.PlayTheTopCardEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; import mage.game.Game; import mage.players.Player; @@ -22,6 +25,15 @@ import java.util.UUID; */ public final class PrecognitionField extends CardImpl { + private static final FilterCard filter = new FilterCard("cast instant or sorcery spells"); + + static { + filter.add(Predicates.or( + CardType.INSTANT.getPredicate(), + CardType.SORCERY.getPredicate() + )); + } + public PrecognitionField(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}"); @@ -29,7 +41,7 @@ public final class PrecognitionField extends CardImpl { this.addAbility(new SimpleStaticAbility(new LookAtTopCardOfLibraryAnyTimeEffect())); // You may cast the top card of your library if it's an instant or sorcery card. - this.addAbility(new SimpleStaticAbility(new PrecognitionFieldTopCardCastEffect())); + this.addAbility(new SimpleStaticAbility(new PlayTheTopCardEffect(filter))); // {3}: Exile the top card of your library. this.addAbility(new SimpleActivatedAbility(new PrecognitionFieldExileEffect(), new GenericManaCost(3))); @@ -45,50 +57,6 @@ public final class PrecognitionField extends CardImpl { } } -class PrecognitionFieldTopCardCastEffect extends AsThoughEffectImpl { - - public PrecognitionFieldTopCardCastEffect() { - super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "You may cast the top card of your library if it's an instant or sorcery card."; - } - - public PrecognitionFieldTopCardCastEffect(final PrecognitionFieldTopCardCastEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public PrecognitionFieldTopCardCastEffect copy() { - return new PrecognitionFieldTopCardCastEffect(this); - } - - @Override - public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { - if (affectedControllerId.equals(source.getControllerId())) { - Card card = game.getCard(objectId); - if (card != null) { - Player controller = game.getPlayer(affectedControllerId); - if (controller != null) { - Card topCard = controller.getLibrary().getFromTop(game); - MageObject precognitionField = game.getObject(source.getSourceId()); - if (precognitionField != null - && topCard != null) { - return topCard == card - && (topCard.isInstant() || topCard.isSorcery()) - && topCard.getSpellAbility() != null - && topCard.getSpellAbility().spellCanBeActivatedRegularlyNow(controller.getId(), game); - } - } - } - } - return false; - } -} - class PrecognitionFieldExileEffect extends OneShotEffect { public PrecognitionFieldExileEffect() { diff --git a/Mage.Sets/src/mage/cards/v/VivienMonstersAdvocate.java b/Mage.Sets/src/mage/cards/v/VivienMonstersAdvocate.java index a7ffbd3fda..365b7f5416 100644 --- a/Mage.Sets/src/mage/cards/v/VivienMonstersAdvocate.java +++ b/Mage.Sets/src/mage/cards/v/VivienMonstersAdvocate.java @@ -5,12 +5,11 @@ import mage.abilities.DelayedTriggeredAbility; import mage.abilities.LoyaltyAbility; import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.AsThoughEffectImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; import mage.abilities.effects.common.continuous.LookAtTopCardOfLibraryAnyTimeEffect; +import mage.abilities.effects.common.continuous.PlayTheTopCardEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; -import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.choices.Choice; @@ -34,13 +33,13 @@ import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; -import static mage.constants.Outcome.Benefit; - /** * @author TheElk801 */ public final class VivienMonstersAdvocate extends CardImpl { + private static final FilterCard filter = new FilterCreatureCard("cast creature spells"); + public VivienMonstersAdvocate(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{G}{G}"); @@ -52,7 +51,7 @@ public final class VivienMonstersAdvocate extends CardImpl { this.addAbility(new SimpleStaticAbility(new LookAtTopCardOfLibraryAnyTimeEffect())); // You may cast creature spells from the top of your library. - this.addAbility(new SimpleStaticAbility(new VivienMonstersAdvocateTopCardCastEffect())); + this.addAbility(new SimpleStaticAbility(new PlayTheTopCardEffect(filter))); // +1: Create a 3/3 green Beast creature token. Put your choice of a vigilance counter, a reach counter, or a trample counter on it. this.addAbility(new LoyaltyAbility(new VivienMonstersAdvocateTokenEffect(), 1)); @@ -73,49 +72,6 @@ public final class VivienMonstersAdvocate extends CardImpl { } } -class VivienMonstersAdvocateTopCardCastEffect extends AsThoughEffectImpl { - - VivienMonstersAdvocateTopCardCastEffect() { - super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Benefit); - staticText = "You may cast creature spells from the top of your library"; - } - - private VivienMonstersAdvocateTopCardCastEffect(final VivienMonstersAdvocateTopCardCastEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public VivienMonstersAdvocateTopCardCastEffect copy() { - return new VivienMonstersAdvocateTopCardCastEffect(this); - } - - @Override - public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { - if (!affectedControllerId.equals(source.getControllerId())) { - return false; - } - Card card = game.getCard(objectId); - if (card == null) { - return false; - } - Player controller = game.getPlayer(affectedControllerId); - if (controller == null) { - return false; - } - Card topCard = controller.getLibrary().getFromTop(game); - return topCard != null - && topCard == card - && topCard.isCreature() - && topCard.getSpellAbility() != null - && topCard.getSpellAbility().spellCanBeActivatedRegularlyNow(controller.getId(), game); - } -} - class VivienMonstersAdvocateTokenEffect extends OneShotEffect { private static final Token token = new BeastToken(); diff --git a/Mage.Sets/src/mage/cards/v/VizierOfTheMenagerie.java b/Mage.Sets/src/mage/cards/v/VizierOfTheMenagerie.java index 8583afb86c..28cab7afd1 100644 --- a/Mage.Sets/src/mage/cards/v/VizierOfTheMenagerie.java +++ b/Mage.Sets/src/mage/cards/v/VizierOfTheMenagerie.java @@ -7,13 +7,14 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.AsThoughEffectImpl; import mage.abilities.effects.AsThoughManaEffect; import mage.abilities.effects.common.continuous.LookAtTopCardOfLibraryAnyTimeEffect; -import mage.cards.Card; +import mage.abilities.effects.common.continuous.PlayTheTopCardEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.common.FilterCreatureCard; import mage.game.Game; import mage.players.ManaPoolItem; -import mage.players.Player; import mage.util.CardUtil; import java.util.UUID; @@ -23,6 +24,8 @@ import java.util.UUID; */ public final class VizierOfTheMenagerie extends CardImpl { + private static final FilterCard filter = new FilterCreatureCard("cast creature spells"); + public VizierOfTheMenagerie(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}"); this.subtype.add(SubType.NAGA); @@ -34,7 +37,7 @@ public final class VizierOfTheMenagerie extends CardImpl { this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LookAtTopCardOfLibraryAnyTimeEffect())); // You may cast the top card of your library if it's a creature card. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new VizierOfTheMenagerieTopCardCastEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayTheTopCardEffect(filter))); // You may spend mana as though it were mana of any type to cast creature spells. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new VizierOfTheMenagerieManaEffect())); @@ -51,50 +54,6 @@ public final class VizierOfTheMenagerie extends CardImpl { } } -class VizierOfTheMenagerieTopCardCastEffect extends AsThoughEffectImpl { - - public VizierOfTheMenagerieTopCardCastEffect() { - super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "You may cast the top card of your library if it's a creature card"; - } - - public VizierOfTheMenagerieTopCardCastEffect(final VizierOfTheMenagerieTopCardCastEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public VizierOfTheMenagerieTopCardCastEffect copy() { - return new VizierOfTheMenagerieTopCardCastEffect(this); - } - - @Override - public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { - if (affectedControllerId.equals(source.getControllerId())) { - Card card = game.getCard(objectId); - if (card != null) { - Player controller = game.getPlayer(affectedControllerId); - if (controller != null) { - Card topCard = controller.getLibrary().getFromTop(game); - MageObject vizierOfTheMenagerie = game.getObject(source.getSourceId()); - if (vizierOfTheMenagerie != null - && topCard != null) { - return topCard == card - && topCard.isCreature() - && topCard.getSpellAbility() != null - && topCard.getSpellAbility().spellCanBeActivatedRegularlyNow(controller.getId(), game); - } - } - } - } - return false; - } -} - class VizierOfTheMenagerieManaEffect extends AsThoughEffectImpl implements AsThoughManaEffect { public VizierOfTheMenagerieManaEffect() { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/PlayTheTopCardEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/PlayTheTopCardEffect.java index 2d369f0f4d..b0119f9485 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/PlayTheTopCardEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/PlayTheTopCardEffect.java @@ -7,6 +7,7 @@ import mage.constants.AsThoughEffectType; import mage.constants.Duration; import mage.constants.Outcome; import mage.filter.FilterCard; +import mage.filter.StaticFilters; import mage.game.Game; import mage.players.Player; import mage.util.CardUtil; @@ -18,17 +19,17 @@ import java.util.UUID; */ public class PlayTheTopCardEffect extends AsThoughEffectImpl { - private FilterCard filter; + private final FilterCard filter; public PlayTheTopCardEffect() { - this(new FilterCard()); - staticText = "You may play the top card of your library"; + this(StaticFilters.FILTER_CARD); + staticText = "You may play lands and cast spells from the top of your library"; } public PlayTheTopCardEffect(FilterCard filter) { super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit); this.filter = filter; - staticText = "You may play the top card of your library if it's a " + filter.getMessage(); + staticText = "You may " + filter.getMessage() + " from the top of your library"; } public PlayTheTopCardEffect(final PlayTheTopCardEffect effect) {