From f6617c03deed53a7c9d3a51175f4367688998eff Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Sat, 28 Oct 2023 17:35:22 +0200 Subject: [PATCH] [LCI] Dauntless Dismantler --- .../src/mage/cards/d/DauntlessDismantler.java | 92 +++++++++++++++++++ .../src/mage/sets/TheLostCavernsOfIxalan.java | 1 + 2 files changed, 93 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DauntlessDismantler.java diff --git a/Mage.Sets/src/mage/cards/d/DauntlessDismantler.java b/Mage.Sets/src/mage/cards/d/DauntlessDismantler.java new file mode 100644 index 00000000000..7b706bbef1e --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DauntlessDismantler.java @@ -0,0 +1,92 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterArtifactPermanent; +import mage.filter.predicate.mageobject.ManaValuePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class DauntlessDismantler extends CardImpl { + + private static final FilterPermanent filter = new FilterArtifactPermanent("artifacts your opponents control"); + + static { + filter.add(TargetController.OPPONENT.getControllerPredicate()); + } + + public DauntlessDismantler(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ARTIFICER); + this.power = new MageInt(1); + this.toughness = new MageInt(4); + + // Artifacts your opponents control enter the battlefield tapped. + this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(filter))); + + // {X}{X}{W}, Sacrifice Dauntless Dismantler: Destroy each artifact with mana value X. + Ability ability = new SimpleActivatedAbility( + new DauntlessDismantlerEffect(), + new ManaCostsImpl<>("{X}{X}{W}") + ); + ability.addCost(new SacrificeSourceCost()); + this.addAbility(ability); + } + + private DauntlessDismantler(final DauntlessDismantler card) { + super(card); + } + + @Override + public DauntlessDismantler copy() { + return new DauntlessDismantler(this); + } +} + +/** + * Inspired by {@link mage.cards.k.KarnsSylex} + */ +class DauntlessDismantlerEffect extends OneShotEffect { + + DauntlessDismantlerEffect() { + super(Outcome.DestroyPermanent); + staticText = "destroy each artifact with mana value X"; + } + + private DauntlessDismantlerEffect(final DauntlessDismantlerEffect effect) { + super(effect); + } + + public DauntlessDismantlerEffect copy() { + return new DauntlessDismantlerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + FilterPermanent filter = new FilterArtifactPermanent(); + filter.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, source.getManaCostsToPay().getX())); + + boolean destroyed = false; + for (Permanent permanent : game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { + destroyed |= permanent.destroy(source, game); + } + return destroyed; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java b/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java index de5a3be329d..9b6fc0176de 100644 --- a/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java +++ b/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java @@ -39,6 +39,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet { cards.add(new SetCardInfo("Compass Gnome", 250, Rarity.COMMON, mage.cards.c.CompassGnome.class)); cards.add(new SetCardInfo("Confounding Riddle", 50, Rarity.UNCOMMON, mage.cards.c.ConfoundingRiddle.class)); cards.add(new SetCardInfo("Cosmium Kiln", 6, Rarity.UNCOMMON, mage.cards.c.CosmiumKiln.class)); + cards.add(new SetCardInfo("Dauntless Dismantler", 8, Rarity.UNCOMMON, mage.cards.d.DauntlessDismantler.class)); cards.add(new SetCardInfo("Deeproot Pilgrimage", 52, Rarity.RARE, mage.cards.d.DeeprootPilgrimage.class)); cards.add(new SetCardInfo("Defossilize", 103, Rarity.UNCOMMON, mage.cards.d.Defossilize.class)); cards.add(new SetCardInfo("Didact Echo", 53, Rarity.COMMON, mage.cards.d.DidactEcho.class));