diff --git a/Mage.Sets/src/mage/cards/f/FableOfTheMirrorBreaker.java b/Mage.Sets/src/mage/cards/f/FableOfTheMirrorBreaker.java new file mode 100644 index 0000000000..ecbb7659ba --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FableOfTheMirrorBreaker.java @@ -0,0 +1,52 @@ +package mage.cards.f; + +import mage.abilities.common.SagaAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.ExileSagaAndReturnTransformedEffect; +import mage.abilities.effects.common.discard.DiscardAndDrawThatManyEffect; +import mage.abilities.keyword.TransformAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SagaChapter; +import mage.constants.SubType; +import mage.game.permanent.token.FableOfTheMirrorBreakerToken; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FableOfTheMirrorBreaker extends CardImpl { + + public FableOfTheMirrorBreaker(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); + + this.subtype.add(SubType.SAGA); + this.secondSideCardClazz = mage.cards.r.ReflectionOfKikiJiki.class; + + // (As this Saga enters and after your draw step, add a lore counter.) + SagaAbility sagaAbility = new SagaAbility(this); + + // I — Create a 2/2 red Goblin Shaman creature token with "Whenever this creature attacks, create a Treasure token." + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_I, new CreateTokenEffect(new FableOfTheMirrorBreakerToken())); + + // II — You may discard up to two cards. If you do, draw that many cards. + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_II, new DiscardAndDrawThatManyEffect(2)); + + // III — Exile this Saga, then return it to the battlefield transformed under your control. + this.addAbility(new TransformAbility()); + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III, new ExileSagaAndReturnTransformedEffect()); + + this.addAbility(sagaAbility); + } + + private FableOfTheMirrorBreaker(final FableOfTheMirrorBreaker card) { + super(card); + } + + @Override + public FableOfTheMirrorBreaker copy() { + return new FableOfTheMirrorBreaker(this); + } +} diff --git a/Mage.Sets/src/mage/cards/r/ReflectionOfKikiJiki.java b/Mage.Sets/src/mage/cards/r/ReflectionOfKikiJiki.java new file mode 100644 index 0000000000..9fc8500c50 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/ReflectionOfKikiJiki.java @@ -0,0 +1,91 @@ +package mage.cards.r; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenCopyTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.target.TargetPermanent; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ReflectionOfKikiJiki extends CardImpl { + + private static final FilterPermanent filter + = new FilterControlledCreaturePermanent("another nonlegendary creature you control"); + + static { + filter.add(AnotherPredicate.instance); + filter.add(Predicates.not(SuperType.LEGENDARY.getPredicate())); + } + + public ReflectionOfKikiJiki(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, ""); + + this.subtype.add(SubType.GOBLIN); + this.subtype.add(SubType.SHAMAN); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + this.color.setRed(true); + this.nightCard = true; + + // {1}, {T}: Create a token that's a copy of another target nonlegendary creature you control, except it has haste. Sacrifice it at the beginning of the next end step. + Ability ability = new SimpleActivatedAbility(new ReflectionOfKikiJikiEffect(), new GenericManaCost(1)); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetPermanent(filter)); + this.addAbility(ability); + } + + private ReflectionOfKikiJiki(final ReflectionOfKikiJiki card) { + super(card); + } + + @Override + public ReflectionOfKikiJiki copy() { + return new ReflectionOfKikiJiki(this); + } +} + +class ReflectionOfKikiJikiEffect extends OneShotEffect { + + ReflectionOfKikiJikiEffect() { + super(Outcome.Benefit); + staticText = "create a token that's a copy of another target nonlegendary creature you control, " + + "except it has haste. Sacrifice it at the beginning of the next end step"; + } + + private ReflectionOfKikiJikiEffect(final ReflectionOfKikiJikiEffect effect) { + super(effect); + } + + @Override + public ReflectionOfKikiJikiEffect copy() { + return new ReflectionOfKikiJikiEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, null, true); + effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game)); + effect.apply(game, source); + effect.sacrificeTokensCreatedAtEndOfCombat(game, source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java index 37e8301c1e..2cc0b7bea2 100644 --- a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java +++ b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java @@ -91,6 +91,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet { cards.add(new SetCardInfo("Experimental Synthesizer", 138, Rarity.COMMON, mage.cards.e.ExperimentalSynthesizer.class)); cards.add(new SetCardInfo("Explosive Entry", 139, Rarity.COMMON, mage.cards.e.ExplosiveEntry.class)); cards.add(new SetCardInfo("Explosive Singularity", 140, Rarity.MYTHIC, mage.cards.e.ExplosiveSingularity.class)); + cards.add(new SetCardInfo("Fable of the Mirror-Breaker", 141, Rarity.RARE, mage.cards.f.FableOfTheMirrorBreaker.class)); cards.add(new SetCardInfo("Fade into Antiquity", 182, Rarity.COMMON, mage.cards.f.FadeIntoAntiquity.class)); cards.add(new SetCardInfo("Fang of Shigeki", 183, Rarity.COMMON, mage.cards.f.FangOfShigeki.class)); cards.add(new SetCardInfo("Farewell", 13, Rarity.RARE, mage.cards.f.Farewell.class)); @@ -222,6 +223,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet { cards.add(new SetCardInfo("Reckoner Bankbuster", 255, Rarity.RARE, mage.cards.r.ReckonerBankbuster.class)); cards.add(new SetCardInfo("Reckoner Shakedown", 119, Rarity.COMMON, mage.cards.r.ReckonerShakedown.class)); cards.add(new SetCardInfo("Reckoner's Bargain", 120, Rarity.COMMON, mage.cards.r.ReckonersBargain.class)); + cards.add(new SetCardInfo("Reflection of Kiki-Jiki", 141, Rarity.RARE, mage.cards.r.ReflectionOfKikiJiki.class)); cards.add(new SetCardInfo("Regent's Authority", 32, Rarity.COMMON, mage.cards.r.RegentsAuthority.class)); cards.add(new SetCardInfo("Reinforced Ronin", 158, Rarity.UNCOMMON, mage.cards.r.ReinforcedRonin.class)); cards.add(new SetCardInfo("Reito Sentinel", 256, Rarity.UNCOMMON, mage.cards.r.ReitoSentinel.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java index 92746ff372..e46bb168a6 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java @@ -5,12 +5,10 @@ import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.Mode; -import mage.abilities.TriggeredAbility; import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.Effect; -import mage.abilities.effects.EffectImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.HasteAbility; @@ -20,7 +18,6 @@ import mage.counters.CounterType; import mage.game.Game; import mage.game.permanent.Permanent; import mage.game.permanent.token.EmptyToken; -import mage.game.turn.Step; import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTargets; import mage.util.CardUtil; @@ -354,27 +351,39 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect { this.number = number; } + public void sacrificeTokensCreatedAtNextEndStep(Game game, Ability source) { + this.removeTokensCreatedAtEndOf(game, source, PhaseStep.END_TURN, false); + } + public void exileTokensCreatedAtNextEndStep(Game game, Ability source) { - this.exileTokensCreatedAtEndOf(game, source, PhaseStep.END_TURN); + this.removeTokensCreatedAtEndOf(game, source, PhaseStep.END_TURN, true); + } + + public void sacrificeTokensCreatedAtEndOfCombat(Game game, Ability source) { + this.removeTokensCreatedAtEndOf(game, source, PhaseStep.END_COMBAT, false); } public void exileTokensCreatedAtEndOfCombat(Game game, Ability source) { - this.exileTokensCreatedAtEndOf(game, source, PhaseStep.END_COMBAT); + this.removeTokensCreatedAtEndOf(game, source, PhaseStep.END_COMBAT, true); } - private void exileTokensCreatedAtEndOf(Game game, Ability source, PhaseStep phaseStepToExileCards) { - ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD); - exileEffect.setText("exile the token copies"); - exileEffect.setTargetPointer(new FixedTargets(addedTokenPermanents, game)); + private void removeTokensCreatedAtEndOf(Game game, Ability source, PhaseStep phaseStepToExileCards, boolean exile) { + Effect effect; + if (exile) { + effect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD).setText("exile the token copies"); + } else { + effect = new SacrificeTargetEffect("sacrifice the token copies"); + } + effect.setTargetPointer(new FixedTargets(addedTokenPermanents, game)); DelayedTriggeredAbility exileAbility; switch (phaseStepToExileCards) { case END_TURN: - exileAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect); + exileAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect); break; case END_COMBAT: - exileAbility = new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect); + exileAbility = new AtTheEndOfCombatDelayedTriggeredAbility(effect); break; default: return; diff --git a/Mage/src/main/java/mage/game/permanent/token/FableOfTheMirrorBreakerToken.java b/Mage/src/main/java/mage/game/permanent/token/FableOfTheMirrorBreakerToken.java new file mode 100644 index 0000000000..bb211bcd3b --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/FableOfTheMirrorBreakerToken.java @@ -0,0 +1,33 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public class FableOfTheMirrorBreakerToken extends TokenImpl { + + public FableOfTheMirrorBreakerToken() { + super("Goblin Shaman Token", "2/2 red Goblin Shaman creature token with \"Whenever this creature attacks, create a Treasure token.\""); + cardType.add(CardType.CREATURE); + color.setRed(true); + subtype.add(SubType.GOBLIN); + subtype.add(SubType.SHAMAN); + power = new MageInt(2); + toughness = new MageInt(2); + addAbility(new AttacksTriggeredAbility(new CreateTokenEffect(new TreasureToken())).setTriggerPhrase("Whenever this creature attacks, ")); + } + + private FableOfTheMirrorBreakerToken(final FableOfTheMirrorBreakerToken token) { + super(token); + } + + @Override + public FableOfTheMirrorBreakerToken copy() { + return new FableOfTheMirrorBreakerToken(this); + } +}