From 4079b8772a252d9ca4f692c9e4c0e9c76a9210ed Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sat, 14 Jan 2023 20:49:32 -0500 Subject: [PATCH] [ONE] Implement Ezuri, Stalker of Spheres --- .../mage/cards/e/EzuriStalkerOfSpheres.java | 50 +++++++++++++++++++ .../src/mage/sets/PhyrexiaAllWillBeOne.java | 1 + ...roliferatedControllerTriggeredAbility.java | 45 +++++++++++++++++ .../common/counter/ProliferateEffect.java | 5 ++ .../main/java/mage/game/events/GameEvent.java | 1 + 5 files changed, 102 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/EzuriStalkerOfSpheres.java create mode 100644 Mage/src/main/java/mage/abilities/common/ProliferatedControllerTriggeredAbility.java diff --git a/Mage.Sets/src/mage/cards/e/EzuriStalkerOfSpheres.java b/Mage.Sets/src/mage/cards/e/EzuriStalkerOfSpheres.java new file mode 100644 index 0000000000..321ce83580 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EzuriStalkerOfSpheres.java @@ -0,0 +1,50 @@ +package mage.cards.e; + +import java.util.UUID; + +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.ProliferatedControllerTriggeredAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.counter.ProliferateEffect; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; + +/** + * @author TheElk801 + */ +public final class EzuriStalkerOfSpheres extends CardImpl { + + public EzuriStalkerOfSpheres(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.PHYREXIAN); + this.subtype.add(SubType.ELF); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // When Ezuri, Stalker of Spheres enters the battlefield, you may pay {3}. If you do, proliferate twice. + this.addAbility(new EntersBattlefieldTriggeredAbility(new DoIfCostPaid( + new ProliferateEffect(false), new GenericManaCost(3) + ).addEffect(new ProliferateEffect().setText("twice")))); + + // Whenever you proliferate, draw a card. + this.addAbility(new ProliferatedControllerTriggeredAbility(new DrawCardSourceControllerEffect(1))); + } + + private EzuriStalkerOfSpheres(final EzuriStalkerOfSpheres card) { + super(card); + } + + @Override + public EzuriStalkerOfSpheres copy() { + return new EzuriStalkerOfSpheres(this); + } +} diff --git a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java index f30f6aa7ec..7c0290f4fb 100644 --- a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java +++ b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java @@ -27,6 +27,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet { cards.add(new SetCardInfo("Dragonwing Glider", 126, Rarity.RARE, mage.cards.d.DragonwingGlider.class)); cards.add(new SetCardInfo("Elesh Norn, Mother of Machines", 10, Rarity.MYTHIC, mage.cards.e.EleshNornMotherOfMachines.class)); cards.add(new SetCardInfo("Evolved Spinoderm", 166, Rarity.RARE, mage.cards.e.EvolvedSpinoderm.class)); + cards.add(new SetCardInfo("Ezuri, Stalker of Spheres", 201, Rarity.RARE, mage.cards.e.EzuriStalkerOfSpheres.class)); cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Island", 273, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Koth, Fire of Resistance", 138, Rarity.RARE, mage.cards.k.KothFireOfResistance.class)); diff --git a/Mage/src/main/java/mage/abilities/common/ProliferatedControllerTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/ProliferatedControllerTriggeredAbility.java new file mode 100644 index 0000000000..195549ee71 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/common/ProliferatedControllerTriggeredAbility.java @@ -0,0 +1,45 @@ +package mage.abilities.common; + +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; + +/** + * @author TheElk801 + */ +public class ProliferatedControllerTriggeredAbility extends TriggeredAbilityImpl { + + public ProliferatedControllerTriggeredAbility(Effect effect) { + this(effect, false); + } + + public ProliferatedControllerTriggeredAbility(Effect effect, boolean optional) { + this(Zone.BATTLEFIELD, effect, optional); + } + + public ProliferatedControllerTriggeredAbility(Zone zone, Effect effect, boolean optional) { + super(zone, effect, optional); + setTriggerPhrase("Whenever you proliferate, "); + } + + private ProliferatedControllerTriggeredAbility(final ProliferatedControllerTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.PROLIFERATED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return isControlledBy(event.getPlayerId()); + } + + @Override + public ProliferatedControllerTriggeredAbility copy() { + return new ProliferatedControllerTriggeredAbility(this); + } +} diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java index 7f3928a467..ff7347438f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java @@ -6,6 +6,7 @@ import mage.constants.Outcome; import mage.counters.Counter; import mage.filter.common.FilterPermanentOrPlayerWithCounter; import mage.game.Game; +import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; @@ -86,6 +87,10 @@ public class ProliferateEffect extends OneShotEffect { } } } + game.fireEvent(GameEvent.getEvent( + GameEvent.EventType.PROLIFERATED, + controller.getId(), source, controller.getId() + )); return true; } diff --git a/Mage/src/main/java/mage/game/events/GameEvent.java b/Mage/src/main/java/mage/game/events/GameEvent.java index 6dab52fb77..8e46bfbd7f 100644 --- a/Mage/src/main/java/mage/game/events/GameEvent.java +++ b/Mage/src/main/java/mage/game/events/GameEvent.java @@ -307,6 +307,7 @@ public class GameEvent implements Serializable { CAN_TAKE_MULLIGAN, SCRY, SCRIED, SCRY_TO_BOTTOM, SURVEIL, SURVEILED, + PROLIFERATED, FATESEALED, FLIP_COIN, COIN_FLIPPED, REPLACE_ROLLED_DIE, // for Clam-I-Am workaround only