spjspj - Reduce to Dreams was only returning the controller's enchantments/artifacts to hand. Should be all players in range having them returned to hand.

This commit is contained in:
spjspj 2016-02-06 02:20:58 +11:00
parent b7a0fa42fb
commit f5adc6591e

View file

@ -36,11 +36,14 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.other.OwnerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
@ -72,9 +75,9 @@ class ReduceToDreamsEffect extends OneShotEffect {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("artifacts and enchantments");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)
));
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)
));
}
public ReduceToDreamsEffect() {
@ -88,8 +91,15 @@ class ReduceToDreamsEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
creature.moveToZone(Zone.HAND, source.getSourceId(), game, true);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID playerId : controller.getInRange()) {
FilterPermanent playerFilter = filter.copy();
playerFilter.add(new OwnerIdPredicate(playerId));
for (Permanent permanent : game.getBattlefield().getActivePermanents(playerFilter, playerId, game)) {
permanent.moveToZone(Zone.HAND, playerId, game, true);
}
}
}
return true;
}