diff --git a/Mage.Sets/src/mage/sets/gatecrash/AEtherize.java b/Mage.Sets/src/mage/sets/gatecrash/AEtherize.java index 53d54726f9..97e5a2de64 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/AEtherize.java +++ b/Mage.Sets/src/mage/sets/gatecrash/AEtherize.java @@ -30,7 +30,7 @@ package mage.sets.gatecrash; import java.util.UUID; import mage.constants.CardType; import mage.constants.Rarity; -import mage.abilities.effects.common.ReturnToHandAllEffect; +import mage.abilities.effects.common.ReturnToHandFromBattlefieldAllEffect; import mage.cards.CardImpl; import mage.filter.common.FilterAttackingCreature; @@ -47,7 +47,7 @@ public class AEtherize extends CardImpl { this.color.setBlue(true); // Return all attacking creatures to their owners' hands. - this.getSpellAbility().addEffect(new ReturnToHandAllEffect(new FilterAttackingCreature("attacking creatures"))); + this.getSpellAbility().addEffect(new ReturnToHandFromBattlefieldAllEffect(new FilterAttackingCreature("attacking creatures"))); } public AEtherize(final AEtherize card) { diff --git a/Mage.Sets/src/mage/sets/shardsofalara/KederektLeviathan.java b/Mage.Sets/src/mage/sets/shardsofalara/KederektLeviathan.java index 2ec7ddec83..6178c9fc67 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/KederektLeviathan.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/KederektLeviathan.java @@ -33,7 +33,7 @@ import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.ReturnToHandAllEffect; +import mage.abilities.effects.common.ReturnToHandFromBattlefieldAllEffect; import mage.abilities.keyword.UnearthAbility; import mage.cards.CardImpl; import mage.filter.common.FilterNonlandPermanent; @@ -60,7 +60,7 @@ public class KederektLeviathan extends CardImpl { this.toughness = new MageInt(5); // When Kederekt Leviathan enters the battlefield, return all other nonland permanents to their owners' hands. - this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandAllEffect(filter))); + this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandFromBattlefieldAllEffect(filter))); // Unearth {6}{U} this.addAbility(new UnearthAbility(new ManaCostsImpl("{6}{U}"))); } diff --git a/Mage/src/mage/abilities/effects/common/ReturnToHandAllEffect.java b/Mage/src/mage/abilities/effects/common/ReturnToHandFromBattlefieldAllEffect.java similarity index 84% rename from Mage/src/mage/abilities/effects/common/ReturnToHandAllEffect.java rename to Mage/src/mage/abilities/effects/common/ReturnToHandFromBattlefieldAllEffect.java index d437dc4f41..0a5a9a82e2 100644 --- a/Mage/src/mage/abilities/effects/common/ReturnToHandAllEffect.java +++ b/Mage/src/mage/abilities/effects/common/ReturnToHandFromBattlefieldAllEffect.java @@ -42,17 +42,17 @@ import mage.game.permanent.Permanent; */ -public class ReturnToHandAllEffect extends OneShotEffect { +public class ReturnToHandFromBattlefieldAllEffect extends OneShotEffect { private FilterPermanent filter; - public ReturnToHandAllEffect(FilterPermanent filter) { + public ReturnToHandFromBattlefieldAllEffect(FilterPermanent filter) { super(Outcome.ReturnToHand); this.filter = filter; staticText = "Return all " + filter.getMessage() + " to their owners' hands"; } - public ReturnToHandAllEffect(final ReturnToHandAllEffect effect) { + public ReturnToHandFromBattlefieldAllEffect(final ReturnToHandFromBattlefieldAllEffect effect) { super(effect); this.filter = effect.filter; } @@ -66,8 +66,7 @@ public class ReturnToHandAllEffect extends OneShotEffect } @Override - public ReturnToHandAllEffect copy() { - return new ReturnToHandAllEffect(this); + public ReturnToHandFromBattlefieldAllEffect copy() { + return new ReturnToHandFromBattlefieldAllEffect(this); } } - diff --git a/Mage/src/mage/abilities/effects/common/ReturnToHandFromGraveyardAllEffect.java b/Mage/src/mage/abilities/effects/common/ReturnToHandFromGraveyardAllEffect.java new file mode 100644 index 0000000000..c9e2691321 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/ReturnToHandFromGraveyardAllEffect.java @@ -0,0 +1,83 @@ +/* + * 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.abilities.effects.common; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ + +public class ReturnToHandFromGraveyardAllEffect extends OneShotEffect { + + private FilterCard filter; + + public ReturnToHandFromGraveyardAllEffect(FilterCard filter) { + super(Outcome.ReturnToHand); + this.filter = filter; + staticText = "Each player returns all " + filter.getMessage() + " from his or her graveyard to his or her hand"; + } + + public ReturnToHandFromGraveyardAllEffect(final ReturnToHandFromGraveyardAllEffect effect) { + super(effect); + this.filter = effect.filter; + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + for (UUID playerId : controller.getInRange()) { + Player player = game.getPlayer(playerId); + if (player != null) { + for (Card card :player.getGraveyard().getCards(filter, game)) { + card.moveToZone(Zone.HAND, playerId, game, false); + } + } + + } + return true; + } + return false; + } + + @Override + public ReturnToHandFromGraveyardAllEffect copy() { + return new ReturnToHandFromGraveyardAllEffect(this); + } +}