From fa7ae3ee35ec90744160fbdbb55a502becf2d7b2 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 25 Sep 2018 19:48:26 -0400 Subject: [PATCH] fixed Mnemonic Betrayal not allowing mana of any color --- .../src/mage/cards/m/MnemonicBetrayal.java | 60 ++++++++++++++----- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/Mage.Sets/src/mage/cards/m/MnemonicBetrayal.java b/Mage.Sets/src/mage/cards/m/MnemonicBetrayal.java index 68d2862c59..019527dd74 100644 --- a/Mage.Sets/src/mage/cards/m/MnemonicBetrayal.java +++ b/Mage.Sets/src/mage/cards/m/MnemonicBetrayal.java @@ -1,29 +1,21 @@ package mage.cards.m; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.effects.AsThoughEffectImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.ExileSpellEffect; -import mage.cards.Card; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.cards.Cards; -import mage.cards.CardsImpl; -import mage.constants.AsThoughEffectType; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Zone; +import mage.cards.*; +import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; import mage.players.Player; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + /** - * * @author TheElk801 */ public final class MnemonicBetrayal extends CardImpl { @@ -86,6 +78,7 @@ class MnemonicBetrayalExileEffect extends OneShotEffect { for (Card card : cards.getCards(game)) { cardMap.put(card.getId(), card.getZoneChangeCounter(game)); game.addEffect(new MnemonicBetrayalCastFromExileEffect(card, game), source); + game.addEffect(new MnemonicBetrayalAnyColorEffect(card, game), source); } controller.moveCardsToExile(cards.getCards(game), source, game, true, source.getSourceId(), source.getSourceObjectIfItStillExists(game).getName()); game.addDelayedTriggeredAbility(new MnemonicBetrayalDelayedTriggeredAbility(cards, cardMap), source); @@ -132,6 +125,45 @@ class MnemonicBetrayalCastFromExileEffect extends AsThoughEffectImpl { } } +class MnemonicBetrayalAnyColorEffect extends AsThoughEffectImpl { + + private final Card card; + private final int zoneCounter; + + public MnemonicBetrayalAnyColorEffect(Card card, Game game) { + super(AsThoughEffectType.SPEND_OTHER_MANA, Duration.Custom, Outcome.Benefit); + this.card = card; + this.zoneCounter = card.getZoneChangeCounter(game) + 1; + } + + public MnemonicBetrayalAnyColorEffect(final MnemonicBetrayalAnyColorEffect effect) { + super(effect); + this.card = effect.card; + this.zoneCounter = effect.zoneCounter; + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public MnemonicBetrayalAnyColorEffect copy() { + return new MnemonicBetrayalAnyColorEffect(this); + } + + @Override + public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { + if (card.getZoneChangeCounter(game) != zoneCounter) { + this.discard(); + return false; + } + return objectId.equals(card.getId()) + && card.getZoneChangeCounter(game) == zoneCounter + && affectedControllerId.equals(source.getControllerId()); + } +} + class MnemonicBetrayalDelayedTriggeredAbility extends DelayedTriggeredAbility { private final Cards cards;