From f4f24502f442ee142270e8084d7d53ea6fa1d7fc Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 15 Nov 2018 12:05:06 -0600 Subject: [PATCH] - Added Discordant Dirge. Urza's Saga Set 100% done. --- .../src/mage/cards/d/DiscordantDirge.java | 99 +++++++++++++++++++ Mage.Sets/src/mage/sets/UrzasSaga.java | 1 + 2 files changed, 100 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DiscordantDirge.java diff --git a/Mage.Sets/src/mage/cards/d/DiscordantDirge.java b/Mage.Sets/src/mage/cards/d/DiscordantDirge.java new file mode 100644 index 0000000000..cab74cb987 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DiscordantDirge.java @@ -0,0 +1,99 @@ +package mage.cards.d; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetOpponent; + +/** + * + * @author jeffwadsworth + */ +public final class DiscordantDirge extends CardImpl { + + private static final String rule = "Look at target opponent's hand and choose up to X cards from it, where X is the number of verse counters on {this}. That player discards those cards.."; + + public DiscordantDirge(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}{B}"); + + // At the beginning of your upkeep, you may put a verse counter on Discordant Dirge. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, + new AddCountersSourceEffect(CounterType.VERSE.createInstance(), true), TargetController.YOU, true)); + + // {B}, Sacrifice Discordant Dirge: Look at target opponent's hand and choose up to X cards from it, where X is the number of verse counters on Discordant Dirge. That player discards those cards. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + new DiscordantDirgeEffect(), + new ManaCostsImpl("{B}")); + ability.addCost(new SacrificeSourceCost()); + ability.addTarget(new TargetOpponent()); + this.addAbility(ability); + } + + public DiscordantDirge(final DiscordantDirge card) { + super(card); + } + + @Override + public DiscordantDirge copy() { + return new DiscordantDirge(this); + } +} + +class DiscordantDirgeEffect extends OneShotEffect { + + public DiscordantDirgeEffect() { + super(Outcome.Benefit); + staticText = "Look at target opponent's hand and choose up to X cards from it, where X is the number of verse counters on {this}. That player discards those card."; + } + + public DiscordantDirgeEffect(final DiscordantDirgeEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent discordantDirge = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (discordantDirge != null) { + int verseCounters = discordantDirge.getCounters(game).getCount(CounterType.VERSE); + Player targetOpponent = game.getPlayer(source.getFirstTarget()); + Player controller = game.getPlayer(source.getControllerId()); + if (targetOpponent != null + && controller != null) { + controller.lookAtCards(targetOpponent.getName() + " hand", targetOpponent.getHand(), game); + TargetCard target = new TargetCard(0, verseCounters, Zone.HAND, new FilterCard()); + target.setNotTarget(true); + if (controller.choose(Outcome.Benefit, targetOpponent.getHand(), target, game)) { + target.getTargets().stream().map((targetCardId) -> game.getCard(targetCardId)).filter((card) -> (card != null + && targetOpponent.getHand().contains(card.getId()))).forEachOrdered((card) -> { + targetOpponent.discard(card, source, game); + }); + return true; + } + } + } + return false; + } + + @Override + public DiscordantDirgeEffect copy() { + return new DiscordantDirgeEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/UrzasSaga.java b/Mage.Sets/src/mage/sets/UrzasSaga.java index e9122c12f5..ab0632ed8e 100644 --- a/Mage.Sets/src/mage/sets/UrzasSaga.java +++ b/Mage.Sets/src/mage/sets/UrzasSaga.java @@ -98,6 +98,7 @@ public final class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Diabolic Servitude", 130, Rarity.UNCOMMON, mage.cards.d.DiabolicServitude.class)); cards.add(new SetCardInfo("Disciple of Grace", 10, Rarity.COMMON, mage.cards.d.DiscipleOfGrace.class)); cards.add(new SetCardInfo("Disciple of Law", 11, Rarity.COMMON, mage.cards.d.DiscipleOfLaw.class)); + cards.add(new SetCardInfo("Discordant Dirge", 131, Rarity.RARE, mage.cards.d.DiscordantDirge.class)); cards.add(new SetCardInfo("Disenchant", 12, Rarity.COMMON, mage.cards.d.Disenchant.class)); cards.add(new SetCardInfo("Disorder", 181, Rarity.UNCOMMON, mage.cards.d.Disorder.class)); cards.add(new SetCardInfo("Disruptive Student", 69, Rarity.COMMON, mage.cards.d.DisruptiveStudent.class));