From 146c9571ca795e0cefe84b97e56f6af126c052aa Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 16 Jun 2020 10:42:33 +0200 Subject: [PATCH] * See the Truth - Fixed some problems of the implementation (#6646). --- Mage.Sets/src/mage/cards/s/SeeTheTruth.java | 37 ++++++++++----------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/Mage.Sets/src/mage/cards/s/SeeTheTruth.java b/Mage.Sets/src/mage/cards/s/SeeTheTruth.java index 66540a9ae3b..d348423e466 100644 --- a/Mage.Sets/src/mage/cards/s/SeeTheTruth.java +++ b/Mage.Sets/src/mage/cards/s/SeeTheTruth.java @@ -1,7 +1,6 @@ package mage.cards.s; import mage.abilities.Ability; -import mage.abilities.condition.common.CastFromHandSourceCondition; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -13,9 +12,10 @@ import mage.constants.Zone; import mage.game.Game; import mage.players.Player; import mage.target.common.TargetCardInLibrary; -import mage.watchers.common.CastFromHandWatcher; import java.util.UUID; +import mage.filter.FilterCard; +import mage.game.stack.Spell; /** * @author TheElk801 @@ -27,7 +27,6 @@ public final class SeeTheTruth extends CardImpl { // Look at the top three cards of your library. Put one of those cards into your hand and the rest on the bottom of your library in any order. If this spell was cast from anywhere other than your hand, put each of those cards into your hand instead. this.getSpellAbility().addEffect(new SeeTheTruthEffect()); - this.getSpellAbility().addWatcher(new CastFromHandWatcher()); } private SeeTheTruth(final SeeTheTruth card) { @@ -44,10 +43,10 @@ class SeeTheTruthEffect extends OneShotEffect { SeeTheTruthEffect() { super(Outcome.Benefit); - staticText = "Look at the top three cards of your library. " + - "Put one of those cards into your hand and the rest on the bottom of your library in any order. " + - "If this spell was cast from anywhere other than your hand, " + - "put each of those cards into your hand instead."; + staticText = "Look at the top three cards of your library. " + + "Put one of those cards into your hand and the rest on the bottom of your library in any order. " + + "If this spell was cast from anywhere other than your hand, " + + "put each of those cards into your hand instead."; } private SeeTheTruthEffect(final SeeTheTruthEffect effect) { @@ -62,21 +61,21 @@ class SeeTheTruthEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - if (player == null) { + Spell sourceSpell = game.getStack().getSpell(source.getId()); // Use id to get the correct spell in case of copied spells + if (player == null || sourceSpell == null) { return false; } Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 3)); - if (cards.size() < 1) { - return false; - } - if (CastFromHandSourceCondition.instance.apply(game, source)) { - TargetCardInLibrary target = new TargetCardInLibrary(); - player.choose(outcome, cards, target, game); - cards.removeIf(target.getFirstTarget()::equals); - player.moveCards(game.getCard(target.getFirstTarget()), Zone.HAND, source, game); - player.putCardsOnBottomOfLibrary(cards, game, source, true); - } else { - player.moveCards(cards, Zone.HAND, source, game); + if (!cards.isEmpty()) { + if (sourceSpell.isCopy() || Zone.HAND.equals(sourceSpell.getFromZone())) { // A copied spell was NOT cast at all + TargetCardInLibrary target = new TargetCardInLibrary(new FilterCard("card to put into your hand")); + player.chooseTarget(outcome, cards, target, source, game); + cards.removeIf(target.getFirstTarget()::equals); + player.moveCards(game.getCard(target.getFirstTarget()), Zone.HAND, source, game); + player.putCardsOnBottomOfLibrary(cards, game, source, true); + } else { + player.moveCards(cards, Zone.HAND, source, game); + } } return true; }