From 2b9fe91b639ce0bc37cf30780ac643eb33baaf8e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 5 Apr 2020 16:03:06 -0400 Subject: [PATCH] Implemented Mythos of Nethroi --- .../src/mage/cards/m/MythosOfNethroi.java | 73 +++++++++++++++++++ .../src/mage/sets/IkoriaLairOfBehemoths.java | 1 + 2 files changed, 74 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MythosOfNethroi.java diff --git a/Mage.Sets/src/mage/cards/m/MythosOfNethroi.java b/Mage.Sets/src/mage/cards/m/MythosOfNethroi.java new file mode 100644 index 0000000000..17c951f86e --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MythosOfNethroi.java @@ -0,0 +1,73 @@ +package mage.cards.m; + +import mage.abilities.Ability; +import mage.abilities.condition.CompoundCondition; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.ManaWasSpentCondition; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.ColoredManaSymbol; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetNonlandPermanent; +import mage.watchers.common.ManaSpentToCastWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MythosOfNethroi extends CardImpl { + + public MythosOfNethroi(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}"); + + // Destroy target nonland permanent if it's a creature or if {G}{W} was spent to cast this spell. + this.getSpellAbility().addEffect(new MythosOfNethroiEffect()); + this.getSpellAbility().addTarget(new TargetNonlandPermanent()); + this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher()); + } + + private MythosOfNethroi(final MythosOfNethroi card) { + super(card); + } + + @Override + public MythosOfNethroi copy() { + return new MythosOfNethroi(this); + } +} + +class MythosOfNethroiEffect extends OneShotEffect { + + private static final Condition condition = new CompoundCondition( + new ManaWasSpentCondition(ColoredManaSymbol.G), + new ManaWasSpentCondition(ColoredManaSymbol.W) + ); + + MythosOfNethroiEffect() { + super(Outcome.Benefit); + staticText = "Destroy target nonland permanent if it's a creature or if {G}{W} was spent to cast this spell."; + } + + private MythosOfNethroiEffect(final MythosOfNethroiEffect effect) { + super(effect); + } + + @Override + public MythosOfNethroiEffect copy() { + return new MythosOfNethroiEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent == null || (!permanent.isCreature() && !condition.apply(game, source))) { + return false; + } + return permanent.destroy(source.getSourceId(), game, false); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java index d3488ce8a0..406f967bd4 100644 --- a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java +++ b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java @@ -58,6 +58,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet { cards.add(new SetCardInfo("Migration Path", 164, Rarity.UNCOMMON, mage.cards.m.MigrationPath.class)); cards.add(new SetCardInfo("Mosscoat Goriak", 167, Rarity.COMMON, mage.cards.m.MosscoatGoriak.class)); cards.add(new SetCardInfo("Mysterious Egg", 3, Rarity.COMMON, mage.cards.m.MysteriousEgg.class)); + cards.add(new SetCardInfo("Mythos of Nethroi", 97, Rarity.RARE, mage.cards.m.MythosOfNethroi.class)); cards.add(new SetCardInfo("Nethroi, Apex of Death", 197, Rarity.MYTHIC, mage.cards.n.NethroiApexOfDeath.class)); cards.add(new SetCardInfo("Neutralize", 59, Rarity.UNCOMMON, mage.cards.n.Neutralize.class)); cards.add(new SetCardInfo("Pacifism", 25, Rarity.COMMON, mage.cards.p.Pacifism.class));