mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
Added ReturnToHandFromGraveyardAllEffect
This commit is contained in:
parent
c6f7d0c713
commit
d532699014
4 changed files with 92 additions and 10 deletions
|
@ -30,7 +30,7 @@ package mage.sets.gatecrash;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.abilities.effects.common.ReturnToHandAllEffect;
|
import mage.abilities.effects.common.ReturnToHandFromBattlefieldAllEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.common.FilterAttackingCreature;
|
import mage.filter.common.FilterAttackingCreature;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class AEtherize extends CardImpl<AEtherize> {
|
||||||
this.color.setBlue(true);
|
this.color.setBlue(true);
|
||||||
|
|
||||||
// Return all attacking creatures to their owners' hands.
|
// 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) {
|
public AEtherize(final AEtherize card) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ import mage.constants.Rarity;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
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.abilities.keyword.UnearthAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.common.FilterNonlandPermanent;
|
import mage.filter.common.FilterNonlandPermanent;
|
||||||
|
@ -60,7 +60,7 @@ public class KederektLeviathan extends CardImpl<KederektLeviathan> {
|
||||||
this.toughness = new MageInt(5);
|
this.toughness = new MageInt(5);
|
||||||
|
|
||||||
// When Kederekt Leviathan enters the battlefield, return all other nonland permanents to their owners' hands.
|
// 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}
|
// Unearth {6}{U}
|
||||||
this.addAbility(new UnearthAbility(new ManaCostsImpl("{6}{U}")));
|
this.addAbility(new UnearthAbility(new ManaCostsImpl("{6}{U}")));
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,17 +42,17 @@ import mage.game.permanent.Permanent;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
public class ReturnToHandAllEffect extends OneShotEffect<ReturnToHandAllEffect> {
|
public class ReturnToHandFromBattlefieldAllEffect extends OneShotEffect<ReturnToHandFromBattlefieldAllEffect> {
|
||||||
|
|
||||||
private FilterPermanent filter;
|
private FilterPermanent filter;
|
||||||
|
|
||||||
public ReturnToHandAllEffect(FilterPermanent filter) {
|
public ReturnToHandFromBattlefieldAllEffect(FilterPermanent filter) {
|
||||||
super(Outcome.ReturnToHand);
|
super(Outcome.ReturnToHand);
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
staticText = "Return all " + filter.getMessage() + " to their owners' hands";
|
staticText = "Return all " + filter.getMessage() + " to their owners' hands";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReturnToHandAllEffect(final ReturnToHandAllEffect effect) {
|
public ReturnToHandFromBattlefieldAllEffect(final ReturnToHandFromBattlefieldAllEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.filter = effect.filter;
|
this.filter = effect.filter;
|
||||||
}
|
}
|
||||||
|
@ -66,8 +66,7 @@ public class ReturnToHandAllEffect extends OneShotEffect<ReturnToHandAllEffect>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReturnToHandAllEffect copy() {
|
public ReturnToHandFromBattlefieldAllEffect copy() {
|
||||||
return new ReturnToHandAllEffect(this);
|
return new ReturnToHandFromBattlefieldAllEffect(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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<ReturnToHandFromGraveyardAllEffect> {
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue