From 2cdb2693471c9fea7b7ff76fa1a8d5dabe4093e8 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 16 Sep 2019 09:48:27 -0400 Subject: [PATCH] Implemented Drown in the Loch --- .../src/mage/cards/d/DrownInTheLoch.java | 70 +++++++++++++++++++ Mage.Sets/src/mage/sets/ThroneOfEldraine.java | 1 + 2 files changed, 71 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DrownInTheLoch.java diff --git a/Mage.Sets/src/mage/cards/d/DrownInTheLoch.java b/Mage.Sets/src/mage/cards/d/DrownInTheLoch.java new file mode 100644 index 00000000000..0fcbf673e25 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DrownInTheLoch.java @@ -0,0 +1,70 @@ +package mage.cards.d; + +import mage.MageObject; +import mage.abilities.Mode; +import mage.abilities.effects.common.CounterTargetEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.filter.FilterPermanent; +import mage.filter.FilterSpell; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.TargetSpell; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DrownInTheLoch extends CardImpl { + + private static final FilterSpell filter + = new FilterSpell("spell with converted mana cost less than or equal to " + + "the number of cards in its controller's graveyard"); + private static final FilterPermanent filter2 + = new FilterCreaturePermanent("creature with converted mana cost less than or equal to " + + "the number of cards in its controller's graveyard"); + + static { + filter.add(DrownInTheLochPredicate.instance); + filter2.add(DrownInTheLochPredicate.instance); + } + + public DrownInTheLoch(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}{B}"); + + // Choose one — + // • Counter target spell with converted mana cost less than or equal to the number of cards in its controller's graveyard. + this.getSpellAbility().addEffect(new CounterTargetEffect()); + this.getSpellAbility().addTarget(new TargetSpell(filter)); + + // • Destroy target creature with converted mana cost less than or equal to the number of cards in its controller's graveyard. + Mode mode = new Mode(new DestroyTargetEffect()); + mode.addTarget(new TargetPermanent(filter2)); + this.getSpellAbility().addMode(mode); + } + + private DrownInTheLoch(final DrownInTheLoch card) { + super(card); + } + + @Override + public DrownInTheLoch copy() { + return new DrownInTheLoch(this); + } +} + +enum DrownInTheLochPredicate implements Predicate { + instance; + + @Override + public boolean apply(MageObject input, Game game) { + Player player = game.getPlayer(game.getControllerId(input.getId())); + return player != null && input.getConvertedManaCost() <= player.getGraveyard().size(); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java index 24e0093ad92..553c76a8f25 100644 --- a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java +++ b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java @@ -61,6 +61,7 @@ public final class ThroneOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Dance of the Manse", 186, Rarity.RARE, mage.cards.d.DanceOfTheManse.class)); cards.add(new SetCardInfo("Deafening Silence", 10, Rarity.UNCOMMON, mage.cards.d.DeafeningSilence.class)); cards.add(new SetCardInfo("Doom Foretold", 187, Rarity.RARE, mage.cards.d.DoomForetold.class)); + cards.add(new SetCardInfo("Drown in the Loch", 188, Rarity.UNCOMMON, mage.cards.d.DrownInTheLoch.class)); cards.add(new SetCardInfo("Edgewall Innkeeper", 151, Rarity.UNCOMMON, mage.cards.e.EdgewallInnkeeper.class)); cards.add(new SetCardInfo("Elite Headhunter", 209, Rarity.UNCOMMON, mage.cards.e.EliteHeadhunter.class)); cards.add(new SetCardInfo("Embercleave", 120, Rarity.MYTHIC, mage.cards.e.Embercleave.class));