Skip to content

Commit

Permalink
[DSK] Implement Miasma Demon
Browse files Browse the repository at this point in the history
  • Loading branch information
theelk801 committed Sep 12, 2024
1 parent 9736a49 commit b7bf0de
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
85 changes: 85 additions & 0 deletions Mage.Sets/src/mage/cards/m/MiasmaDemon.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
1 change: 1 addition & 0 deletions Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit b7bf0de

Please sign in to comment.