From 53efb2199264ae596ff334ce077fd232998cf65c Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 9 Aug 2019 22:09:23 -0400 Subject: [PATCH] Implemented Elsha of the Infinite --- .../src/mage/cards/e/ElshaOfTheInfinite.java | 84 +++++++++++++++++++ .../src/mage/sets/Commander2019Edition.java | 1 + 2 files changed, 85 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/ElshaOfTheInfinite.java diff --git a/Mage.Sets/src/mage/cards/e/ElshaOfTheInfinite.java b/Mage.Sets/src/mage/cards/e/ElshaOfTheInfinite.java new file mode 100644 index 00000000000..211afb1cc4d --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/ElshaOfTheInfinite.java @@ -0,0 +1,84 @@ +package mage.cards.e; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.continuous.CastAsThoughItHadFlashAllEffect; +import mage.abilities.effects.common.continuous.LookAtTopCardOfLibraryAnyTimeEffect; +import mage.abilities.effects.common.continuous.PlayTheTopCardEffect; +import mage.abilities.keyword.ProwessAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.FilterCard; +import mage.filter.common.FilterNonlandCard; +import mage.filter.predicate.Predicate; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ElshaOfTheInfinite extends CardImpl { + + private static final FilterCard filter = new FilterNonlandCard(); + + static { + filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); + filter.add(ElshaOfTheInfinitePredicate.instance); + } + + public ElshaOfTheInfinite(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{R}{W}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.DJINN); + this.subtype.add(SubType.MONK); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Prowess + this.addAbility(new ProwessAbility()); + + // 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 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.addEffect(new CastAsThoughItHadFlashAllEffect( + Duration.WhileOnBattlefield, filter + ).setText("and you may cast it as though it had flash")); + this.addAbility(ability); + } + + private ElshaOfTheInfinite(final ElshaOfTheInfinite card) { + super(card); + } + + @Override + public ElshaOfTheInfinite copy() { + return new ElshaOfTheInfinite(this); + } +} + +enum ElshaOfTheInfinitePredicate implements Predicate { + instance; + + @Override + public boolean apply(Card input, Game game) { + Player player = game.getPlayer(input.getOwnerId()); + return player != null && player.getLibrary().getFromTop(game).equals(input); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Commander2019Edition.java b/Mage.Sets/src/mage/sets/Commander2019Edition.java index 39b310e4708..0ad529b66ff 100644 --- a/Mage.Sets/src/mage/sets/Commander2019Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2019Edition.java @@ -86,6 +86,7 @@ public final class Commander2019Edition extends ExpansionSet { cards.add(new SetCardInfo("Druid's Deliverance", 162, Rarity.COMMON, mage.cards.d.DruidsDeliverance.class)); cards.add(new SetCardInfo("Echoing Truth", 84, Rarity.COMMON, mage.cards.e.EchoingTruth.class)); cards.add(new SetCardInfo("Elemental Bond", 163, Rarity.UNCOMMON, mage.cards.e.ElementalBond.class)); + cards.add(new SetCardInfo("Elsha of the Infinite", 40, Rarity.MYTHIC, mage.cards.e.ElshaOfTheInfinite.class)); cards.add(new SetCardInfo("Emmara Tandris", 191, Rarity.RARE, mage.cards.e.EmmaraTandris.class)); cards.add(new SetCardInfo("Evolving Wilds", 241, Rarity.COMMON, mage.cards.e.EvolvingWilds.class)); cards.add(new SetCardInfo("Exotic Orchard", 242, Rarity.RARE, mage.cards.e.ExoticOrchard.class));