From a6eb8d0d4bd271fa69241d221a73467e2d5205c2 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sun, 31 Mar 2024 10:37:29 -0400 Subject: [PATCH] [OTJ] Implement Calamity, Galloping Inferno --- .../cards/c/CalamityGallopingInferno.java | 110 ++++++++++++++++++ .../mage/sets/OutlawsOfThunderJunction.java | 1 + 2 files changed, 111 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CalamityGallopingInferno.java diff --git a/Mage.Sets/src/mage/cards/c/CalamityGallopingInferno.java b/Mage.Sets/src/mage/cards/c/CalamityGallopingInferno.java new file mode 100644 index 00000000000..b57141ebe4a --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CalamityGallopingInferno.java @@ -0,0 +1,110 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksWhileSaddledTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenCopyTargetEffect; +import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.SaddleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.SaddledSourceThisTurnPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.watchers.common.SaddledMountWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CalamityGallopingInferno extends CardImpl { + + public CalamityGallopingInferno(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HORSE); + this.subtype.add(SubType.MOUNT); + this.power = new MageInt(4); + this.toughness = new MageInt(6); + + // Haste + this.addAbility(HasteAbility.getInstance()); + + // Whenever Calamity, Galloping Inferno attacks while saddled, choose a nonlegendary creature that saddled it this turn and create a tapped and attacking token that's a copy of it. Sacrifice that token at the beginning of the next end step. Repeat this process once. + this.addAbility(new AttacksWhileSaddledTriggeredAbility(new CalamityGallopingInfernoEffect()), new SaddledMountWatcher()); + + // Saddle 1 + this.addAbility(new SaddleAbility(1)); + } + + private CalamityGallopingInferno(final CalamityGallopingInferno card) { + super(card); + } + + @Override + public CalamityGallopingInferno copy() { + return new CalamityGallopingInferno(this); + } +} + +class CalamityGallopingInfernoEffect extends OneShotEffect { + + private static final FilterPermanent filter + = new FilterCreaturePermanent("nonlegendary creature that saddled it this turn"); + + static { + filter.add(Predicates.not(SuperType.LEGENDARY.getPredicate())); + filter.add(SaddledSourceThisTurnPredicate.instance); + } + + CalamityGallopingInfernoEffect() { + super(Outcome.Benefit); + staticText = "choose a nonlegendary creature that saddled it this turn " + + "and create a tapped and attacking token that's a copy of it. " + + "Sacrifice that token at the beginning of the next end step. Repeat this process once"; + } + + private CalamityGallopingInfernoEffect(final CalamityGallopingInfernoEffect effect) { + super(effect); + } + + @Override + public CalamityGallopingInfernoEffect copy() { + return new CalamityGallopingInfernoEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null || !game.getBattlefield().contains(filter, source, game, 1)) { + return false; + } + for (int i = 0; i < 2; i++) { + TargetPermanent target = new TargetPermanent(filter); + target.withNotTarget(true); + player.choose(outcome, target, source, game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent == null) { + continue; + } + CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect( + null, null, false, 1, true, true + ); + effect.apply(game, source); + effect.sacrificeTokensCreatedAtNextEndStep(game, source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java b/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java index dfd79d056b0..534f8fed3cb 100644 --- a/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java +++ b/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java @@ -56,6 +56,7 @@ public final class OutlawsOfThunderJunction extends ExpansionSet { cards.add(new SetCardInfo("Bucolic Ranch", 265, Rarity.UNCOMMON, mage.cards.b.BucolicRanch.class)); cards.add(new SetCardInfo("Cactarantula", 158, Rarity.COMMON, mage.cards.c.Cactarantula.class)); cards.add(new SetCardInfo("Cactusfolk Sureshot", 199, Rarity.UNCOMMON, mage.cards.c.CactusfolkSureshot.class)); + cards.add(new SetCardInfo("Calamity, Galloping Inferno", 116, Rarity.RARE, mage.cards.c.CalamityGallopingInferno.class)); cards.add(new SetCardInfo("Canyon Crab", 40, Rarity.UNCOMMON, mage.cards.c.CanyonCrab.class)); cards.add(new SetCardInfo("Caustic Bronco", 82, Rarity.RARE, mage.cards.c.CausticBronco.class)); cards.add(new SetCardInfo("Colossal Rattlewurm", 159, Rarity.RARE, mage.cards.c.ColossalRattlewurm.class));