From 8fb03574e60ec7e6c909bc09f20dcc7fedc0da2a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 24 May 2018 11:55:00 -0400 Subject: [PATCH] Implemented Game Plan, added new class for Timetwister effects --- Mage.Sets/src/mage/cards/c/CommitMemory.java | 35 +--------- Mage.Sets/src/mage/cards/d/DaysUndoing.java | 44 +----------- Mage.Sets/src/mage/cards/g/GamePlan.java | 68 +++++++++++++++++++ .../mage/cards/j/JaceTheLivingGuildpact.java | 55 ++------------- Mage.Sets/src/mage/cards/m/MineMineMine.java | 43 ++---------- .../src/mage/cards/t/TemporalCascade.java | 53 +++------------ Mage.Sets/src/mage/cards/t/TimeReversal.java | 43 +----------- Mage.Sets/src/mage/cards/t/Timetwister.java | 42 +----------- Mage.Sets/src/mage/sets/Battlebond.java | 1 + .../common/ShuffleHandGraveyardAllEffect.java | 45 ++++++++++++ 10 files changed, 145 insertions(+), 284 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/g/GamePlan.java create mode 100644 Mage/src/main/java/mage/abilities/effects/common/ShuffleHandGraveyardAllEffect.java diff --git a/Mage.Sets/src/mage/cards/c/CommitMemory.java b/Mage.Sets/src/mage/cards/c/CommitMemory.java index 88a3bfed1dc..756f2dacc5d 100644 --- a/Mage.Sets/src/mage/cards/c/CommitMemory.java +++ b/Mage.Sets/src/mage/cards/c/CommitMemory.java @@ -32,6 +32,7 @@ import mage.abilities.Ability; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DrawCardAllEffect; +import mage.abilities.effects.common.ShuffleHandGraveyardAllEffect; import mage.abilities.keyword.AftermathAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -39,7 +40,6 @@ import mage.cards.SplitCard; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SpellAbilityType; -import mage.constants.Zone; import mage.filter.common.FilterNonlandPermanent; import mage.filter.common.FilterSpellOrPermanent; import mage.game.Game; @@ -72,7 +72,7 @@ public class CommitMemory extends SplitCard { // Aftermath // Each player shuffles their hand and graveyard into their library, then draws seven cards. ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); - getRightHalfCard().getSpellAbility().addEffect(new MemoryEffect()); + getRightHalfCard().getSpellAbility().addEffect(new ShuffleHandGraveyardAllEffect()); Effect effect = new DrawCardAllEffect(7); effect.setText(", then draws seven cards"); getRightHalfCard().getSpellAbility().addEffect(effect); @@ -120,34 +120,3 @@ class CommitEffect extends OneShotEffect { return false; } } - -class MemoryEffect extends OneShotEffect { - - public MemoryEffect() { - super(Outcome.Neutral); - staticText = "Each player shuffles their hand and graveyard into their library"; - } - - public MemoryEffect(final MemoryEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { - Player player = game.getPlayer(playerId); - if (player != null) { - player.moveCards(player.getHand(), Zone.LIBRARY, source, game); - player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game); - player.shuffleLibrary(source, game); - } - } - return true; - } - - @Override - public MemoryEffect copy() { - return new MemoryEffect(this); - } - -} diff --git a/Mage.Sets/src/mage/cards/d/DaysUndoing.java b/Mage.Sets/src/mage/cards/d/DaysUndoing.java index b43324d2972..380c7a8a725 100644 --- a/Mage.Sets/src/mage/cards/d/DaysUndoing.java +++ b/Mage.Sets/src/mage/cards/d/DaysUndoing.java @@ -28,20 +28,15 @@ package mage.cards.d; import java.util.UUID; -import mage.abilities.Ability; import mage.abilities.condition.common.MyTurnCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DrawCardAllEffect; import mage.abilities.effects.common.EndTurnEffect; +import mage.abilities.effects.common.ShuffleHandGraveyardAllEffect; 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; /** * @@ -50,10 +45,10 @@ import mage.players.Player; public class DaysUndoing extends CardImpl { public DaysUndoing(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}"); // Each player shuffles their hand and graveyard into their library, then draws seven cards. If it's your turn, end the turn. - this.getSpellAbility().addEffect(new DaysUndoingEffect()); + this.getSpellAbility().addEffect(new ShuffleHandGraveyardAllEffect()); Effect effect = new DrawCardAllEffect(7); effect.setText(", then draws seven cards"); this.getSpellAbility().addEffect(effect); @@ -69,36 +64,3 @@ public class DaysUndoing extends CardImpl { return new DaysUndoing(this); } } - -class DaysUndoingEffect extends OneShotEffect { - - public DaysUndoingEffect() { - super(Outcome.Neutral); - staticText = "Each player shuffles their hand and graveyard into their library"; - } - - public DaysUndoingEffect(final DaysUndoingEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { - Player player = game.getPlayer(playerId); - if (player != null) { - player.moveCards(player.getHand(), Zone.LIBRARY, source, game); - player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game); - player.shuffleLibrary(source, game); - - } - } - return true; - } - - @Override - public DaysUndoingEffect copy() { - return new DaysUndoingEffect(this); - } - -} diff --git a/Mage.Sets/src/mage/cards/g/GamePlan.java b/Mage.Sets/src/mage/cards/g/GamePlan.java new file mode 100644 index 00000000000..e7932168a84 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GamePlan.java @@ -0,0 +1,68 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.g; + +import java.util.UUID; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DrawCardAllEffect; +import mage.abilities.effects.common.ExileSpellEffect; +import mage.abilities.effects.common.ShuffleHandGraveyardAllEffect; +import mage.abilities.keyword.AssistAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; + +/** + * + * @author TheElk801 + */ +public class GamePlan extends CardImpl { + + public GamePlan(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{U}"); + + // Assist + this.addAbility(new AssistAbility()); + + // Each player shuffles their hand and graveyard into their library, then draws seven cards. Exile Game Plan. + this.getSpellAbility().addEffect(new ShuffleHandGraveyardAllEffect()); + Effect effect = new DrawCardAllEffect(7); + effect.setText(", then draws seven cards"); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addEffect(ExileSpellEffect.getInstance()); + } + + public GamePlan(final GamePlan card) { + super(card); + } + + @Override + public GamePlan copy() { + return new GamePlan(this); + } +} diff --git a/Mage.Sets/src/mage/cards/j/JaceTheLivingGuildpact.java b/Mage.Sets/src/mage/cards/j/JaceTheLivingGuildpact.java index 03a62fd8bf9..07bbedf7b0c 100644 --- a/Mage.Sets/src/mage/cards/j/JaceTheLivingGuildpact.java +++ b/Mage.Sets/src/mage/cards/j/JaceTheLivingGuildpact.java @@ -28,28 +28,24 @@ package mage.cards.j; import java.util.UUID; -import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect; -import mage.cards.Card; +import mage.abilities.effects.common.ShuffleHandGraveyardAllEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Outcome; import mage.constants.SuperType; import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.FilterPermanent; import mage.filter.common.FilterNonlandPermanent; import mage.filter.predicate.permanent.AnotherPredicate; -import mage.game.Game; -import mage.players.Player; import mage.target.TargetPermanent; /** @@ -65,7 +61,7 @@ public class JaceTheLivingGuildpact extends CardImpl { } public JaceTheLivingGuildpact(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{U}{U}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.JACE); @@ -83,7 +79,8 @@ public class JaceTheLivingGuildpact extends CardImpl { this.addAbility(ability); // -8: Each player shuffles their hand and graveyard into their library. You draw seven cards. - this.addAbility(new LoyaltyAbility(new JaceTheLivingGuildpactEffect(), -8)); + ability = new LoyaltyAbility(new ShuffleHandGraveyardAllEffect(), -8); + ability.addEffect(new DrawCardSourceControllerEffect(7).setText("You draw seven cards")); } @@ -96,45 +93,3 @@ public class JaceTheLivingGuildpact extends CardImpl { return new JaceTheLivingGuildpact(this); } } - -class JaceTheLivingGuildpactEffect extends OneShotEffect { - - public JaceTheLivingGuildpactEffect() { - super(Outcome.Neutral); - staticText = "Each player shuffles their hand and graveyard into their library. You draw seven cards"; - } - - public JaceTheLivingGuildpactEffect(final JaceTheLivingGuildpactEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { - Player player = game.getPlayer(playerId); - if (player != null) { - for (Card card : player.getHand().getCards(game)) { - card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true); - } - for (Card card : player.getGraveyard().getCards(game)) { - card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true); - } - player.shuffleLibrary(source, game); - } - } - controller.drawCards(7, game); - return true; - - } - return false; - - } - - @Override - public JaceTheLivingGuildpactEffect copy() { - return new JaceTheLivingGuildpactEffect(this); - } - -} diff --git a/Mage.Sets/src/mage/cards/m/MineMineMine.java b/Mage.Sets/src/mage/cards/m/MineMineMine.java index e5b7648e21b..c364c2989d6 100644 --- a/Mage.Sets/src/mage/cards/m/MineMineMine.java +++ b/Mage.Sets/src/mage/cards/m/MineMineMine.java @@ -34,6 +34,7 @@ import mage.abilities.common.LeavesBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.ShuffleHandGraveyardAllEffect; import mage.abilities.effects.common.continuous.CantCastMoreThanOneSpellEffect; import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect; import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect.HandSizeModification; @@ -56,22 +57,22 @@ import mage.players.Player; public class MineMineMine extends CardImpl { public MineMineMine(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{G}{G}"); // When Mine, Mine, Mine enters the battlefield, each player puts his or her library into his or her hand. this.addAbility(new EntersBattlefieldTriggeredAbility(new MineMineMineDrawEffect())); // Players have no maximum hand size and don't lose the game for drawing from an empty library. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MaximumHandSizeControllerEffect(Integer.MAX_VALUE, Duration.WhileOnBattlefield, HandSizeModification.SET, TargetController.ANY) - .setText("Players have no maximum hand size and don't lose the game for drawing from an empty library"))); + .setText("Players have no maximum hand size and don't lose the game for drawing from an empty library"))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MineMineMineDontLoseEffect())); // Each player can't cast more than one spell each turn. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantCastMoreThanOneSpellEffect(TargetController.ANY))); - + // When Mine, Mine, Mine leaves the battlefield, each player shuffles his or her hand and graveyard into his or her library. - this.addAbility(new LeavesBattlefieldTriggeredAbility(new MineMineMineShuffleEffect(), false)); + this.addAbility(new LeavesBattlefieldTriggeredAbility(new ShuffleHandGraveyardAllEffect(), false)); } public MineMineMine(final MineMineMine card) { @@ -133,7 +134,7 @@ class MineMineMineDontLoseEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { return true; } - + @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.DRAW_CARD; @@ -148,33 +149,3 @@ class MineMineMineDontLoseEffect extends ReplacementEffectImpl { return false; } } - -class MineMineMineShuffleEffect extends OneShotEffect { - - public MineMineMineShuffleEffect() { - super(Outcome.Neutral); - staticText = "each player shuffles his or her hand and graveyard into his or her library"; - } - - public MineMineMineShuffleEffect(final MineMineMineShuffleEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { - Player player = game.getPlayer(playerId); - if (player != null) { - player.moveCards(player.getHand(), Zone.LIBRARY, source, game); - player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game); - player.shuffleLibrary(source, game); - } - } - return true; - } - - @Override - public MineMineMineShuffleEffect copy() { - return new MineMineMineShuffleEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/t/TemporalCascade.java b/Mage.Sets/src/mage/cards/t/TemporalCascade.java index e85e24176c5..13f55fde6e7 100644 --- a/Mage.Sets/src/mage/cards/t/TemporalCascade.java +++ b/Mage.Sets/src/mage/cards/t/TemporalCascade.java @@ -31,13 +31,12 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ShuffleHandGraveyardAllEffect; import mage.abilities.keyword.EntwineAbility; -import mage.cards.Card; 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; @@ -48,16 +47,16 @@ import mage.players.Player; public class TemporalCascade extends CardImpl { public TemporalCascade(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{5}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{U}{U}"); // Choose one - Each player shuffles their hand and graveyard into their library; - this.getSpellAbility().addEffect(new TemporalCascadeShuffleEffect()); - + this.getSpellAbility().addEffect(new ShuffleHandGraveyardAllEffect()); + // or each player draws seven cards. Mode mode = new Mode(); mode.getEffects().add(new TemporalCascadeDrawEffect()); this.getSpellAbility().getModes().addMode(mode); - + // Entwine {2} this.addAbility(new EntwineAbility("{2}")); } @@ -72,42 +71,6 @@ public class TemporalCascade extends CardImpl { } } -class TemporalCascadeShuffleEffect extends OneShotEffect { - - public TemporalCascadeShuffleEffect() { - super(Outcome.Neutral); - staticText = "Each player shuffles their hand and graveyard into their library"; - } - - public TemporalCascadeShuffleEffect(final TemporalCascadeShuffleEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player sourcePlayer = game.getPlayer(source.getControllerId()); - for (UUID playerId: game.getState().getPlayersInRange(sourcePlayer.getId(), game)) { - Player player = game.getPlayer(playerId); - if (player != null) { - for (Card card: player.getHand().getCards(game)) { - card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true); - } - for (Card card: player.getGraveyard().getCards(game)) { - card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true); - } - player.shuffleLibrary(source, game); - - } - } - return true; - } - - @Override - public TemporalCascadeShuffleEffect copy() { - return new TemporalCascadeShuffleEffect(this); - } -} - class TemporalCascadeDrawEffect extends OneShotEffect { public TemporalCascadeDrawEffect() { @@ -123,11 +86,11 @@ class TemporalCascadeDrawEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player sourcePlayer = game.getPlayer(source.getControllerId()); game.getState().handleSimultaneousEvent(game); // needed here so state based triggered effects - for (UUID playerId: game.getState().getPlayersInRange(sourcePlayer.getId(), game)) { + for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { player.drawCards(7, game); - } + } } return true; } @@ -136,4 +99,4 @@ class TemporalCascadeDrawEffect extends OneShotEffect { public TemporalCascadeDrawEffect copy() { return new TemporalCascadeDrawEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/t/TimeReversal.java b/Mage.Sets/src/mage/cards/t/TimeReversal.java index 50c7b8dda62..8890323d35b 100644 --- a/Mage.Sets/src/mage/cards/t/TimeReversal.java +++ b/Mage.Sets/src/mage/cards/t/TimeReversal.java @@ -28,18 +28,13 @@ package mage.cards.t; import java.util.UUID; -import mage.abilities.Ability; import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DrawCardAllEffect; import mage.abilities.effects.common.ExileSpellEffect; +import mage.abilities.effects.common.ShuffleHandGraveyardAllEffect; 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; /** * @@ -48,10 +43,10 @@ import mage.players.Player; public class TimeReversal extends CardImpl { public TimeReversal(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{U}{U}"); // Each player shuffles their hand and graveyard into their library, then draws seven cards - this.getSpellAbility().addEffect(new TimeReversalEffect()); + this.getSpellAbility().addEffect(new ShuffleHandGraveyardAllEffect()); Effect effect = new DrawCardAllEffect(7); effect.setText(", then draws seven cards"); this.getSpellAbility().addEffect(effect); @@ -67,35 +62,3 @@ public class TimeReversal extends CardImpl { return new TimeReversal(this); } } - -class TimeReversalEffect extends OneShotEffect { - - public TimeReversalEffect() { - super(Outcome.Neutral); - staticText = "Each player shuffles their hand and graveyard into their library, then draws seven cards"; - } - - public TimeReversalEffect(final TimeReversalEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { - Player player = game.getPlayer(playerId); - if (player != null) { - player.moveCards(player.getHand(), Zone.LIBRARY, source, game); - player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game); - player.shuffleLibrary(source, game); - } - } - return true; - } - - @Override - public TimeReversalEffect copy() { - return new TimeReversalEffect(this); - } - -} diff --git a/Mage.Sets/src/mage/cards/t/Timetwister.java b/Mage.Sets/src/mage/cards/t/Timetwister.java index 7f5243640ad..e7cee27584c 100644 --- a/Mage.Sets/src/mage/cards/t/Timetwister.java +++ b/Mage.Sets/src/mage/cards/t/Timetwister.java @@ -28,17 +28,12 @@ package mage.cards.t; import java.util.UUID; -import mage.abilities.Ability; import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DrawCardAllEffect; +import mage.abilities.effects.common.ShuffleHandGraveyardAllEffect; 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; /** * @@ -47,10 +42,10 @@ import mage.players.Player; public class Timetwister extends CardImpl { public Timetwister(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}"); // Each player shuffles their hand and graveyard into their library, then draws seven cards. - this.getSpellAbility().addEffect(new TimetwisterEffect()); + this.getSpellAbility().addEffect(new ShuffleHandGraveyardAllEffect()); Effect effect = new DrawCardAllEffect(7); effect.setText(", then draws seven cards"); this.getSpellAbility().addEffect(effect); @@ -66,34 +61,3 @@ public class Timetwister extends CardImpl { return new Timetwister(this); } } - -class TimetwisterEffect extends OneShotEffect { - - public TimetwisterEffect() { - super(Outcome.Neutral); - staticText = "Each player shuffles their hand and graveyard into their library"; - } - - public TimetwisterEffect(final TimetwisterEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { - Player player = game.getPlayer(playerId); - if (player != null) { - player.moveCards(player.getHand(), Zone.LIBRARY, source, game); - player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game); - player.shuffleLibrary(source, game); - } - } - return true; - } - - @Override - public TimetwisterEffect copy() { - return new TimetwisterEffect(this); - } - -} diff --git a/Mage.Sets/src/mage/sets/Battlebond.java b/Mage.Sets/src/mage/sets/Battlebond.java index b2919be68fb..826413e1f50 100644 --- a/Mage.Sets/src/mage/sets/Battlebond.java +++ b/Mage.Sets/src/mage/sets/Battlebond.java @@ -80,6 +80,7 @@ public class Battlebond extends ExpansionSet { cards.add(new SetCardInfo("Fan Favorite", 46, Rarity.COMMON, mage.cards.f.FanFavorite.class)); cards.add(new SetCardInfo("Fertile Ground", 198, Rarity.COMMON, mage.cards.f.FertileGround.class)); cards.add(new SetCardInfo("Forest", 254, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Game Plan", 35, Rarity.RARE, mage.cards.g.GamePlan.class)); cards.add(new SetCardInfo("Generous Patron", 70, Rarity.RARE, mage.cards.g.GenerousPatron.class)); cards.add(new SetCardInfo("Greater Good", 201, Rarity.RARE, mage.cards.g.GreaterGood.class)); cards.add(new SetCardInfo("Impetuous Protege", 19, Rarity.UNCOMMON, mage.cards.i.ImpetuousProtege.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ShuffleHandGraveyardAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ShuffleHandGraveyardAllEffect.java new file mode 100644 index 00000000000..e764cc92166 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/ShuffleHandGraveyardAllEffect.java @@ -0,0 +1,45 @@ +package mage.abilities.effects.common; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class ShuffleHandGraveyardAllEffect extends OneShotEffect { + + public ShuffleHandGraveyardAllEffect() { + super(Outcome.Neutral); + staticText = "each player shuffles their hand and graveyard into their library"; + } + + public ShuffleHandGraveyardAllEffect(final ShuffleHandGraveyardAllEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player != null) { + player.moveCards(player.getHand(), Zone.LIBRARY, source, game); + player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game); + player.shuffleLibrary(source, game); + } + } + return true; + } + + @Override + public ShuffleHandGraveyardAllEffect copy() { + return new ShuffleHandGraveyardAllEffect(this); + } + +}