From 74caa905c3971ebcb966f1708cc4bead74f3f5ee Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Mon, 31 Jul 2023 05:06:09 +0200 Subject: [PATCH] [LTC] Implement Rampaging War Mammoth (#10707) --- .../src/mage/cards/r/RampagingWarMammoth.java | 104 ++++++++++++++++++ .../sets/TalesOfMiddleEarthCommander.java | 1 + 2 files changed, 105 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/r/RampagingWarMammoth.java diff --git a/Mage.Sets/src/mage/cards/r/RampagingWarMammoth.java b/Mage.Sets/src/mage/cards/r/RampagingWarMammoth.java new file mode 100644 index 00000000000..b73aa8e1f79 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RampagingWarMammoth.java @@ -0,0 +1,104 @@ +package mage.cards.r; + +import mage.MageInt; +import mage.abilities.common.ZoneChangeTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.hint.StaticHint; +import mage.abilities.keyword.CyclingAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.stack.StackObject; +import mage.target.common.TargetArtifactPermanent; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class RampagingWarMammoth extends CardImpl { + + public RampagingWarMammoth(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}{R}"); + + this.subtype.add(SubType.ELEPHANT); + this.power = new MageInt(9); + this.toughness = new MageInt(7); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Cycling {X}{2}{R} + this.addAbility(new CyclingAbility(new ManaCostsImpl<>("{X}{2}{R}"))); + + // When you cycle Rampaging War Mammoth, destroy up to X target artifacts. + this.addAbility(new RampagingWarMammothTriggeredAbility()); + } + + private RampagingWarMammoth(final RampagingWarMammoth card) { + super(card); + } + + @Override + public RampagingWarMammoth copy() { + return new RampagingWarMammoth(this); + } +} + +class RampagingWarMammothTriggeredAbility extends ZoneChangeTriggeredAbility { + + RampagingWarMammothTriggeredAbility() { + super(Zone.ALL, null, "", false); + } + + private RampagingWarMammothTriggeredAbility(RampagingWarMammothTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (!event.getSourceId().equals(this.getSourceId())) { + return false; + } + StackObject object = game.getStack().getStackObject(event.getSourceId()); + if (object == null || !(object.getStackAbility() instanceof CyclingAbility)) { + return false; + } + + CyclingAbility cyclingAbility = (CyclingAbility) object.getStackAbility(); + // If X is 0, or cycling from another ability that does not have {X} in cost, + // this should trigger (but do nothing). + int xValue = cyclingAbility.getManaCostsToPay().getX(); + + this.getEffects().clear(); + this.getTargets().clear(); + + this.addEffect(new DestroyTargetEffect()); + // Target up to X artifacts + this.addTarget(new TargetArtifactPermanent(0, xValue)); + this.addHint(new StaticHint("X = " + xValue)); + + return true; + } + + @Override + public RampagingWarMammothTriggeredAbility copy() { + return new RampagingWarMammothTriggeredAbility(this); + } + + @Override + public String getRule() { + return "When you cycle {this}, destroy up to X target artifacts."; + } +} diff --git a/Mage.Sets/src/mage/sets/TalesOfMiddleEarthCommander.java b/Mage.Sets/src/mage/sets/TalesOfMiddleEarthCommander.java index 7e5196048c9..247e7626c48 100644 --- a/Mage.Sets/src/mage/sets/TalesOfMiddleEarthCommander.java +++ b/Mage.Sets/src/mage/sets/TalesOfMiddleEarthCommander.java @@ -198,6 +198,7 @@ public final class TalesOfMiddleEarthCommander extends ExpansionSet { cards.add(new SetCardInfo("Radagast, Wizard of Wilds", 66, Rarity.RARE, mage.cards.r.RadagastWizardOfWilds.class)); cards.add(new SetCardInfo("Raise the Palisade", 23, Rarity.RARE, mage.cards.r.RaiseThePalisade.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Raise the Palisade", 106, Rarity.RARE, mage.cards.r.RaiseThePalisade.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Rampaging War Mammoth", 34, Rarity.RARE, mage.cards.r.RampagingWarMammoth.class)); cards.add(new SetCardInfo("Rampant Growth", 257, Rarity.COMMON, mage.cards.r.RampantGrowth.class)); cards.add(new SetCardInfo("Realm Seekers", 258, Rarity.RARE, mage.cards.r.RealmSeekers.class)); cards.add(new SetCardInfo("Reanimate", 206, Rarity.RARE, mage.cards.r.Reanimate.class));