diff --git a/Mage.Sets/src/mage/cards/m/MidnightArsonist.java b/Mage.Sets/src/mage/cards/m/MidnightArsonist.java new file mode 100644 index 0000000000..f65ca30b81 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MidnightArsonist.java @@ -0,0 +1,85 @@ +package mage.cards.m; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.abilities.mana.ManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterArtifactPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.Predicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.targetadjustment.TargetAdjuster; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MidnightArsonist extends CardImpl { + + public MidnightArsonist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); + + this.subtype.add(SubType.VAMPIRE); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + + // When Midnight Arsonist enters the battlefield, destroy up to X target artifacts without mana abilities, where X is the number of Vampires you control. + Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect() + .setText("destroy up to X target artifacts without mana abilities, where X is the number of Vampires you control")); + ability.setTargetAdjuster(MidnightArsonistAdjuster.instance); + this.addAbility(ability.addHint(MidnightArsonistAdjuster.getHint())); + } + + private MidnightArsonist(final MidnightArsonist card) { + super(card); + } + + @Override + public MidnightArsonist copy() { + return new MidnightArsonist(this); + } +} + +enum MidnightArsonistAdjuster implements TargetAdjuster { + instance; + private static final FilterPermanent filter = new FilterControlledPermanent(SubType.VAMPIRE); + private static final FilterPermanent filter2 = new FilterArtifactPermanent("artifacts without mana abilities"); + + static { + filter.add(MidnightArsonistPredicate.instance); + } + + private static final Hint hint = new ValueHint("Vampires you control", new PermanentsOnBattlefieldCount(filter)); + + @Override + public void adjustTargets(Ability ability, Game game) { + int vampires = game.getBattlefield().count(filter, ability.getSourceId(), ability.getControllerId(), game); + ability.getTargets().clear(); + ability.addTarget(new TargetPermanent(0, vampires, filter2)); + } + + public static Hint getHint() { + return hint; + } +} + +enum MidnightArsonistPredicate implements Predicate { + instance; + + @Override + public boolean apply(Permanent input, Game game) { + return input.getAbilities(game).stream().noneMatch(ManaAbility.class::isInstance); + } +} diff --git a/Mage.Sets/src/mage/sets/CrimsonVowCommander.java b/Mage.Sets/src/mage/sets/CrimsonVowCommander.java index b054c6c50d..7896dfbd4c 100644 --- a/Mage.Sets/src/mage/sets/CrimsonVowCommander.java +++ b/Mage.Sets/src/mage/sets/CrimsonVowCommander.java @@ -84,6 +84,7 @@ public final class CrimsonVowCommander extends ExpansionSet { cards.add(new SetCardInfo("Malakir Bloodwitch", 131, Rarity.RARE, mage.cards.m.MalakirBloodwitch.class)); cards.add(new SetCardInfo("Marble Diamond", 165, Rarity.COMMON, mage.cards.m.MarbleDiamond.class)); cards.add(new SetCardInfo("Mentor of the Meek", 93, Rarity.RARE, mage.cards.m.MentorOfTheMeek.class)); + cards.add(new SetCardInfo("Midnight Arsonist", 27, Rarity.RARE, mage.cards.m.MidnightArsonist.class)); cards.add(new SetCardInfo("Midnight Clock", 108, Rarity.RARE, mage.cards.m.MidnightClock.class)); cards.add(new SetCardInfo("Mirror Entity", 94, Rarity.RARE, mage.cards.m.MirrorEntity.class)); cards.add(new SetCardInfo("Mob Rule", 147, Rarity.RARE, mage.cards.m.MobRule.class));