From ac13e80a6beef25e69023cf0a42d18a35f2667a5 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 28 Sep 2022 08:45:13 -0400 Subject: [PATCH] [UNF] Implemented Slight Malfunction --- .../src/mage/cards/s/SlightMalfunction.java | 76 +++++++++++++++++++ Mage.Sets/src/mage/sets/Unfinity.java | 1 + 2 files changed, 77 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SlightMalfunction.java diff --git a/Mage.Sets/src/mage/cards/s/SlightMalfunction.java b/Mage.Sets/src/mage/cards/s/SlightMalfunction.java new file mode 100644 index 00000000000..f1c9c6aa6c1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SlightMalfunction.java @@ -0,0 +1,76 @@ +package mage.cards.s; + +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetAnyTarget; +import mage.target.common.TargetArtifactPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SlightMalfunction extends CardImpl { + + public SlightMalfunction(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}"); + + // Choose one -- + // * Destroy target artifact. + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addTarget(new TargetArtifactPermanent()); + + // * Roll a six-side die. When you do, Slight Malfunction deals 1 damage to each of up to X target creatures, where X is the result. + this.getSpellAbility().addMode(new Mode(new SlightMalfunctionEffect())); + } + + private SlightMalfunction(final SlightMalfunction card) { + super(card); + } + + @Override + public SlightMalfunction copy() { + return new SlightMalfunction(this); + } +} + +class SlightMalfunctionEffect extends OneShotEffect { + + SlightMalfunctionEffect() { + super(Outcome.Benefit); + staticText = "roll a six-side die. When you do, {this} deals 1 damage " + + "to each of up to X target creatures, where X is the result"; + } + + private SlightMalfunctionEffect(final SlightMalfunctionEffect effect) { + super(effect); + } + + @Override + public SlightMalfunctionEffect copy() { + return new SlightMalfunctionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + int result = player.rollDice(outcome, source, game, 6); + ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(1), false); + ability.addTarget(new TargetAnyTarget(0, result)); + game.fireReflexiveTriggeredAbility(ability, source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Unfinity.java b/Mage.Sets/src/mage/sets/Unfinity.java index 40be8a4684d..91eaded2c71 100644 --- a/Mage.Sets/src/mage/sets/Unfinity.java +++ b/Mage.Sets/src/mage/sets/Unfinity.java @@ -40,6 +40,7 @@ public final class Unfinity extends ExpansionSet { cards.add(new SetCardInfo("Plains", 235, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Sacred Foundry", 285, Rarity.RARE, mage.cards.s.SacredFoundry.class)); cards.add(new SetCardInfo("Saw in Half", 88, Rarity.RARE, mage.cards.s.SawInHalf.class)); + cards.add(new SetCardInfo("Slight Malfunction", 123, Rarity.COMMON, mage.cards.s.SlightMalfunction.class)); cards.add(new SetCardInfo("Steam Vents", 283, Rarity.RARE, mage.cards.s.SteamVents.class)); cards.add(new SetCardInfo("Stomping Ground", 280, Rarity.RARE, mage.cards.s.StompingGround.class)); cards.add(new SetCardInfo("Swamp", 237, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS));