Added test.

This commit is contained in:
LevelX2 2015-10-12 23:50:29 +02:00
parent 523ce158bd
commit 00f48b005d
2 changed files with 95 additions and 9 deletions

View file

@ -27,20 +27,23 @@
*/
package mage.sets.avacynrestored;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.MiracleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterNonlandPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
@ -52,7 +55,6 @@ public class DevastationTide extends CardImpl {
super(ownerId, 48, "Devastation Tide", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{U}{U}");
this.expansionSetCode = "AVR";
// Return all nonland permanents to their owners' hands.
this.getSpellAbility().addEffect(new DevastationTideEffect());
@ -83,10 +85,17 @@ class DevastationTideEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterNonlandPermanent(), source.getControllerId(), source.getSourceId(), game)) {
creature.moveToZone(Zone.HAND, source.getSourceId(), game, true);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Set<Card> cardsToHand = new LinkedHashSet<>();
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterNonlandPermanent(), source.getControllerId(), source.getSourceId(), game)) {
cardsToHand.add((Card) permanent);
}
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
return true;
}
return true;
return false;
}
@Override