diff --git a/Mage.Sets/src/mage/cards/k/KlauthsWill.java b/Mage.Sets/src/mage/cards/k/KlauthsWill.java new file mode 100644 index 00000000000..882db834cd7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KlauthsWill.java @@ -0,0 +1,78 @@ +package mage.cards.k; + +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.condition.common.ControlACommanderCondition; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.common.DamageAllEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.game.Game; +import mage.target.TargetPermanent; +import mage.target.targetadjustment.TargetAdjuster; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class KlauthsWill extends CardImpl { + + private static final FilterPermanent filter = new FilterCreaturePermanent("creature without flying"); + + static { + filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); + } + + public KlauthsWill(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{R}{R}{G}"); + + // Choose one. If you control a commander as you cast this spell, you may choose both. + this.getSpellAbility().getModes().setChooseText( + "Choose one. If you control a commander as you cast this spell, you may choose both." + ); + this.getSpellAbility().getModes().setMoreCondition(ControlACommanderCondition.instance); + + // • Breathe Flame — Klauth's Will deals X damage to each creature without flying. + this.getSpellAbility().addEffect(new DamageAllEffect(ManacostVariableValue.REGULAR, filter)); + this.getSpellAbility().withFirstModeFlavorWord("Breathe Flame"); + + // • Smash Relics — Destroy up to X target artifacts and/or enchantments. + this.getSpellAbility().addMode(new Mode( + new DestroyTargetEffect().setText("destroy up to X target artifacts and/or enchantments") + ).withFlavorWord("Smash Relics")); + this.getSpellAbility().setTargetAdjuster(KlauthsWillAdjuster.instance); + } + + private KlauthsWill(final KlauthsWill card) { + super(card); + } + + @Override + public KlauthsWill copy() { + return new KlauthsWill(this); + } +} + +enum KlauthsWillAdjuster implements TargetAdjuster { + instance; + + @Override + public void adjustTargets(Ability ability, Game game) { + if (ability.getEffects().stream().anyMatch(DestroyTargetEffect.class::isInstance)) { + ability.getTargets().clear(); + ability.addTarget(new TargetPermanent( + 0, ability.getManaCostsToPay().getX(), + StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT + )); + } + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java b/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java index 72b707ff026..c662f18d6cd 100644 --- a/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java +++ b/Mage.Sets/src/mage/sets/ForgottenRealmsCommander.java @@ -139,6 +139,7 @@ public final class ForgottenRealmsCommander extends ExpansionSet { cards.add(new SetCardInfo("Karmic Guide", 68, Rarity.RARE, mage.cards.k.KarmicGuide.class)); cards.add(new SetCardInfo("Kenrith's Transformation", 162, Rarity.UNCOMMON, mage.cards.k.KenrithsTransformation.class)); cards.add(new SetCardInfo("Kindred Summons", 163, Rarity.RARE, mage.cards.k.KindredSummons.class)); + cards.add(new SetCardInfo("Klauth's Will", 51, Rarity.RARE, mage.cards.k.KlauthsWill.class)); cards.add(new SetCardInfo("Klauth, Unrivaled Ancient", 50, Rarity.MYTHIC, mage.cards.k.KlauthUnrivaledAncient.class)); cards.add(new SetCardInfo("Knight of Autumn", 187, Rarity.RARE, mage.cards.k.KnightOfAutumn.class)); cards.add(new SetCardInfo("Light Up the Stage", 131, Rarity.UNCOMMON, mage.cards.l.LightUpTheStage.class));