From 88b3efe7597687ae7386c8bf2e68b598c721ae5d Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 21 Apr 2018 22:47:29 +0200 Subject: [PATCH] * Phyrexian Scriptures - Fixed that wrongly also the card sfrom the controlling player were exiled. --- .../src/mage/cards/p/PhyrexianScriptures.java | 7 +++- .../ExileGraveyardAllPlayersEffect.java | 38 +++++++++++++------ .../main/java/mage/filter/StaticFilters.java | 6 +++ 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianScriptures.java b/Mage.Sets/src/mage/cards/p/PhyrexianScriptures.java index 815d5ec30b..3a68927cd9 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianScriptures.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianScriptures.java @@ -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); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileGraveyardAllPlayersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileGraveyardAllPlayersEffect.java index cc909ce53f..be28efaa8c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileGraveyardAllPlayersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileGraveyardAllPlayersEffect.java @@ -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; } } diff --git a/Mage/src/main/java/mage/filter/StaticFilters.java b/Mage/src/main/java/mage/filter/StaticFilters.java index f19c56ffea..5d6d929911 100644 --- a/Mage/src/main/java/mage/filter/StaticFilters.java +++ b/Mage/src/main/java/mage/filter/StaticFilters.java @@ -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 {