From 50d4d17d885d48eb18a366ba657af4d29e58a891 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 11 Apr 2022 22:44:06 -0400 Subject: [PATCH] [SNC] Implemented Unleash the Inferno --- .../src/mage/cards/u/UnleashTheInferno.java | 86 +++++++++++++++++++ .../src/mage/sets/StreetsOfNewCapenna.java | 1 + 2 files changed, 87 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/u/UnleashTheInferno.java diff --git a/Mage.Sets/src/mage/cards/u/UnleashTheInferno.java b/Mage.Sets/src/mage/cards/u/UnleashTheInferno.java new file mode 100644 index 00000000000..4f116178aa5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/u/UnleashTheInferno.java @@ -0,0 +1,86 @@ +package mage.cards.u; + +import mage.abilities.Ability; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.ComparisonType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; +import mage.filter.predicate.mageobject.ManaValuePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreatureOrPlaneswalker; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class UnleashTheInferno extends CardImpl { + + public UnleashTheInferno(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}{R}{G}"); + + // Unleash the Inferno deals 7 damage to target creature or planeswalker. When it deals excess damage this way destroy target artifact or enchantment an opponent controls with mana value less than or equal to that amount of excess damage. + this.getSpellAbility().addEffect(new UnleashTheInfernoEffect()); + this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker()); + } + + private UnleashTheInferno(final UnleashTheInferno card) { + super(card); + } + + @Override + public UnleashTheInferno copy() { + return new UnleashTheInferno(this); + } +} + +class UnleashTheInfernoEffect extends OneShotEffect { + + UnleashTheInfernoEffect() { + super(Outcome.Benefit); + staticText = "{this} deals 7 damage to target creature or planeswalker. " + + "When it deals excess damage this way, destroy target artifact or enchantment " + + "an opponent controls with mana value less than or equal to that amount of excess damage"; + } + + private UnleashTheInfernoEffect(final UnleashTheInfernoEffect effect) { + super(effect); + } + + @Override + public UnleashTheInfernoEffect copy() { + return new UnleashTheInfernoEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (permanent == null) { + return false; + } + int lethal = Math.min(permanent.getLethalDamage(source.getSourceId(), game), 7); + permanent.damage(7, source, game); + int excess = 7 - lethal; + if (lethal > 0) { + return true; + } + ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DestroyTargetEffect(), false); + FilterPermanent filter = new FilterArtifactOrEnchantmentPermanent( + "artifact or enchantment an opponent controls with mana value less that or equal to " + excess + ); + filter.add(TargetController.OPPONENT.getControllerPredicate()); + filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, excess)); + ability.addTarget(new TargetPermanent(filter)); + game.fireReflexiveTriggeredAbility(ability, source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index 3f59c79b85c..abbd553036c 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -101,6 +101,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Swamp", 266, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Topiary Stomper", 160, Rarity.RARE, mage.cards.t.TopiaryStomper.class)); cards.add(new SetCardInfo("Tramway Station", 258, Rarity.COMMON, mage.cards.t.TramwayStation.class)); + cards.add(new SetCardInfo("Unleash the Inferno", 229, Rarity.RARE, mage.cards.u.UnleashTheInferno.class)); cards.add(new SetCardInfo("Unlucky Witness", 128, Rarity.UNCOMMON, mage.cards.u.UnluckyWitness.class)); cards.add(new SetCardInfo("Urabrask, Heretic Praetor", 129, Rarity.MYTHIC, mage.cards.u.UrabraskHereticPraetor.class)); cards.add(new SetCardInfo("Vampire Scrivener", 98, Rarity.UNCOMMON, mage.cards.v.VampireScrivener.class));