From 339475c398a7a4cfed1fafb5839ee9fdc836fc9a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 11 Jan 2019 23:31:24 -0500 Subject: [PATCH] Implemented Thought Collapse --- .../src/mage/cards/t/ThoughtCollapse.java | 66 +++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + 2 files changed, 67 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/ThoughtCollapse.java diff --git a/Mage.Sets/src/mage/cards/t/ThoughtCollapse.java b/Mage.Sets/src/mage/cards/t/ThoughtCollapse.java new file mode 100644 index 0000000000..e09ad3f024 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/ThoughtCollapse.java @@ -0,0 +1,66 @@ +package mage.cards.t; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CounterTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetSpell; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ThoughtCollapse extends CardImpl { + + public ThoughtCollapse(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}{U}"); + + // Counter target spell. Its controller puts the top three cards of their library into their graveyard. + this.getSpellAbility().addEffect(new ThoughtCollapseEffect()); + this.getSpellAbility().addTarget(new TargetSpell()); + } + + private ThoughtCollapse(final ThoughtCollapse card) { + super(card); + } + + @Override + public ThoughtCollapse copy() { + return new ThoughtCollapse(this); + } +} + +class ThoughtCollapseEffect extends OneShotEffect { + + ThoughtCollapseEffect() { + super(Outcome.Benefit); + staticText = "Counter target spell. Its controller puts " + + "the top three cards of their library into their graveyard."; + } + + private ThoughtCollapseEffect(final ThoughtCollapseEffect effect) { + super(effect); + } + + @Override + public ThoughtCollapseEffect copy() { + return new ThoughtCollapseEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(game.getControllerId(source.getFirstTarget())); + if (player == null) { + return false; + } + player.moveCards(player.getLibrary().getTopCards(game, 3), Zone.GRAVEYARD, source, game); + return new CounterTargetEffect().apply(game, source); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index ede46cf56e..7ef12c0398 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -275,6 +275,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("The Haunt of Hightower", 273, Rarity.MYTHIC, mage.cards.t.TheHauntOfHightower.class)); cards.add(new SetCardInfo("Theater of Horrors", 213, Rarity.RARE, mage.cards.t.TheaterOfHorrors.class)); cards.add(new SetCardInfo("Thirsting Shade", 87, Rarity.COMMON, mage.cards.t.ThirstingShade.class)); + cards.add(new SetCardInfo("Thought Collapse", 57, Rarity.COMMON, mage.cards.t.ThoughtCollapse.class)); cards.add(new SetCardInfo("Thrash // Threat", 229, Rarity.RARE, mage.cards.t.ThrashThreat.class)); cards.add(new SetCardInfo("Titanic Brawl", 146, Rarity.COMMON, mage.cards.t.TitanicBrawl.class)); cards.add(new SetCardInfo("Tithe Taker", 27, Rarity.RARE, mage.cards.t.TitheTaker.class));