diff --git a/Mage.Sets/src/mage/cards/d/DeviousCoverUp.java b/Mage.Sets/src/mage/cards/d/DeviousCoverUp.java index 6094ba5fc0..ca67e1561e 100644 --- a/Mage.Sets/src/mage/cards/d/DeviousCoverUp.java +++ b/Mage.Sets/src/mage/cards/d/DeviousCoverUp.java @@ -4,6 +4,7 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CounterTargetWithReplacementEffect; +import mage.abilities.effects.common.ShuffleIntoLibraryTargetEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -32,7 +33,7 @@ public final class DeviousCoverUp extends CardImpl { this.getSpellAbility().addTarget(new TargetSpell()); // You may shuffle up to four target cards from your graveyard into your library. - this.getSpellAbility().addEffect(new DeviousCoverUpEffect().setTargetPointer(new SecondTargetPointer())); + this.getSpellAbility().addEffect(new ShuffleIntoLibraryTargetEffect(true).setTargetPointer(new SecondTargetPointer())); this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(0, 4)); } @@ -45,39 +46,3 @@ public final class DeviousCoverUp extends CardImpl { return new DeviousCoverUp(this); } } - -class DeviousCoverUpEffect extends OneShotEffect { - - public DeviousCoverUpEffect() { - super(Outcome.Benefit); - this.staticText = "You may shuffle up to four target cards " - + "from your graveyard into your library."; - } - - public DeviousCoverUpEffect(final DeviousCoverUpEffect effect) { - super(effect); - } - - @Override - public DeviousCoverUpEffect copy() { - return new DeviousCoverUpEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller == null || !controller.chooseUse(outcome, "Shuffle the targeted cards into your library?", source, game)) { - return false; - } - Cards cards = new CardsImpl(); - for (UUID targetId : targetPointer.getTargets(game, source)) { - Card card = game.getCard(targetId); - if (card != null) { - cards.add(card); - } - } - controller.putCardsOnTopOfLibrary(cards, game, source, false); - controller.shuffleLibrary(source, game); - return true; - } -} diff --git a/Mage.Sets/src/mage/cards/p/PerpetualTimepiece.java b/Mage.Sets/src/mage/cards/p/PerpetualTimepiece.java index f1d47f4f3c..b7711a0e18 100644 --- a/Mage.Sets/src/mage/cards/p/PerpetualTimepiece.java +++ b/Mage.Sets/src/mage/cards/p/PerpetualTimepiece.java @@ -9,6 +9,7 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.MillCardsControllerEffect; +import mage.abilities.effects.common.ShuffleIntoLibraryTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.cards.CardsImpl; @@ -33,7 +34,7 @@ public final class PerpetualTimepiece extends CardImpl { this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new MillCardsControllerEffect(2), new TapSourceCost())); // {2}, Exile Perpetual Timepiece: Shuffle any number of target cards from your graveyard into your library. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PerpetualTimepieceShuffleEffect(), new GenericManaCost(2)); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ShuffleIntoLibraryTargetEffect(), new GenericManaCost(2)); ability.addCost(new ExileSourceCost()); ability.addTarget(new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, new FilterCard("cards to shuffle into your library"))); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/p/PipersMelody.java b/Mage.Sets/src/mage/cards/p/PipersMelody.java index 6e4101121d..3018ae1187 100644 --- a/Mage.Sets/src/mage/cards/p/PipersMelody.java +++ b/Mage.Sets/src/mage/cards/p/PipersMelody.java @@ -3,6 +3,7 @@ package mage.cards.p; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ShuffleIntoLibraryTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.cards.CardsImpl; @@ -24,7 +25,7 @@ public final class PipersMelody extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}"); // Shuffle any number of target creature cards from your graveyard into your library. - this.getSpellAbility().addEffect(new PipersMelodyShuffleEffect()); + this.getSpellAbility().addEffect(new ShuffleIntoLibraryTargetEffect()); this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_CREATURES_YOUR_GRAVEYARD)); } @@ -37,31 +38,3 @@ public final class PipersMelody extends CardImpl { return new PipersMelody(this); } } - -class PipersMelodyShuffleEffect extends OneShotEffect { - - PipersMelodyShuffleEffect() { - super(Outcome.Neutral); - this.staticText = "Shuffle any number of target creature cards from your graveyard into your library"; - } - - PipersMelodyShuffleEffect(final PipersMelodyShuffleEffect effect) { - super(effect); - } - - @Override - public PipersMelodyShuffleEffect copy() { - return new PipersMelodyShuffleEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - controller.moveCards(new CardsImpl(this.getTargetPointer().getTargets(game, source)), Zone.LIBRARY, source, game); - controller.shuffleLibrary(source, game); - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/p/PsychicSpiral.java b/Mage.Sets/src/mage/cards/p/PsychicSpiral.java index 39d76e8767..36a2ffaf2b 100644 --- a/Mage.Sets/src/mage/cards/p/PsychicSpiral.java +++ b/Mage.Sets/src/mage/cards/p/PsychicSpiral.java @@ -21,8 +21,8 @@ public final class PsychicSpiral extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{U}"); // Shuffle all cards from your graveyard into your library. Target player puts that many cards from the top of their library into their graveyard. - this.getSpellAbility().addTarget(new TargetPlayer()); this.getSpellAbility().addEffect(new PsychicSpiralEffect()); + this.getSpellAbility().addTarget(new TargetPlayer()); } private PsychicSpiral(final PsychicSpiral card) { diff --git a/Mage.Sets/src/mage/cards/r/RenewingTouch.java b/Mage.Sets/src/mage/cards/r/RenewingTouch.java index 058b1fa9d3..e7dfb56150 100644 --- a/Mage.Sets/src/mage/cards/r/RenewingTouch.java +++ b/Mage.Sets/src/mage/cards/r/RenewingTouch.java @@ -3,6 +3,7 @@ package mage.cards.r; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ShuffleIntoLibraryTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.cards.CardsImpl; @@ -24,7 +25,7 @@ public final class RenewingTouch extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}"); // Shuffle any number of target creature cards from your graveyard into your library. - this.getSpellAbility().addEffect(new RenewingTouchEffect()); + this.getSpellAbility().addEffect(new ShuffleIntoLibraryTargetEffect()); this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_CREATURES_YOUR_GRAVEYARD)); } @@ -37,31 +38,3 @@ public final class RenewingTouch extends CardImpl { return new RenewingTouch(this); } } - -class RenewingTouchEffect extends OneShotEffect { - - RenewingTouchEffect() { - super(Outcome.Neutral); - this.staticText = "Shuffle any number of target creature cards from your graveyard into your library"; - } - - RenewingTouchEffect(final RenewingTouchEffect effect) { - super(effect); - } - - @Override - public RenewingTouchEffect copy() { - return new RenewingTouchEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - controller.moveCards(new CardsImpl(this.getTargetPointer().getTargets(game, source)), Zone.LIBRARY, source, game); - controller.shuffleLibrary(source, game); - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/s/StreamOfThought.java b/Mage.Sets/src/mage/cards/s/StreamOfThought.java index 4a0f2cc2b6..79dc9257a0 100644 --- a/Mage.Sets/src/mage/cards/s/StreamOfThought.java +++ b/Mage.Sets/src/mage/cards/s/StreamOfThought.java @@ -3,6 +3,7 @@ package mage.cards.s; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; +import mage.abilities.effects.common.ShuffleIntoLibraryTargetEffect; import mage.abilities.keyword.ReplicateAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -15,6 +16,7 @@ import mage.players.Player; import mage.target.TargetCard; import mage.target.TargetPlayer; import mage.target.common.TargetCardInYourGraveyard; +import mage.target.targetpointer.SecondTargetPointer; import java.util.UUID; @@ -26,11 +28,14 @@ public final class StreamOfThought extends CardImpl { public StreamOfThought(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{U}"); - // Target player puts the top four cards of their library into their graveyard. You shuffle up to four cards from your graveyard into your library. + // Target player puts the top four cards of their library into their graveyard. this.getSpellAbility().addEffect(new PutLibraryIntoGraveTargetEffect(4)); - this.getSpellAbility().addEffect(new StreamOfThoughtEffect()); this.getSpellAbility().addTarget(new TargetPlayer()); + // You shuffle up to four cards from your graveyard into your library. + this.getSpellAbility().addEffect(new ShuffleIntoLibraryTargetEffect().setTargetPointer(new SecondTargetPointer())); + this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(0, 4)); + // Replicate {2}{U}{U} this.addAbility(new ReplicateAbility("{2}{U}{U}")); } @@ -44,37 +49,3 @@ public final class StreamOfThought extends CardImpl { return new StreamOfThought(this); } } - -class StreamOfThoughtEffect extends OneShotEffect { - - StreamOfThoughtEffect() { - super(Outcome.Benefit); - staticText = "You shuffle up to four cards from your graveyard into your library."; - } - - private StreamOfThoughtEffect(final StreamOfThoughtEffect effect) { - super(effect); - } - - @Override - public StreamOfThoughtEffect copy() { - return new StreamOfThoughtEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { - return false; - } - TargetCard target = new TargetCardInYourGraveyard(0, 4); - target.setNotTarget(true); - if (!player.choose(outcome, player.getGraveyard(), target, game)) { - return false; - } - Cards cards = new CardsImpl(target.getTargets()); - player.putCardsOnTopOfLibrary(cards, game, source, false); - player.shuffleLibrary(source, game); - return true; - } -} \ No newline at end of file