From dc03a14ae7e8216f8548f51d08ebfc83269de77e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 9 Sep 2020 10:57:18 -0400 Subject: [PATCH] [ZNR] Implemented Ancient Greenwarden --- .../src/mage/cards/a/AncientGreenwarden.java | 100 ++++++++++++++++++ Mage.Sets/src/mage/sets/ZendikarRising.java | 1 + 2 files changed, 101 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AncientGreenwarden.java diff --git a/Mage.Sets/src/mage/cards/a/AncientGreenwarden.java b/Mage.Sets/src/mage/cards/a/AncientGreenwarden.java new file mode 100644 index 0000000000..1a66c84752 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AncientGreenwarden.java @@ -0,0 +1,100 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.ruleModifying.PlayLandsFromGraveyardEffect; +import mage.abilities.keyword.ReachAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; +import mage.game.events.GameEvent; +import mage.game.events.NumberOfTriggersEvent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class AncientGreenwarden extends CardImpl { + + public AncientGreenwarden(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}"); + + this.subtype.add(SubType.ELEMENTAL); + this.power = new MageInt(5); + this.toughness = new MageInt(7); + + // Reach + this.addAbility(ReachAbility.getInstance()); + + // You may play lands from your graveyard. + this.addAbility(new SimpleStaticAbility(new PlayLandsFromGraveyardEffect())); + + // If a land entering the battlefield causes a triggered ability of a permanent you control to trigger, that ability triggers an additional time. + this.addAbility(new SimpleStaticAbility(new AncientGreenwardenEffect())); + } + + private AncientGreenwarden(final AncientGreenwarden card) { + super(card); + } + + @Override + public AncientGreenwarden copy() { + return new AncientGreenwarden(this); + } +} + +class AncientGreenwardenEffect extends ReplacementEffectImpl { + + AncientGreenwardenEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = "If a land entering the battlefield causes a triggered ability " + + "of a permanent you control to trigger, that ability triggers an additional time"; + } + + private AncientGreenwardenEffect(final AncientGreenwardenEffect effect) { + super(effect); + } + + @Override + public AncientGreenwardenEffect copy() { + return new AncientGreenwardenEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.NUMBER_OF_TRIGGERS; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (!(event instanceof NumberOfTriggersEvent)) { + return false; + } + NumberOfTriggersEvent numberOfTriggersEvent = (NumberOfTriggersEvent) event; + if (!source.isControlledBy(event.getPlayerId())) { + return false; + } + GameEvent sourceEvent = numberOfTriggersEvent.getSourceEvent(); + if (sourceEvent == null + || sourceEvent.getType() != GameEvent.EventType.ENTERS_THE_BATTLEFIELD + || !(sourceEvent instanceof EntersTheBattlefieldEvent) + || !((EntersTheBattlefieldEvent) sourceEvent).getTarget().isLand()) { + return false; + } + return game.getPermanent(numberOfTriggersEvent.getSourceId()) != null; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + event.setAmount(event.getAmount() + 1); + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/ZendikarRising.java b/Mage.Sets/src/mage/sets/ZendikarRising.java index 07e51882a5..9c1cdc8d4d 100644 --- a/Mage.Sets/src/mage/sets/ZendikarRising.java +++ b/Mage.Sets/src/mage/sets/ZendikarRising.java @@ -113,6 +113,7 @@ public final class ZendikarRising extends ExpansionSet { cards.add(new SetCardInfo("Akoum Hellhound", 133, Rarity.COMMON, mage.cards.a.AkoumHellhound.class)); cards.add(new SetCardInfo("Akoum Teeth", 134, Rarity.UNCOMMON, mage.cards.a.AkoumTeeth.class)); cards.add(new SetCardInfo("Akoum Warrior", 134, Rarity.UNCOMMON, mage.cards.a.AkoumWarrior.class)); + cards.add(new SetCardInfo("Ancient Greenwarden", 178, Rarity.RARE, mage.cards.a.AncientGreenwarden.class)); cards.add(new SetCardInfo("Angelheart Protector", 3, Rarity.COMMON, mage.cards.a.AngelheartProtector.class)); cards.add(new SetCardInfo("Anticognition", 45, Rarity.COMMON, mage.cards.a.Anticognition.class)); cards.add(new SetCardInfo("Archon of Emeria", 4, Rarity.RARE, mage.cards.a.ArchonOfEmeria.class));