diff --git a/Mage.Sets/src/mage/cards/s/SummonGoodKingMogXII.java b/Mage.Sets/src/mage/cards/s/SummonGoodKingMogXII.java new file mode 100644 index 00000000000..55312de092b --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SummonGoodKingMogXII.java @@ -0,0 +1,150 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.SagaAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.CreateTokenCopyTargetEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.counter.AddCountersAllEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.MoogleToken; +import mage.game.stack.Spell; +import mage.players.Player; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SummonGoodKingMogXII extends CardImpl { + + private static final FilterPermanent filter = new FilterControlledPermanent(SubType.MOOGLE, "other Moogle you control"); + + static { + filter.add(AnotherPredicate.instance); + } + + public SummonGoodKingMogXII(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{4}{W}"); + + this.subtype.add(SubType.SAGA); + this.subtype.add(SubType.MOOGLE); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // (As this Saga enters and after your draw step, add a lore counter. Sacrifice after IV.) + SagaAbility sagaAbility = new SagaAbility(this, SagaChapter.CHAPTER_IV); + + // I - Create two 1/2 white Moogle creature tokens with lifelink. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_I, + new CreateTokenEffect(new MoogleToken(), 2) + ); + + // II, III - Whenever you cast a noncreature spell this turn, create a token that's a copy of a non-Saga token you control. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_II, SagaChapter.CHAPTER_III, + new CreateDelayedTriggeredAbilityEffect(new SummonGoodKingMogXIITriggeredAbility()) + ); + + // IV - Put two +1/+1 counters on each other Moogle you control. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_IV, + new AddCountersAllEffect(CounterType.P1P1.createInstance(2), filter) + ); + this.addAbility(sagaAbility); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Lifelink + this.addAbility(LifelinkAbility.getInstance()); + } + + private SummonGoodKingMogXII(final SummonGoodKingMogXII card) { + super(card); + } + + @Override + public SummonGoodKingMogXII copy() { + return new SummonGoodKingMogXII(this); + } +} + +class SummonGoodKingMogXIITriggeredAbility extends DelayedTriggeredAbility { + + SummonGoodKingMogXIITriggeredAbility() { + super(new SummonGoodKingMogXIIEffect(), Duration.EndOfTurn, false, false); + setTriggerPhrase("Whenever you cast a noncreature spell this turn, "); + } + + private SummonGoodKingMogXIITriggeredAbility(final SummonGoodKingMogXIITriggeredAbility ability) { + super(ability); + } + + @Override + public SummonGoodKingMogXIITriggeredAbility copy() { + return new SummonGoodKingMogXIITriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.SPELL_CAST; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (!isControlledBy(event.getPlayerId())) { + return false; + } + Spell spell = game.getSpell(event.getTargetId()); + return spell != null && !spell.isCreature(game); + } +} + +class SummonGoodKingMogXIIEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterControlledPermanent("non-Saga token you control"); + + SummonGoodKingMogXIIEffect() { + super(Outcome.Benefit); + staticText = "create a token that's a copy of a non-Saga token you control"; + } + + private SummonGoodKingMogXIIEffect(final SummonGoodKingMogXIIEffect effect) { + super(effect); + } + + @Override + public SummonGoodKingMogXIIEffect copy() { + return new SummonGoodKingMogXIIEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null || !game.getBattlefield().contains(filter, source, game, 1)) { + return false; + } + TargetPermanent target = new TargetPermanent(filter); + target.withNotTarget(true); + player.choose(outcome, target, source, game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + return permanent != null && new CreateTokenCopyTargetEffect().setSavedPermanent(permanent).apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java index 0ae3600156b..2eecafd2783 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java +++ b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java @@ -221,6 +221,7 @@ public final class FinalFantasyCommander extends ExpansionSet { cards.add(new SetCardInfo("Stitcher's Supplier", 287, Rarity.UNCOMMON, mage.cards.s.StitchersSupplier.class)); cards.add(new SetCardInfo("Sublime Epiphany", 271, Rarity.RARE, mage.cards.s.SublimeEpiphany.class)); cards.add(new SetCardInfo("Sulfurous Springs", 427, Rarity.RARE, mage.cards.s.SulfurousSprings.class)); + cards.add(new SetCardInfo("Summon: Good King Mog XII", 26, Rarity.RARE, mage.cards.s.SummonGoodKingMogXII.class)); cards.add(new SetCardInfo("Sun Titan", 254, Rarity.MYTHIC, mage.cards.s.SunTitan.class)); cards.add(new SetCardInfo("Sungrass Prairie", 428, Rarity.RARE, mage.cards.s.SungrassPrairie.class)); cards.add(new SetCardInfo("Sunken Hollow", 429, Rarity.RARE, mage.cards.s.SunkenHollow.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/MoogleToken.java b/Mage/src/main/java/mage/game/permanent/token/MoogleToken.java new file mode 100644 index 00000000000..eb997ca63d2 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/MoogleToken.java @@ -0,0 +1,32 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.LifelinkAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class MoogleToken extends TokenImpl { + + public MoogleToken() { + super("Moogle Token", "1/2 white Moogle creature token with lifelink"); + cardType.add(CardType.CREATURE); + color.setWhite(true); + subtype.add(SubType.MOOGLE); + power = new MageInt(1); + toughness = new MageInt(2); + + addAbility(LifelinkAbility.getInstance()); + } + + private MoogleToken(final MoogleToken token) { + super(token); + } + + @Override + public MoogleToken copy() { + return new MoogleToken(this); + } +}