From ac39b3fc39594f05e38c40d17c3df23968b97bf9 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 11 Jan 2019 23:06:48 -0500 Subject: [PATCH] Implemented Clear the Mind --- Mage.Sets/src/mage/cards/c/ClearTheMind.java | 72 +++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + 2 files changed, 73 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/ClearTheMind.java diff --git a/Mage.Sets/src/mage/cards/c/ClearTheMind.java b/Mage.Sets/src/mage/cards/c/ClearTheMind.java new file mode 100644 index 0000000000..878ceb162e --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ClearTheMind.java @@ -0,0 +1,72 @@ +package mage.cards.c; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ClearTheMind extends CardImpl { + + public ClearTheMind(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}"); + + // Target player shuffles their graveyard into their library. + this.getSpellAbility().addEffect(new ClearTheMindEffect()); + this.getSpellAbility().addTarget(new TargetPlayer()); + + // Draw a card. + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1)); + } + + private ClearTheMind(final ClearTheMind card) { + super(card); + } + + @Override + public ClearTheMind copy() { + return new ClearTheMind(this); + } +} + +class ClearTheMindEffect extends OneShotEffect { + + ClearTheMindEffect() { + super(Outcome.Benefit); + staticText = "Target player shuffles their graveyard into their library."; + } + + private ClearTheMindEffect(final ClearTheMindEffect effect) { + super(effect); + } + + @Override + public ClearTheMindEffect copy() { + return new ClearTheMindEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + player.putCardsOnBottomOfLibrary( + new CardsImpl(player.getGraveyard().getCards(game)), + game, source, false + ); + player.shuffleLibrary(source, game); + return true; + } +} \ 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 8c26a4b5ac..bb8faffba4 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -76,6 +76,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Civic Stalwart", 6, Rarity.COMMON, mage.cards.c.CivicStalwart.class)); cards.add(new SetCardInfo("Clamor Shaman", 96, Rarity.UNCOMMON, mage.cards.c.ClamorShaman.class)); cards.add(new SetCardInfo("Clan Guildmage", 162, Rarity.UNCOMMON, mage.cards.c.ClanGuildmage.class)); + cards.add(new SetCardInfo("Clear the Mind", 34, Rarity.COMMON, mage.cards.c.ClearTheMind.class)); cards.add(new SetCardInfo("Code of Constraint", 35, Rarity.UNCOMMON, mage.cards.c.CodeOfConstraint.class)); cards.add(new SetCardInfo("Collision // Colossus", 223, Rarity.UNCOMMON, mage.cards.c.CollisionColossus.class)); cards.add(new SetCardInfo("Combine Guildmage", 163, Rarity.UNCOMMON, mage.cards.c.CombineGuildmage.class));