From 7fb4e638b73696ca1e3b496d595ea2c4e2a9d49b Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 11 Jun 2020 19:52:45 -0400 Subject: [PATCH] Implemented Wildwood Scourge --- .../src/mage/cards/w/WildwoodScourge.java | 88 +++++++++++++++++++ Mage.Sets/src/mage/sets/CoreSet2021.java | 1 + 2 files changed, 89 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/WildwoodScourge.java diff --git a/Mage.Sets/src/mage/cards/w/WildwoodScourge.java b/Mage.Sets/src/mage/cards/w/WildwoodScourge.java new file mode 100644 index 0000000000..71ed9a279f --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WildwoodScourge.java @@ -0,0 +1,88 @@ +package mage.cards.w; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class WildwoodScourge extends CardImpl { + + public WildwoodScourge(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{X}{G}"); + + this.subtype.add(SubType.HYDRA); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Wildwood Scourge enters the battlefield with X +1/+1 counters on it. + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); + + // Whenever one or more +1/+1 counters are put on another non-Hydra creature you control, put a +1/+1 counter on Wildwood Scourge. + this.addAbility(new EnduringScalelordTriggeredAbility()); + } + + private WildwoodScourge(final WildwoodScourge card) { + super(card); + } + + @Override + public WildwoodScourge copy() { + return new WildwoodScourge(this); + } +} + +class EnduringScalelordTriggeredAbility extends TriggeredAbilityImpl { + + EnduringScalelordTriggeredAbility() { + super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false); + } + + private EnduringScalelordTriggeredAbility(final EnduringScalelordTriggeredAbility ability) { + super(ability); + } + + @Override + public EnduringScalelordTriggeredAbility copy() { + return new EnduringScalelordTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.COUNTERS_ADDED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getData().equals(CounterType.P1P1.getName())) { + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId()); + if (permanent == null) { + permanent = game.getPermanentEntering(event.getTargetId()); + } + return (permanent != null + && !event.getTargetId().equals(this.getSourceId()) + && permanent.isCreature() + && permanent.isControlledBy(this.getControllerId())); + } + return false; + } + + @Override + public String getRule() { + return "Whenever one or more +1/+1 counters are put on another creature you control, put a +1/+1 counter on {this}."; + } +} diff --git a/Mage.Sets/src/mage/sets/CoreSet2021.java b/Mage.Sets/src/mage/sets/CoreSet2021.java index 19e46b01da..2235bd0109 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2021.java +++ b/Mage.Sets/src/mage/sets/CoreSet2021.java @@ -149,5 +149,6 @@ public final class CoreSet2021 extends ExpansionSet { cards.add(new SetCardInfo("Vryn Wingmare", 43, Rarity.UNCOMMON, mage.cards.v.VrynWingmare.class)); cards.add(new SetCardInfo("Warden of the Woods", 213, Rarity.UNCOMMON, mage.cards.w.WardenOfTheWoods.class)); cards.add(new SetCardInfo("Wildwood Patrol", 339, Rarity.COMMON, mage.cards.w.WildwoodPatrol.class)); + cards.add(new SetCardInfo("Wildwood Scourge", 214, Rarity.UNCOMMON, mage.cards.w.WildwoodScourge.class)); } }