From 6947716978ab7516f8219ba537dd88c9635bb744 Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Sat, 6 Nov 2021 08:16:03 -0500 Subject: [PATCH] [VOW] Implemented Dread Fugue --- Mage.Sets/src/mage/cards/d/DreadFugue.java | 94 +++++++++++++++++++ .../src/mage/sets/InnistradCrimsonVow.java | 1 + 2 files changed, 95 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DreadFugue.java diff --git a/Mage.Sets/src/mage/cards/d/DreadFugue.java b/Mage.Sets/src/mage/cards/d/DreadFugue.java new file mode 100644 index 0000000000..896e191ee1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DreadFugue.java @@ -0,0 +1,94 @@ +package mage.cards.d; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.CleaveAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.common.FilterNonlandCard; +import mage.filter.predicate.mageobject.ManaValuePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.TargetPlayer; + +/** + * + * @author weirddan455 + */ +public final class DreadFugue extends CardImpl { + + private static final FilterNonlandCard filter = new FilterNonlandCard("nonland card [with mana value 2 or less]"); + + static { + filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 3)); + } + + public DreadFugue(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}"); + + // Cleave {2}{B} + Ability ability = new CleaveAbility(this, new DreadFugueEffect(StaticFilters.FILTER_CARD_NON_LAND), "{2}{B}"); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); + + // Target player reveals their hand. You may choose a nonland card from it [with mana value 2 or less]. That player discards that card. + this.getSpellAbility().addTarget(new TargetPlayer()); + this.getSpellAbility().addEffect(new DreadFugueEffect(filter)); + } + + private DreadFugue(final DreadFugue card) { + super(card); + } + + @Override + public DreadFugue copy() { + return new DreadFugue(this); + } +} + +class DreadFugueEffect extends OneShotEffect { + + private final FilterCard filter; + + public DreadFugueEffect(FilterCard filter) { + super(Outcome.Discard); + this.filter = filter; + staticText = "Target player reveals their hand. You may choose a nonland card from it [with mana value 2 or less]. That player discards that card"; + } + + private DreadFugueEffect(final DreadFugueEffect effect) { + super(effect); + this.filter = effect.filter; + } + + @Override + public DreadFugueEffect copy() { + return new DreadFugueEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetPlayer = game.getPlayer(source.getFirstTarget()); + Player controller = game.getPlayer(source.getControllerId()); + if (targetPlayer == null || controller == null) { + return false; + } + Card sourceCard = game.getCard(source.getSourceId()); + targetPlayer.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + + sourceCard.getZoneChangeCounter(game) + ')' : "Discard", targetPlayer.getHand(), game); + TargetCard target = new TargetCard(0, 1, Zone.HAND, filter); + controller.choose(Outcome.Benefit, targetPlayer.getHand(), target, game); + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + targetPlayer.discard(card, false, source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java index fba1bc9279..54af30b12d 100644 --- a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java +++ b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java @@ -97,6 +97,7 @@ public final class InnistradCrimsonVow extends ExpansionSet { cards.add(new SetCardInfo("Dominating Vampire", 154, Rarity.RARE, mage.cards.d.DominatingVampire.class)); cards.add(new SetCardInfo("Doomed Dissenter", 106, Rarity.COMMON, mage.cards.d.DoomedDissenter.class)); cards.add(new SetCardInfo("Dormant Grove", 198, Rarity.UNCOMMON, mage.cards.d.DormantGrove.class)); + cards.add(new SetCardInfo("Dread Fugue", 107, Rarity.UNCOMMON, mage.cards.d.DreadFugue.class)); cards.add(new SetCardInfo("Dreadfeast Demon", 108, Rarity.RARE, mage.cards.d.DreadfeastDemon.class)); cards.add(new SetCardInfo("Dreadlight Monstrosity", 57, Rarity.COMMON, mage.cards.d.DreadlightMonstrosity.class)); cards.add(new SetCardInfo("Dreamroot Cascade", 262, Rarity.RARE, mage.cards.d.DreamrootCascade.class));