From 5a63702cb6e11c266aec9b5c59481c088173a7ff Mon Sep 17 00:00:00 2001 From: theelk801 Date: Fri, 28 Apr 2023 17:41:24 -0400 Subject: [PATCH] [J22] Implement Mizzix, Replica Rider --- .../src/mage/cards/m/MizzixReplicaRider.java | 117 ++++++++++++++++++ Mage.Sets/src/mage/sets/Jumpstart2022.java | 1 + 2 files changed, 118 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MizzixReplicaRider.java diff --git a/Mage.Sets/src/mage/cards/m/MizzixReplicaRider.java b/Mage.Sets/src/mage/cards/m/MizzixReplicaRider.java new file mode 100644 index 0000000000..c35142fa25 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MizzixReplicaRider.java @@ -0,0 +1,117 @@ +package mage.cards.m; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.abilities.effects.common.SacrificeSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterSpell; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.card.CastFromZonePredicate; +import mage.filter.predicate.mageobject.MageObjectReferencePredicate; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.game.stack.StackObject; +import mage.util.functions.StackObjectCopyApplier; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MizzixReplicaRider extends CardImpl { + + private static final FilterSpell filter = new FilterSpell("a spell from anywhere other than your hand"); + + static { + filter.add(Predicates.not(new CastFromZonePredicate(Zone.HAND))); + } + + public MizzixReplicaRider(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.GOBLIN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(4); + this.toughness = new MageInt(5); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Whenever you cast a spell from anywhere other than your hand, you may pay {1}{U/R}. If you do, copy that spell and you may choose new targets for the copy. If the copy is a permanent spell, it gains haste and "At the beginning of your end step, sacrifice this permanent." + this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid( + new MizzixReplicaRiderEffect(), new ManaCostsImpl<>("{1}{U/R}") + ), filter, false)); + } + + private MizzixReplicaRider(final MizzixReplicaRider card) { + super(card); + } + + @Override + public MizzixReplicaRider copy() { + return new MizzixReplicaRider(this); + } +} + +class MizzixReplicaRiderEffect extends OneShotEffect { + + MizzixReplicaRiderEffect() { + super(Outcome.Benefit); + staticText = "copy that spell and you may choose new targets for the copy. " + + "If the copy is a permanent spell, it gains haste and " + + "\"At the beginning of your end step, sacrifice this permanent.\""; + } + + private MizzixReplicaRiderEffect(final MizzixReplicaRiderEffect effect) { + super(effect); + } + + @Override + public MizzixReplicaRiderEffect copy() { + return new MizzixReplicaRiderEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Spell spell = (Spell) getValue("spellCast"); + if (spell == null) { + return false; + } + spell.createCopyOnStack( + game, source, source.getControllerId(), true, + 1, MizzixReplicaRiderApplier.instance + ); + return true; + } +} + +enum MizzixReplicaRiderApplier implements StackObjectCopyApplier { + instance; + + @Override + public void modifySpell(StackObject stackObject, Game game) { + if (!stackObject.isPermanent(game)) { + return; + } + Spell spell = (Spell) stackObject; + spell.addAbilityForCopy(HasteAbility.getInstance()); + spell.addAbilityForCopy(new BeginningOfEndStepTriggeredAbility( + new SacrificeSourceEffect().setText("sacrifice this permanent"), TargetController.YOU, false + )); + } + + @Override + public MageObjectReferencePredicate getNextNewTargetType() { + return null; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Jumpstart2022.java b/Mage.Sets/src/mage/sets/Jumpstart2022.java index 775bdc588d..6c273777a6 100644 --- a/Mage.Sets/src/mage/sets/Jumpstart2022.java +++ b/Mage.Sets/src/mage/sets/Jumpstart2022.java @@ -480,6 +480,7 @@ public final class Jumpstart2022 extends ExpansionSet { cards.add(new SetCardInfo("Mirror Image", 62, Rarity.UNCOMMON, mage.cards.m.MirrorImage.class)); cards.add(new SetCardInfo("Mishra's Factory", 816, Rarity.UNCOMMON, mage.cards.m.MishrasFactory.class)); cards.add(new SetCardInfo("Mistwalker", 323, Rarity.COMMON, mage.cards.m.Mistwalker.class)); + cards.add(new SetCardInfo("Mizzix, Replica Rider", 35, Rarity.RARE, mage.cards.m.MizzixReplicaRider.class)); cards.add(new SetCardInfo("Moldgraf Millipede", 691, Rarity.COMMON, mage.cards.m.MoldgrafMillipede.class)); cards.add(new SetCardInfo("Moment of Craving", 444, Rarity.COMMON, mage.cards.m.MomentOfCraving.class)); cards.add(new SetCardInfo("Moment of Triumph", 218, Rarity.COMMON, mage.cards.m.MomentOfTriumph.class));