* Phyrexian Scriptures - Fixed that wrongly also the card sfrom the controlling player were exiled.

This commit is contained in:
LevelX2 2018-04-21 22:47:29 +02:00
parent 92793327f3
commit 88b3efe759
3 changed files with 38 additions and 13 deletions

View file

@ -35,15 +35,16 @@ import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.effects.common.ExileGraveyardAllPlayersEffect;
import mage.abilities.effects.common.continuous.AddCardTypeTargetEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SagaChapter;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -83,7 +84,9 @@ public class PhyrexianScriptures extends CardImpl {
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_II, new DestroyAllEffect(filter));
// III Exile all cards from all opponents' graveyards.
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III, new ExileGraveyardAllPlayersEffect().setText("exile all cards from all opponents' graveyards"));
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III,
new ExileGraveyardAllPlayersEffect(StaticFilters.FILTER_CARD_CARDS, TargetController.OPPONENT)
.setText("exile all cards from all opponents' graveyards"));
this.addAbility(sagaAbility);
}

View file

@ -30,10 +30,13 @@ package mage.abilities.effects.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
@ -44,15 +47,29 @@ import mage.players.Player;
public class ExileGraveyardAllPlayersEffect extends OneShotEffect {
private final FilterCard filter;
private final TargetController targetController;
public ExileGraveyardAllPlayersEffect() {
this(new FilterCard("cards"));
this(StaticFilters.FILTER_CARD_CARDS);
}
public ExileGraveyardAllPlayersEffect(FilterCard filter) {
super(Outcome.Detriment);
staticText = "exile all " + filter.getMessage() + " from all graveyards";
this(filter, TargetController.ANY);
}
public ExileGraveyardAllPlayersEffect(FilterCard filter, TargetController targetController) {
super(Outcome.Exile);
this.filter = filter;
this.targetController = targetController;
staticText = "exile all " + filter.getMessage() + " from all "
+ (targetController.equals(TargetController.OPPONENT) ? "opponents' " : "")
+ "graveyards";
}
public ExileGraveyardAllPlayersEffect(final ExileGraveyardAllPlayersEffect effect) {
super(effect);
this.filter = effect.filter;
this.targetController = effect.targetController;
}
@Override
@ -66,18 +83,17 @@ public class ExileGraveyardAllPlayersEffect extends OneShotEffect {
if (controller == null) {
return false;
}
Cards toExile = new CardsImpl();
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
if (TargetController.OPPONENT.equals(targetController) && playerId.equals(source.getControllerId())) {
continue;
}
Player player = game.getPlayer(playerId);
if (player != null) {
for (UUID cid : player.getGraveyard().copy()) {
Card card = game.getCard(cid);
if (card != null && filter.match(card, game)) {
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true);
}
}
toExile.addAll(player.getGraveyard());
}
}
controller.moveCards(toExile, Zone.EXILED, source, game);
return true;
}
}

View file

@ -42,6 +42,12 @@ public final class StaticFilters {
FILTER_ENCHANTMENT_PERMANENT.setLockedFilter(true);
}
public static final FilterCard FILTER_CARD_CARDS = new FilterCard("cards");
static {
FILTER_CARD_CARDS.setLockedFilter(true);
}
public static final FilterArtifactCard FILTER_CARD_ARTIFACT = new FilterArtifactCard();
static {