diff --git a/Mage.Sets/src/mage/cards/e/EsperOrigins.java b/Mage.Sets/src/mage/cards/e/EsperOrigins.java new file mode 100644 index 00000000000..92025c053fb --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EsperOrigins.java @@ -0,0 +1,91 @@ +package mage.cards.e; + +import mage.abilities.Ability; +import mage.abilities.condition.common.CastFromGraveyardSourceCondition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.keyword.SurveilEffect; +import mage.abilities.keyword.FlashbackAbility; +import mage.abilities.keyword.TransformAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.counters.Counters; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class EsperOrigins extends CardImpl { + + public EsperOrigins(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}"); + this.secondSideCardClazz = mage.cards.s.SummonEsperMaduin.class; + + // Surveil 2. You gain 2 life. If this spell was cast from a graveyard, exile it, then put it onto the battlefield transformed under its owner's control with a finality counter on it. + this.getSpellAbility().addEffect(new SurveilEffect(2, false)); + this.getSpellAbility().addEffect(new GainLifeEffect(2)); + this.getSpellAbility().addEffect(new EsperOriginsEffect()); + this.addAbility(new TransformAbility()); + + // Flashback {3}{G} + this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{3}{G}"))); + } + + private EsperOrigins(final EsperOrigins card) { + super(card); + } + + @Override + public EsperOrigins copy() { + return new EsperOrigins(this); + } +} + +class EsperOriginsEffect extends OneShotEffect { + + EsperOriginsEffect() { + super(Outcome.Benefit); + staticText = "If this spell was cast from a graveyard, exile it, then put it onto the battlefield " + + "transformed under its owner's control with a finality counter on it."; + } + + private EsperOriginsEffect(final EsperOriginsEffect effect) { + super(effect); + } + + @Override + public EsperOriginsEffect copy() { + return new EsperOriginsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + if (!CastFromGraveyardSourceCondition.instance.apply(game, source)) { + return false; + } + Player player = game.getPlayer(source.getControllerId()); + Spell spell = game.getSpell(source.getId()); + if (player == null || spell == null) { + return false; + } + Card card = spell.getMainCard(); + player.moveCards(card, Zone.EXILED, source, game); + game.setEnterWithCounters(card.getId(), new Counters(CounterType.FINALITY.createInstance())); + game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId(), Boolean.TRUE); + player.moveCards( + card, Zone.BATTLEFIELD, source, game, false, + false, true, null + ); + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/s/SummonEsperMaduin.java b/Mage.Sets/src/mage/cards/s/SummonEsperMaduin.java new file mode 100644 index 00000000000..174228f4533 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SummonEsperMaduin.java @@ -0,0 +1,103 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.common.SagaAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.effects.mana.BasicManaEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.CardsImpl; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SummonEsperMaduin extends CardImpl { + + public SummonEsperMaduin(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, ""); + + this.subtype.add(SubType.SAGA); + this.subtype.add(SubType.ELEMENTAL); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + this.nightCard = true; + this.color.setGreen(true); + + // (As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.) + SagaAbility sagaAbility = new SagaAbility(this); + + // I -- Reveal the top card of your library. If it's a permanent card, put it into your hand. + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_I, new SummonEsperMaduinEffect()); + + // II -- Add {G}{G}. + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_II, new BasicManaEffect(Mana.GreenMana(2))); + + // III -- Other creatures you control get +2/+2 and gain trample until end of turn. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_III, + new BoostControlledEffect( + 2, 2, Duration.EndOfTurn, true + ).setText("other creatures you control get +2/+2"), + new GainAbilityControlledEffect( + TrampleAbility.getInstance(), Duration.EndOfTurn, + StaticFilters.FILTER_PERMANENT_CREATURE, true + ).setText("and gain trample until end of turn") + ); + this.addAbility(sagaAbility); + } + + private SummonEsperMaduin(final SummonEsperMaduin card) { + super(card); + } + + @Override + public SummonEsperMaduin copy() { + return new SummonEsperMaduin(this); + } +} + +class SummonEsperMaduinEffect extends OneShotEffect { + + SummonEsperMaduinEffect() { + super(Outcome.Benefit); + staticText = "reveal the top card of your library. If it's a permanent card, put it into your hand"; + } + + private SummonEsperMaduinEffect(final SummonEsperMaduinEffect effect) { + super(effect); + } + + @Override + public SummonEsperMaduinEffect copy() { + return new SummonEsperMaduinEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Card card = player.getLibrary().getFromTop(game); + if (card == null) { + return false; + } + player.revealCards(source, new CardsImpl(card), game); + if (card.isPermanent(game)) { + player.moveCards(card, Zone.HAND, source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/FinalFantasy.java b/Mage.Sets/src/mage/sets/FinalFantasy.java index 80bba8a21e7..0cface29937 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasy.java +++ b/Mage.Sets/src/mage/sets/FinalFantasy.java @@ -138,6 +138,8 @@ public final class FinalFantasy extends ExpansionSet { cards.add(new SetCardInfo("Emet-Selch, Unsundered", 394, Rarity.MYTHIC, mage.cards.e.EmetSelchUnsundered.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Emet-Selch, Unsundered", 483, Rarity.MYTHIC, mage.cards.e.EmetSelchUnsundered.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Emet-Selch, Unsundered", 539, Rarity.MYTHIC, mage.cards.e.EmetSelchUnsundered.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Esper Origins", 185, Rarity.RARE, mage.cards.e.EsperOrigins.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Esper Origins", 370, Rarity.RARE, mage.cards.e.EsperOrigins.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Esper Terra", 245, Rarity.MYTHIC, mage.cards.e.EsperTerra.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Esper Terra", 323, Rarity.MYTHIC, mage.cards.e.EsperTerra.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Esper Terra", 511, Rarity.MYTHIC, mage.cards.e.EsperTerra.class, NON_FULL_USE_VARIOUS)); @@ -387,6 +389,8 @@ public final class FinalFantasy extends ExpansionSet { cards.add(new SetCardInfo("Summon: Anima", 364, Rarity.UNCOMMON, mage.cards.s.SummonAnima.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Summon: Bahamut", 1, Rarity.MYTHIC, mage.cards.s.SummonBahamut.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Summon: Bahamut", 356, Rarity.MYTHIC, mage.cards.s.SummonBahamut.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Summon: Esper Maduin", 185, Rarity.RARE, mage.cards.s.SummonEsperMaduin.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Summon: Esper Maduin", 370, Rarity.RARE, mage.cards.s.SummonEsperMaduin.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Summon: Esper Ramuh", 161, Rarity.UNCOMMON, mage.cards.s.SummonEsperRamuh.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Summon: Esper Ramuh", 367, Rarity.UNCOMMON, mage.cards.s.SummonEsperRamuh.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Summon: Knights of Round", 359, Rarity.MYTHIC, mage.cards.s.SummonKnightsOfRound.class, NON_FULL_USE_VARIOUS));