diff --git a/Mage.Sets/src/mage/cards/s/SeeTheTruth.java b/Mage.Sets/src/mage/cards/s/SeeTheTruth.java new file mode 100644 index 0000000000..66540a9ae3 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SeeTheTruth.java @@ -0,0 +1,83 @@ +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; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +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; + +/** + * @author TheElk801 + */ +public final class SeeTheTruth extends CardImpl { + + public SeeTheTruth(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U}"); + + // 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) { + super(card); + } + + @Override + public SeeTheTruth copy() { + return new SeeTheTruth(this); + } +} + +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."; + } + + private SeeTheTruthEffect(final SeeTheTruthEffect effect) { + super(effect); + } + + @Override + public SeeTheTruthEffect copy() { + return new SeeTheTruthEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == 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); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/CoreSet2021.java b/Mage.Sets/src/mage/sets/CoreSet2021.java index 05b81e365b..5a7b07f97d 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2021.java +++ b/Mage.Sets/src/mage/sets/CoreSet2021.java @@ -97,6 +97,7 @@ public final class CoreSet2021 extends ExpansionSet { cards.add(new SetCardInfo("Rin and Seri, Inseparable", 278, Rarity.MYTHIC, mage.cards.r.RinAndSeriInseparable.class)); cards.add(new SetCardInfo("Runed Halo", 32, Rarity.RARE, mage.cards.r.RunedHalo.class)); cards.add(new SetCardInfo("Seasoned Hallowblade", 34, Rarity.UNCOMMON, mage.cards.s.SeasonedHallowblade.class)); + cards.add(new SetCardInfo("See the Truth", 69, Rarity.RARE, mage.cards.s.SeeTheTruth.class)); cards.add(new SetCardInfo("Shipwreck Dowser", 71, Rarity.UNCOMMON, mage.cards.s.ShipwreckDowser.class)); cards.add(new SetCardInfo("Sigiled Contender", 323, Rarity.UNCOMMON, mage.cards.s.SigiledContender.class)); cards.add(new SetCardInfo("Solemn Simulacrum", 239, Rarity.RARE, mage.cards.s.SolemnSimulacrum.class));