mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
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:
parent
b7a0fa42fb
commit
f5adc6591e
1 changed files with 16 additions and 6 deletions
|
@ -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,11 +75,11 @@ 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() {
|
||||
super(Outcome.ReturnToHand);
|
||||
staticText = "Return all artifacts and enchantments to their owners' hands";
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue