From d9d62585db213e590dfb625b6fe27798dbe4fe67 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 17 Jun 2019 22:36:53 -0400 Subject: [PATCH] Implemented Thought Distortion --- .../src/mage/cards/t/ThoughtDistortion.java | 83 +++++++++++++++++++ Mage.Sets/src/mage/sets/CoreSet2020.java | 1 + 2 files changed, 84 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/ThoughtDistortion.java diff --git a/Mage.Sets/src/mage/cards/t/ThoughtDistortion.java b/Mage.Sets/src/mage/cards/t/ThoughtDistortion.java new file mode 100644 index 00000000000..1981b4d3de2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/ThoughtDistortion.java @@ -0,0 +1,83 @@ +package mage.cards.t; + +import mage.abilities.Ability; +import mage.abilities.common.CantBeCounteredAbility; +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.filter.FilterCard; +import mage.filter.common.FilterNonlandCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ThoughtDistortion extends CardImpl { + + public ThoughtDistortion(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}{B}"); + + // This spell can't be countered. + this.addAbility(new CantBeCounteredAbility()); + + // Target opponent reveals their hand. Exile all noncreature, nonland cards from that player's hand and graveyard. + this.getSpellAbility().addEffect(new ThoughtDistortionEffect()); + this.getSpellAbility().addTarget(new TargetOpponent()); + } + + private ThoughtDistortion(final ThoughtDistortion card) { + super(card); + } + + @Override + public ThoughtDistortion copy() { + return new ThoughtDistortion(this); + } +} + +class ThoughtDistortionEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterNonlandCard(); + + static { + filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); + } + + ThoughtDistortionEffect() { + super(Outcome.Benefit); + staticText = "Target opponent reveals their hand. Exile all noncreature, " + + "nonland cards from that player's hand and graveyard."; + } + + private ThoughtDistortionEffect(final ThoughtDistortionEffect effect) { + super(effect); + } + + @Override + public ThoughtDistortionEffect copy() { + return new ThoughtDistortionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getFirstTarget()); + if (player == null) { + return false; + } + player.revealCards(source, player.getHand(), game); + Cards cards = new CardsImpl(player.getHand().getCards(filter, game)); + cards.addAll(player.getGraveyard().getCards(filter, game)); + return player.moveCards(cards, Zone.EXILED, source, game); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index d7ef7a9858e..6e37f10205b 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -51,6 +51,7 @@ public final class CoreSet2020 extends ExpansionSet { cards.add(new SetCardInfo("Negate", 69, Rarity.COMMON, mage.cards.n.Negate.class)); cards.add(new SetCardInfo("Octoprophet", 70, Rarity.COMMON, mage.cards.o.Octoprophet.class)); cards.add(new SetCardInfo("Silverback Shaman", 195, Rarity.COMMON, mage.cards.s.SilverbackShaman.class)); + cards.add(new SetCardInfo("Thought Distortion", 117, Rarity.UNCOMMON, mage.cards.t.ThoughtDistortion.class)); cards.add(new SetCardInfo("Thrashing Brontodon", 197, Rarity.UNCOMMON, mage.cards.t.ThrashingBrontodon.class)); cards.add(new SetCardInfo("Unsummon", 78, Rarity.COMMON, mage.cards.u.Unsummon.class)); cards.add(new SetCardInfo("Yarok's Fenlurker", 123, Rarity.UNCOMMON, mage.cards.y.YaroksFenlurker.class));