From b7bf0de2b5c7fc8cfe61acf4487809f1f5082f50 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Thu, 12 Sep 2024 11:18:17 -0400 Subject: [PATCH] [DSK] Implement Miasma Demon --- Mage.Sets/src/mage/cards/m/MiasmaDemon.java | 85 +++++++++++++++++++ .../src/mage/sets/DuskmournHouseOfHorror.java | 1 + 2 files changed, 86 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MiasmaDemon.java diff --git a/Mage.Sets/src/mage/cards/m/MiasmaDemon.java b/Mage.Sets/src/mage/cards/m/MiasmaDemon.java new file mode 100644 index 000000000000..d1cb6d2b296e --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MiasmaDemon.java @@ -0,0 +1,85 @@ +package mage.cards.m; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MiasmaDemon extends CardImpl { + + public MiasmaDemon(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}"); + + this.subtype.add(SubType.DEMON); + this.power = new MageInt(5); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // When Miasma Demon enters, you may discard any number of cards. When you do, up to that many target creatures each get -2/-2 until end of turn. + this.addAbility(new EntersBattlefieldTriggeredAbility(new MiasmaDemonEffect())); + } + + private MiasmaDemon(final MiasmaDemon card) { + super(card); + } + + @Override + public MiasmaDemon copy() { + return new MiasmaDemon(this); + } +} + +class MiasmaDemonEffect extends OneShotEffect { + + MiasmaDemonEffect() { + super(Outcome.Benefit); + staticText = "you may discard any number of cards. When you do, " + + "up to that many target creatures each get -2/-2 until end of turn"; + } + + private MiasmaDemonEffect(final MiasmaDemonEffect effect) { + super(effect); + } + + @Override + public MiasmaDemonEffect copy() { + return new MiasmaDemonEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + int amount = player.discard(0, Integer.MAX_VALUE, false, source, game).size(); + if (amount < 1) { + return false; + } + ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( + new BoostTargetEffect(-2, -2), false, + "Up to that many target creatures each get -2/-2 until end of turn" + ); + ability.addTarget(new TargetCreaturePermanent(0, amount)); + game.fireReflexiveTriggeredAbility(ability, source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java index 40f7384132d8..a9a09bed0fc6 100644 --- a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java +++ b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java @@ -127,6 +127,7 @@ private DuskmournHouseOfHorror() { cards.add(new SetCardInfo("Malevolent Chandelier", 252, Rarity.COMMON, mage.cards.m.MalevolentChandelier.class)); cards.add(new SetCardInfo("Manifest Dread", 189, Rarity.COMMON, mage.cards.m.ManifestDread.class)); cards.add(new SetCardInfo("Marina Vendrell's Grimoire", 64, Rarity.RARE, mage.cards.m.MarinaVendrellsGrimoire.class)); + cards.add(new SetCardInfo("Miasma Demon", 109, Rarity.UNCOMMON, mage.cards.m.MiasmaDemon.class)); cards.add(new SetCardInfo("Midnight Mayhem", 222, Rarity.UNCOMMON, mage.cards.m.MidnightMayhem.class)); cards.add(new SetCardInfo("Most Valuable Slayer", 144, Rarity.COMMON, mage.cards.m.MostValuableSlayer.class)); cards.add(new SetCardInfo("Mountain", 275, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS));