From 2a9af5ad9906e4f6fa227b28ec11b3f18f5e4c31 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 24 Mar 2015 15:45:33 +0100 Subject: [PATCH] Moved some postresolveEffects to the correct package. --- .../sets/championsofkamigawa/HanabiBlast.java | 2 +- .../src/mage/sets/commander/SpellCrumple.java | 2 +- .../mage/sets/fifthdawn/BeaconOfCreation.java | 2 +- .../mage/sets/fifthdawn/BeaconOfTomorrows.java | 2 +- .../sets/mirrodinbesieged/BlackSunsZenith.java | 2 +- .../sets/mirrodinbesieged/BlueSunsZenith.java | 2 +- .../sets/mirrodinbesieged/GreenSunsZenith.java | 2 +- .../sets/mirrodinbesieged/RedSunsZenith.java | 2 +- .../sets/mirrodinbesieged/WhiteSunsZenith.java | 2 +- .../src/mage/sets/planechase/BeaconOfUnrest.java | 2 +- .../src/mage/sets/tenth/BeaconOfDestruction.java | 2 +- .../src/mage/sets/tenth/BeaconOfImmortality.java | 2 +- Mage/src/mage/abilities/AbilityImpl.java | 16 ++++++++++------ .../effects/postresolve/ExileSpellEffect.java | 7 ++++++- .../ReturnToHandSpellEffect.java | 2 +- .../ReturnToLibrarySpellEffect.java | 2 +- .../ShuffleSpellEffect.java | 2 +- 17 files changed, 31 insertions(+), 22 deletions(-) rename Mage/src/mage/abilities/effects/{common => postresolve}/ReturnToHandSpellEffect.java (93%) rename Mage/src/mage/abilities/effects/{common => postresolve}/ReturnToLibrarySpellEffect.java (96%) rename Mage/src/mage/abilities/effects/{common => postresolve}/ShuffleSpellEffect.java (98%) diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/HanabiBlast.java b/Mage.Sets/src/mage/sets/championsofkamigawa/HanabiBlast.java index ccb65b8921..bfa4c9c19f 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/HanabiBlast.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/HanabiBlast.java @@ -34,7 +34,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.discard.DiscardControllerEffect; -import mage.abilities.effects.common.ReturnToHandSpellEffect; +import mage.abilities.effects.postresolve.ReturnToHandSpellEffect; import mage.cards.CardImpl; import mage.target.common.TargetCreatureOrPlayer; diff --git a/Mage.Sets/src/mage/sets/commander/SpellCrumple.java b/Mage.Sets/src/mage/sets/commander/SpellCrumple.java index 8672d70ff5..217e5d55af 100644 --- a/Mage.Sets/src/mage/sets/commander/SpellCrumple.java +++ b/Mage.Sets/src/mage/sets/commander/SpellCrumple.java @@ -32,7 +32,7 @@ import mage.MageObject; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.ReplacementEffectImpl; -import mage.abilities.effects.common.ReturnToLibrarySpellEffect; +import mage.abilities.effects.postresolve.ReturnToLibrarySpellEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; diff --git a/Mage.Sets/src/mage/sets/fifthdawn/BeaconOfCreation.java b/Mage.Sets/src/mage/sets/fifthdawn/BeaconOfCreation.java index d6e89dab96..b7a8157a47 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/BeaconOfCreation.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/BeaconOfCreation.java @@ -32,7 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.effects.common.CreateTokenEffect; -import mage.abilities.effects.common.ShuffleSpellEffect; +import mage.abilities.effects.postresolve.ShuffleSpellEffect; import mage.cards.CardImpl; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; diff --git a/Mage.Sets/src/mage/sets/fifthdawn/BeaconOfTomorrows.java b/Mage.Sets/src/mage/sets/fifthdawn/BeaconOfTomorrows.java index fd482505c6..51665daff1 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/BeaconOfTomorrows.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/BeaconOfTomorrows.java @@ -33,7 +33,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.ShuffleSpellEffect; +import mage.abilities.effects.postresolve.ShuffleSpellEffect; import mage.cards.CardImpl; import mage.game.Game; import mage.game.turn.TurnMod; diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/BlackSunsZenith.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/BlackSunsZenith.java index e769a14e6a..676e3b6244 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/BlackSunsZenith.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/BlackSunsZenith.java @@ -34,7 +34,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.ShuffleSpellEffect; +import mage.abilities.effects.postresolve.ShuffleSpellEffect; import mage.cards.CardImpl; import mage.constants.Outcome; import mage.counters.CounterType; diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/BlueSunsZenith.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/BlueSunsZenith.java index 55905c84ba..825f730312 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/BlueSunsZenith.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/BlueSunsZenith.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.effects.common.DrawCardTargetEffect; -import mage.abilities.effects.common.ShuffleSpellEffect; +import mage.abilities.effects.postresolve.ShuffleSpellEffect; import mage.cards.CardImpl; import mage.target.TargetPlayer; diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/GreenSunsZenith.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/GreenSunsZenith.java index 204b91ab18..49cd364142 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/GreenSunsZenith.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/GreenSunsZenith.java @@ -33,7 +33,7 @@ import mage.constants.Rarity; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.ShuffleSpellEffect; +import mage.abilities.effects.postresolve.ShuffleSpellEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.Outcome; diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/RedSunsZenith.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/RedSunsZenith.java index 8902296827..8ff63fb341 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/RedSunsZenith.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/RedSunsZenith.java @@ -30,7 +30,7 @@ package mage.sets.mirrodinbesieged; import java.util.UUID; import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.effects.common.DamageTargetEffect; -import mage.abilities.effects.common.ShuffleSpellEffect; +import mage.abilities.effects.postresolve.ShuffleSpellEffect; import mage.abilities.effects.common.replacement.DealtDamageToCreatureBySourceDies; import mage.cards.CardImpl; import mage.constants.CardType; diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/WhiteSunsZenith.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/WhiteSunsZenith.java index 2f399da809..a9a2693022 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/WhiteSunsZenith.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/WhiteSunsZenith.java @@ -33,7 +33,7 @@ import mage.MageInt; import mage.ObjectColor; import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.effects.common.CreateTokenEffect; -import mage.abilities.effects.common.ShuffleSpellEffect; +import mage.abilities.effects.postresolve.ShuffleSpellEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; diff --git a/Mage.Sets/src/mage/sets/planechase/BeaconOfUnrest.java b/Mage.Sets/src/mage/sets/planechase/BeaconOfUnrest.java index 685bdda8f9..698e74d9a9 100644 --- a/Mage.Sets/src/mage/sets/planechase/BeaconOfUnrest.java +++ b/Mage.Sets/src/mage/sets/planechase/BeaconOfUnrest.java @@ -29,7 +29,7 @@ package mage.sets.planechase; import java.util.UUID; import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; -import mage.abilities.effects.common.ShuffleSpellEffect; +import mage.abilities.effects.postresolve.ShuffleSpellEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; diff --git a/Mage.Sets/src/mage/sets/tenth/BeaconOfDestruction.java b/Mage.Sets/src/mage/sets/tenth/BeaconOfDestruction.java index 16a41b2417..d26a59d9f0 100644 --- a/Mage.Sets/src/mage/sets/tenth/BeaconOfDestruction.java +++ b/Mage.Sets/src/mage/sets/tenth/BeaconOfDestruction.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.effects.common.DamageTargetEffect; -import mage.abilities.effects.common.ShuffleSpellEffect; +import mage.abilities.effects.postresolve.ShuffleSpellEffect; import mage.cards.CardImpl; import mage.target.common.TargetCreatureOrPlayer; diff --git a/Mage.Sets/src/mage/sets/tenth/BeaconOfImmortality.java b/Mage.Sets/src/mage/sets/tenth/BeaconOfImmortality.java index a0a46a020e..f1a33b8c13 100644 --- a/Mage.Sets/src/mage/sets/tenth/BeaconOfImmortality.java +++ b/Mage.Sets/src/mage/sets/tenth/BeaconOfImmortality.java @@ -33,7 +33,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.ShuffleSpellEffect; +import mage.abilities.effects.postresolve.ShuffleSpellEffect; import mage.cards.CardImpl; import mage.game.Game; import mage.players.Player; diff --git a/Mage/src/mage/abilities/AbilityImpl.java b/Mage/src/mage/abilities/AbilityImpl.java index 46f3d00439..d212d8c170 100644 --- a/Mage/src/mage/abilities/AbilityImpl.java +++ b/Mage/src/mage/abilities/AbilityImpl.java @@ -663,16 +663,18 @@ public abstract class AbilityImpl implements Ability { @Override public List getWatchers() { - if (watchers != null) + if (watchers != null) { return watchers; - else + } else { return emptyWatchers; + } } @Override public void addWatcher(Watcher watcher) { - if (watchers == null) + if (watchers == null) { watchers = new ArrayList<>(); + } watcher.setSourceId(this.sourceId); watcher.setControllerId(this.controllerId); watchers.add(watcher); @@ -680,16 +682,18 @@ public abstract class AbilityImpl implements Ability { @Override public List getSubAbilities() { - if (subAbilities != null) + if (subAbilities != null) { return subAbilities; - else + } else { return emptyAbilities; + } } @Override public void addSubAbility(Ability ability) { - if (subAbilities == null) + if (subAbilities == null) { subAbilities = new ArrayList<>(); + } ability.setSourceId(this.sourceId); ability.setControllerId(this.controllerId); subAbilities.add(ability); diff --git a/Mage/src/mage/abilities/effects/postresolve/ExileSpellEffect.java b/Mage/src/mage/abilities/effects/postresolve/ExileSpellEffect.java index 0ef3a9d9a6..c4e9ebd0d5 100644 --- a/Mage/src/mage/abilities/effects/postresolve/ExileSpellEffect.java +++ b/Mage/src/mage/abilities/effects/postresolve/ExileSpellEffect.java @@ -36,6 +36,8 @@ import mage.game.Game; import java.io.ObjectStreamException; import java.util.UUID; +import mage.constants.Zone; +import mage.players.Player; /** * @@ -64,6 +66,9 @@ public class ExileSpellEffect extends PostResolveEffect implements MageSingleton @Override public void postResolve(Card card, Ability source, UUID controllerId, Game game) { - card.moveToExile(null, "", source.getSourceId(), game); + Player controller = game.getPlayer(controllerId); + if (controller != null) { + controller.moveCardToExileWithInfo(card, null, "", controllerId, game, Zone.STACK); + } } } diff --git a/Mage/src/mage/abilities/effects/common/ReturnToHandSpellEffect.java b/Mage/src/mage/abilities/effects/postresolve/ReturnToHandSpellEffect.java similarity index 93% rename from Mage/src/mage/abilities/effects/common/ReturnToHandSpellEffect.java rename to Mage/src/mage/abilities/effects/postresolve/ReturnToHandSpellEffect.java index dd0233bcdd..6c65d0950e 100644 --- a/Mage/src/mage/abilities/effects/common/ReturnToHandSpellEffect.java +++ b/Mage/src/mage/abilities/effects/postresolve/ReturnToHandSpellEffect.java @@ -1,4 +1,4 @@ -package mage.abilities.effects.common; +package mage.abilities.effects.postresolve; import mage.constants.Zone; import mage.abilities.Ability; diff --git a/Mage/src/mage/abilities/effects/common/ReturnToLibrarySpellEffect.java b/Mage/src/mage/abilities/effects/postresolve/ReturnToLibrarySpellEffect.java similarity index 96% rename from Mage/src/mage/abilities/effects/common/ReturnToLibrarySpellEffect.java rename to Mage/src/mage/abilities/effects/postresolve/ReturnToLibrarySpellEffect.java index d63d35b300..a385ae04f8 100644 --- a/Mage/src/mage/abilities/effects/common/ReturnToLibrarySpellEffect.java +++ b/Mage/src/mage/abilities/effects/postresolve/ReturnToLibrarySpellEffect.java @@ -25,7 +25,7 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ -package mage.abilities.effects.common; +package mage.abilities.effects.postresolve; import java.util.UUID; import mage.abilities.Ability; diff --git a/Mage/src/mage/abilities/effects/common/ShuffleSpellEffect.java b/Mage/src/mage/abilities/effects/postresolve/ShuffleSpellEffect.java similarity index 98% rename from Mage/src/mage/abilities/effects/common/ShuffleSpellEffect.java rename to Mage/src/mage/abilities/effects/postresolve/ShuffleSpellEffect.java index 28fe0bfe53..49a43c6fff 100644 --- a/Mage/src/mage/abilities/effects/common/ShuffleSpellEffect.java +++ b/Mage/src/mage/abilities/effects/postresolve/ShuffleSpellEffect.java @@ -26,7 +26,7 @@ * or implied, of BetaSteward_at_googlemail.com. */ -package mage.abilities.effects.common; +package mage.abilities.effects.postresolve; import mage.constants.Zone; import mage.abilities.Ability;