From 4216fbab8c4ef86723f616b5e89c7f89e8b81a2d Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 18 Oct 2015 11:11:48 +0200 Subject: [PATCH] * Some more changes for tework ENTERS_THE_BATTLEFIELD event for replacement effects. --- .../sets/betrayersofkamigawa/OrbOfDreams.java | 3 ++- .../championsofkamigawa/OtherworldlyJourney.java | 3 ++- .../ShimatsuTheBloodcloaked.java | 3 ++- .../mage/sets/commander/ChorusOfTheConclave.java | 3 ++- .../src/mage/sets/commander2013/OpalPalace.java | 3 ++- .../mage/sets/commander2014/ScrapMastery.java | 15 +++++++-------- Mage.Sets/src/mage/sets/fifthedition/Kismet.java | 5 +++-- .../src/mage/sets/fifthedition/PrimalClay.java | 5 +++-- .../src/mage/sets/gatecrash/BlindObedience.java | 5 +++-- .../src/mage/sets/gatecrash/MasterBiomancer.java | 2 +- .../src/mage/sets/gatecrash/ZameckGuildmage.java | 5 +++-- .../src/mage/sets/innistrad/DearlyDeparted.java | 5 +++-- .../mage/sets/innistrad/EssenceOfTheWild.java | 5 +++-- .../mage/sets/judgment/WorldgorgerDragon.java | 2 +- .../mage/sets/magic2014/ImposingSovereign.java | 5 +++-- .../src/mage/sets/magic2014/SavageSummoning.java | 3 ++- .../src/mage/sets/magic2015/HushwingGryff.java | 3 ++- .../sets/morningtide/BramblewoodParagon.java | 5 +++-- .../mage/sets/morningtide/OonasBlackguard.java | 5 +++-- .../src/mage/sets/morningtide/SageOfFables.java | 5 +++-- .../src/mage/sets/newphyrexia/DueRespect.java | 3 ++- .../mage/sets/newphyrexia/UrabraskTheHidden.java | 5 +++-- .../src/mage/sets/planarchaos/FrozenAEther.java | 5 +++-- .../mage/sets/planechase2012/PrimalPlasma.java | 5 +++-- .../src/mage/sets/ravnica/LoxodonGatekeeper.java | 5 +++-- .../mage/sets/ravnica/SistersOfStoneDeath.java | 10 +++++----- .../sets/returntoravnica/CorpsejackMenace.java | 5 +++-- .../mage/sets/scarsofmirrodin/TunnelIgnus.java | 9 +++++---- .../sets/shadowmoor/FlourishingDefenses.java | 3 --- .../sets/speedvscunning/AquamorphEntity.java | 5 +++-- Mage.Sets/src/mage/sets/tempest/Dracoplasm.java | 3 ++- Mage.Sets/src/mage/sets/tempest/LivingDeath.java | 10 ++++++---- Mage.Sets/src/mage/sets/tempest/RootMaze.java | 5 +++-- .../src/mage/sets/theros/PyxisOfPandemonium.java | 2 +- .../src/mage/sets/theros/XenagosTheReveler.java | 2 +- .../src/mage/sets/timespiral/LivingEnd.java | 10 +++++----- .../mage/test/cards/triggers/FathomMageTest.java | 2 +- .../abilities/effects/common/AmplifyEffect.java | 2 +- .../abilities/effects/common/DevourEffect.java | 5 +++-- .../continuous/AddCardSubTypeTargetEffect.java | 3 +-- .../SetPowerToughnessSourceEffect.java | 16 +++++++++------- .../mage/abilities/keyword/UnleashAbility.java | 5 +++-- 42 files changed, 119 insertions(+), 91 deletions(-) diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/OrbOfDreams.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/OrbOfDreams.java index 00f69ecb32..487d04fcf3 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/OrbOfDreams.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/OrbOfDreams.java @@ -38,6 +38,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; @@ -82,7 +83,7 @@ public class OrbOfDreams extends CardImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null) { permanent.setTapped(true); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/OtherworldlyJourney.java b/Mage.Sets/src/mage/sets/championsofkamigawa/OtherworldlyJourney.java index 1444229d62..248b962c6f 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/OtherworldlyJourney.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/OtherworldlyJourney.java @@ -44,6 +44,7 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.game.ExileZone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -185,7 +186,7 @@ class OtherworldlyJourneyEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null) { permanent.addCounters(CounterType.P1P1.createInstance(), game); discard(); // use only once diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/ShimatsuTheBloodcloaked.java b/Mage.Sets/src/mage/sets/championsofkamigawa/ShimatsuTheBloodcloaked.java index f25c460999..958837afe7 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/ShimatsuTheBloodcloaked.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/ShimatsuTheBloodcloaked.java @@ -41,6 +41,7 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.common.FilterControlledPermanent; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -105,7 +106,7 @@ class ShimatsuTheBloodcloakedEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = game.getPermanentEntering(event.getTargetId()); + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); Player controller = game.getPlayer(source.getControllerId()); if (creature != null && controller != null) { Target target = new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterControlledPermanent(), true); diff --git a/Mage.Sets/src/mage/sets/commander/ChorusOfTheConclave.java b/Mage.Sets/src/mage/sets/commander/ChorusOfTheConclave.java index 466966ec6d..4875d2aca7 100644 --- a/Mage.Sets/src/mage/sets/commander/ChorusOfTheConclave.java +++ b/Mage.Sets/src/mage/sets/commander/ChorusOfTheConclave.java @@ -46,6 +46,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -193,7 +194,7 @@ class ChorusOfTheConclaveReplacementEffect2 extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = game.getPermanentEntering(event.getSourceId()); + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); Map spellX = (Map) game.getState().getValue("spellX" + source.getSourceId()); MageObject sourceObject = source.getSourceObject(game); if (sourceObject != null && creature != null && spellX != null) { diff --git a/Mage.Sets/src/mage/sets/commander2013/OpalPalace.java b/Mage.Sets/src/mage/sets/commander2013/OpalPalace.java index 0086d731e9..53bb7eb50b 100644 --- a/Mage.Sets/src/mage/sets/commander2013/OpalPalace.java +++ b/Mage.Sets/src/mage/sets/commander2013/OpalPalace.java @@ -47,6 +47,7 @@ import mage.constants.WatcherScope; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -163,7 +164,7 @@ class OpalPalaceEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null) { Integer castCount = (Integer) game.getState().getValue(permanent.getId() + "_castCount"); if (castCount != null && castCount > 0) { diff --git a/Mage.Sets/src/mage/sets/commander2014/ScrapMastery.java b/Mage.Sets/src/mage/sets/commander2014/ScrapMastery.java index 95c2ae286f..280abdd958 100644 --- a/Mage.Sets/src/mage/sets/commander2014/ScrapMastery.java +++ b/Mage.Sets/src/mage/sets/commander2014/ScrapMastery.java @@ -56,7 +56,6 @@ public class ScrapMastery extends CardImpl { super(ownerId, 38, "Scrap Mastery", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{R}{R}"); this.expansionSetCode = "C14"; - // Each player exiles all artifact cards from his or her graveyard, then sacrifices all artifacts he or she controls, then puts all cards he or she exiled this way onto the battlefield. this.getSpellAbility().addEffect(new ScrapMasteryEffect()); } @@ -93,11 +92,11 @@ class ScrapMasteryEffect extends OneShotEffect { if (controller != null) { Map> exiledCards = new HashMap<>(); // exile artifacts from graveyard - for (UUID playerId: controller.getInRange()) { + for (UUID playerId : controller.getInRange()) { Player player = game.getPlayer(playerId); if (player != null) { Set cards = new HashSet<>(); - for (Card card: player.getGraveyard().getCards(new FilterArtifactCard(), game)) { + for (Card card : player.getGraveyard().getCards(new FilterArtifactCard(), game)) { cards.add(card.getId()); player.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); } @@ -105,22 +104,22 @@ class ScrapMasteryEffect extends OneShotEffect { } } // sacrifice all artifacts - for (UUID playerId: controller.getInRange()) { + for (UUID playerId : controller.getInRange()) { Player player = game.getPlayer(playerId); if (player != null) { - for (Permanent permanent: game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), playerId, game)) { + for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), playerId, game)) { permanent.sacrifice(source.getSourceId(), game); } } } // puts all cards he or she exiled this way onto the battlefield - for (UUID playerId: controller.getInRange()) { + for (UUID playerId : controller.getInRange()) { Player player = game.getPlayer(playerId); if (player != null) { - for (UUID cardId: exiledCards.get(playerId)) { + for (UUID cardId : exiledCards.get(playerId)) { Card card = game.getCard(cardId); if (card != null) { - player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, cardId); + controller.moveCards(card, Zone.EXILED, source, game); } } } diff --git a/Mage.Sets/src/mage/sets/fifthedition/Kismet.java b/Mage.Sets/src/mage/sets/fifthedition/Kismet.java index 673526b4b6..a4319c15b6 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/Kismet.java +++ b/Mage.Sets/src/mage/sets/fifthedition/Kismet.java @@ -38,6 +38,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -79,7 +80,7 @@ class KismetEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent target = game.getPermanentEntering(event.getTargetId()); + Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { target.setTapped(true); } @@ -94,7 +95,7 @@ class KismetEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { - Permanent permanent = game.getPermanent(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null && (permanent.getCardType().contains(CardType.ARTIFACT) || permanent.getCardType().contains(CardType.CREATURE) || permanent.getCardType().contains(CardType.LAND))) { diff --git a/Mage.Sets/src/mage/sets/fifthedition/PrimalClay.java b/Mage.Sets/src/mage/sets/fifthedition/PrimalClay.java index 998dd517b3..9ac15c4a2c 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/PrimalClay.java +++ b/Mage.Sets/src/mage/sets/fifthedition/PrimalClay.java @@ -45,6 +45,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -101,7 +102,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getTargetId().equals(source.getSourceId())) { - Permanent sourcePermanent = game.getPermanentEntering(event.getTargetId()); + Permanent sourcePermanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) { return true; } @@ -116,7 +117,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null) { Choice choice = new ChoiceImpl(true); choice.setMessage("Choose what " + permanent.getIdName() + " becomes to"); diff --git a/Mage.Sets/src/mage/sets/gatecrash/BlindObedience.java b/Mage.Sets/src/mage/sets/gatecrash/BlindObedience.java index 537b730466..9178c73592 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/BlindObedience.java +++ b/Mage.Sets/src/mage/sets/gatecrash/BlindObedience.java @@ -39,6 +39,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; @@ -83,7 +84,7 @@ class BlindObedienceTapEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent target = game.getPermanentEntering(event.getTargetId()); + Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { target.setTapped(true); } @@ -98,7 +99,7 @@ class BlindObedienceTapEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null && (permanent.getCardType().contains(CardType.CREATURE) || permanent.getCardType().contains(CardType.ARTIFACT))) { return true; } diff --git a/Mage.Sets/src/mage/sets/gatecrash/MasterBiomancer.java b/Mage.Sets/src/mage/sets/gatecrash/MasterBiomancer.java index 34fcc5b629..8a7a9c32ef 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/MasterBiomancer.java +++ b/Mage.Sets/src/mage/sets/gatecrash/MasterBiomancer.java @@ -111,7 +111,7 @@ class MasterBiomancerEntersBattlefieldEffect extends ReplacementEffectImpl { creature.addCounters(CounterType.P1P1.createInstance(power), game); } ContinuousEffect effect = new AddCardSubTypeTargetEffect("Mutant", Duration.Custom); - effect.setTargetPointer(new FixedTarget(creature.getId())); + effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game) + 1)); game.addEffect(effect, source); } return false; diff --git a/Mage.Sets/src/mage/sets/gatecrash/ZameckGuildmage.java b/Mage.Sets/src/mage/sets/gatecrash/ZameckGuildmage.java index cf831b2939..41bc52a239 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/ZameckGuildmage.java +++ b/Mage.Sets/src/mage/sets/gatecrash/ZameckGuildmage.java @@ -43,6 +43,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.target.common.TargetControlledCreaturePermanent; @@ -99,7 +100,7 @@ class ZameckGuildmageEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); return permanent != null && permanent.getControllerId().equals(source.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE); } @@ -110,7 +111,7 @@ class ZameckGuildmageEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent target = game.getPermanentEntering(event.getTargetId()); + Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { target.addCounters(CounterType.P1P1.createInstance(), game); } diff --git a/Mage.Sets/src/mage/sets/innistrad/DearlyDeparted.java b/Mage.Sets/src/mage/sets/innistrad/DearlyDeparted.java index 71d69e1ebc..aa0a1f54fe 100644 --- a/Mage.Sets/src/mage/sets/innistrad/DearlyDeparted.java +++ b/Mage.Sets/src/mage/sets/innistrad/DearlyDeparted.java @@ -41,6 +41,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -92,7 +93,7 @@ class DearlyDepartedEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null && permanent.getControllerId().equals(source.getControllerId()) && permanent.hasSubtype("Human")) { return true; } @@ -101,7 +102,7 @@ class DearlyDepartedEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent target = game.getPermanentEntering(event.getTargetId()); + Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { target.addCounters(CounterType.P1P1.createInstance(), game); } diff --git a/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java b/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java index 1e5aebd4ea..68b0c47ceb 100644 --- a/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java +++ b/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java @@ -40,6 +40,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -90,13 +91,13 @@ class EssenceOfTheWildEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - Permanent perm = game.getPermanentEntering(event.getTargetId()); + Permanent perm = ((EntersTheBattlefieldEvent) event).getTarget(); return perm != null && perm.getCardType().contains(CardType.CREATURE) && perm.getControllerId().equals(source.getControllerId()); } @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent sourceObject = game.getPermanent(source.getSourceId()); + Permanent sourceObject = ((EntersTheBattlefieldEvent) event).getTarget(); if (sourceObject != null) { game.addEffect(new CopyEffect(Duration.Custom, sourceObject, event.getTargetId()), source); } diff --git a/Mage.Sets/src/mage/sets/judgment/WorldgorgerDragon.java b/Mage.Sets/src/mage/sets/judgment/WorldgorgerDragon.java index ea74b1f892..0256568c9c 100644 --- a/Mage.Sets/src/mage/sets/judgment/WorldgorgerDragon.java +++ b/Mage.Sets/src/mage/sets/judgment/WorldgorgerDragon.java @@ -152,7 +152,7 @@ class WorldgorgerDragonLeavesEffect extends OneShotEffect { for (UUID cardId : exile) { Card card = game.getCard(cardId); if (card != null) { - controller.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId()); + controller.moveCards(card, Zone.EXILED, source, game); } } return true; diff --git a/Mage.Sets/src/mage/sets/magic2014/ImposingSovereign.java b/Mage.Sets/src/mage/sets/magic2014/ImposingSovereign.java index 4a7ae5c389..fc3aca583e 100644 --- a/Mage.Sets/src/mage/sets/magic2014/ImposingSovereign.java +++ b/Mage.Sets/src/mage/sets/magic2014/ImposingSovereign.java @@ -39,6 +39,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; @@ -84,7 +85,7 @@ class ImposingSovereignEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent target = game.getPermanentEntering(event.getTargetId()); + Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { target.tap(game); } @@ -99,7 +100,7 @@ class ImposingSovereignEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) { return true; } diff --git a/Mage.Sets/src/mage/sets/magic2014/SavageSummoning.java b/Mage.Sets/src/mage/sets/magic2014/SavageSummoning.java index 0736339d5a..3f12959818 100644 --- a/Mage.Sets/src/mage/sets/magic2014/SavageSummoning.java +++ b/Mage.Sets/src/mage/sets/magic2014/SavageSummoning.java @@ -50,6 +50,7 @@ import mage.constants.WatcherScope; import mage.counters.CounterType; import mage.game.Game; import mage.game.command.Commander; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -314,7 +315,7 @@ class SavageSummoningEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = game.getPermanentEntering(event.getTargetId()); + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); if (creature != null) { creature.addCounters(CounterType.P1P1.createInstance(), game); } diff --git a/Mage.Sets/src/mage/sets/magic2015/HushwingGryff.java b/Mage.Sets/src/mage/sets/magic2015/HushwingGryff.java index a05440e99d..2938b8d6ca 100644 --- a/Mage.Sets/src/mage/sets/magic2015/HushwingGryff.java +++ b/Mage.Sets/src/mage/sets/magic2015/HushwingGryff.java @@ -43,6 +43,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; @@ -108,7 +109,7 @@ class HushwingGryffEffect extends ContinuousRuleModifyingEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { Ability ability = (Ability) getValue("targetAbility"); if (ability != null && AbilityType.TRIGGERED.equals(ability.getAbilityType())) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) { return true; } diff --git a/Mage.Sets/src/mage/sets/morningtide/BramblewoodParagon.java b/Mage.Sets/src/mage/sets/morningtide/BramblewoodParagon.java index 039cbc3f88..7d9eb88b96 100644 --- a/Mage.Sets/src/mage/sets/morningtide/BramblewoodParagon.java +++ b/Mage.Sets/src/mage/sets/morningtide/BramblewoodParagon.java @@ -44,6 +44,7 @@ import mage.counters.CounterType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.CounterPredicate; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; @@ -108,7 +109,7 @@ class BramblewoodParagonReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - Permanent creature = game.getPermanentEntering(event.getTargetId()); + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); return creature != null && creature.getControllerId().equals(source.getControllerId()) && creature.getCardType().contains(CardType.CREATURE) && creature.hasSubtype("Warrior") @@ -117,7 +118,7 @@ class BramblewoodParagonReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = game.getPermanentEntering(event.getTargetId()); + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); if (creature != null) { creature.addCounters(CounterType.P1P1.createInstance(), game); } diff --git a/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java b/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java index 2199b73e73..e652196c9d 100644 --- a/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java +++ b/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java @@ -45,6 +45,7 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -102,7 +103,7 @@ class OonasBlackguardReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - Permanent creature = game.getPermanentEntering(event.getTargetId()); + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); if (creature != null && creature.getControllerId().equals(source.getControllerId()) && creature.getCardType().contains(CardType.CREATURE) && creature.hasSubtype("Rogue") @@ -119,7 +120,7 @@ class OonasBlackguardReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = game.getPermanentEntering(event.getTargetId()); + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); if (creature != null) { creature.addCounters(CounterType.P1P1.createInstance(), game); } diff --git a/Mage.Sets/src/mage/sets/morningtide/SageOfFables.java b/Mage.Sets/src/mage/sets/morningtide/SageOfFables.java index a634409057..ee007b91f5 100644 --- a/Mage.Sets/src/mage/sets/morningtide/SageOfFables.java +++ b/Mage.Sets/src/mage/sets/morningtide/SageOfFables.java @@ -44,6 +44,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.target.common.TargetControlledCreaturePermanent; @@ -99,7 +100,7 @@ class SageOfFablesReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - Permanent creature = game.getPermanentEntering(event.getTargetId()); + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); return creature != null && creature.getControllerId().equals(source.getControllerId()) && creature.getCardType().contains(CardType.CREATURE) && creature.getSubtype().contains("Wizard") @@ -113,7 +114,7 @@ class SageOfFablesReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = game.getPermanentEntering(event.getTargetId()); + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); if (creature != null) { creature.addCounters(CounterType.P1P1.createInstance(), game); } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/DueRespect.java b/Mage.Sets/src/mage/sets/newphyrexia/DueRespect.java index d7cdb54f04..d59865ecdb 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/DueRespect.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/DueRespect.java @@ -37,6 +37,7 @@ import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Rarity; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; @@ -84,7 +85,7 @@ class DueRespectEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null) { permanent.setTapped(true); } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/UrabraskTheHidden.java b/Mage.Sets/src/mage/sets/newphyrexia/UrabraskTheHidden.java index 6dd467f88f..9c0a62aa76 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/UrabraskTheHidden.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/UrabraskTheHidden.java @@ -42,6 +42,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -88,7 +89,7 @@ class UrabraskTheHiddenEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent target = game.getPermanentEntering(event.getTargetId()); + Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { target.setTapped(true); } @@ -103,7 +104,7 @@ class UrabraskTheHiddenEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) { return true; } diff --git a/Mage.Sets/src/mage/sets/planarchaos/FrozenAEther.java b/Mage.Sets/src/mage/sets/planarchaos/FrozenAEther.java index e06118df4f..5c84fa60d0 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/FrozenAEther.java +++ b/Mage.Sets/src/mage/sets/planarchaos/FrozenAEther.java @@ -38,6 +38,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -79,7 +80,7 @@ class FrozenAEtherTapEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent target = game.getPermanentEntering(event.getTargetId()); + Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { target.setTapped(true); } @@ -94,7 +95,7 @@ class FrozenAEtherTapEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null && (permanent.getCardType().contains(CardType.CREATURE) || permanent.getCardType().contains(CardType.LAND) diff --git a/Mage.Sets/src/mage/sets/planechase2012/PrimalPlasma.java b/Mage.Sets/src/mage/sets/planechase2012/PrimalPlasma.java index 78d965850c..55b7eb6adb 100644 --- a/Mage.Sets/src/mage/sets/planechase2012/PrimalPlasma.java +++ b/Mage.Sets/src/mage/sets/planechase2012/PrimalPlasma.java @@ -45,6 +45,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -102,7 +103,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getTargetId().equals(source.getSourceId())) { - Permanent sourcePermanent = game.getPermanentEntering(source.getSourceId()); + Permanent sourcePermanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) { return true; } @@ -117,7 +118,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanentEntering(source.getSourceId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null) { Choice choice = new ChoiceImpl(true); choice.setMessage("Choose what " + permanent.getIdName() + " becomes to"); diff --git a/Mage.Sets/src/mage/sets/ravnica/LoxodonGatekeeper.java b/Mage.Sets/src/mage/sets/ravnica/LoxodonGatekeeper.java index fd8a62fde9..b11584bdd3 100644 --- a/Mage.Sets/src/mage/sets/ravnica/LoxodonGatekeeper.java +++ b/Mage.Sets/src/mage/sets/ravnica/LoxodonGatekeeper.java @@ -39,6 +39,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -86,7 +87,7 @@ class LoxodonGatekeeperTapEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent target = game.getPermanentEntering(event.getTargetId()); + Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { target.setTapped(true); } @@ -101,7 +102,7 @@ class LoxodonGatekeeperTapEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null && (permanent.getCardType().contains(CardType.CREATURE) || permanent.getCardType().contains(CardType.LAND) diff --git a/Mage.Sets/src/mage/sets/ravnica/SistersOfStoneDeath.java b/Mage.Sets/src/mage/sets/ravnica/SistersOfStoneDeath.java index 200188ec09..92302fb34a 100644 --- a/Mage.Sets/src/mage/sets/ravnica/SistersOfStoneDeath.java +++ b/Mage.Sets/src/mage/sets/ravnica/SistersOfStoneDeath.java @@ -118,18 +118,18 @@ class SistersOfStoneDeathEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { CardsImpl cardsInExile = new CardsImpl(); TargetCard target = new TargetCard(Zone.PICK, new FilterCard()); - Player you = game.getPlayer(source.getControllerId()); - if (you != null) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { ExileZone exile = game.getExile().getExileZone(exileId); if (exile != null) { - LinkedList cards = new LinkedList(exile); + LinkedList cards = new LinkedList<>(exile); for (UUID cardId : cards) { Card card = game.getCard(cardId); cardsInExile.add(card); } - if (you.choose(Outcome.PutCreatureInPlay, cardsInExile, target, game)) { + if (controller.choose(Outcome.PutCreatureInPlay, cardsInExile, target, game)) { Card chosenCard = game.getCard(target.getFirstTarget()); - return you.putOntoBattlefieldWithInfo(chosenCard, game, Zone.EXILED, source.getSourceId()); + return controller.moveCards(chosenCard, Zone.EXILED, source, game); } } } diff --git a/Mage.Sets/src/mage/sets/returntoravnica/CorpsejackMenace.java b/Mage.Sets/src/mage/sets/returntoravnica/CorpsejackMenace.java index 10bf030e45..a5d959857b 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/CorpsejackMenace.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/CorpsejackMenace.java @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; @@ -95,7 +96,7 @@ class CorpsejackMenaceReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent == null) { - permanent = game.getPermanentEntering(event.getTargetId()); + permanent = ((EntersTheBattlefieldEvent) event).getTarget(); } if (permanent != null) { permanent.addCounters(CounterType.P1P1.createInstance(event.getAmount() * 2), game, event.getAppliedEffects()); @@ -111,7 +112,7 @@ class CorpsejackMenaceReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getData().equals(CounterType.P1P1.getName())) { - Permanent permanent = game.getPermanent(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent == null) { permanent = game.getPermanentEntering(event.getTargetId()); } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/TunnelIgnus.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/TunnelIgnus.java index 0b2216e27f..806759e787 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/TunnelIgnus.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/TunnelIgnus.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.scarsofmirrodin; import java.util.HashMap; @@ -76,7 +75,8 @@ public class TunnelIgnus extends CardImpl { } class TunnelIgnusWatcher extends Watcher { - protected Map counts = new HashMap(); + + protected Map counts = new HashMap<>(); public TunnelIgnusWatcher() { super("LandPlayedCount", WatcherScope.PLAYER); @@ -84,7 +84,7 @@ class TunnelIgnusWatcher extends Watcher { public TunnelIgnusWatcher(final TunnelIgnusWatcher watcher) { super(watcher); - for (Entry entry: watcher.counts.entrySet()) { + for (Entry entry : watcher.counts.entrySet()) { counts.put(entry.getKey(), entry.getValue()); } } @@ -116,6 +116,7 @@ class TunnelIgnusWatcher extends Watcher { } class TunnelIgnusTriggeredAbility extends TriggeredAbilityImpl { + TunnelIgnusTriggeredAbility() { super(Zone.BATTLEFIELD, new DamageTargetEffect(3)); } @@ -153,4 +154,4 @@ class TunnelIgnusTriggeredAbility extends TriggeredAbilityImpl { public String getRule() { return "Whenever a land enters the battlefield under an opponent's control, if that player had another land enter the battlefield under his or her control this turn, {this} deals 3 damage to that player."; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/FlourishingDefenses.java b/Mage.Sets/src/mage/sets/shadowmoor/FlourishingDefenses.java index 9e94853f48..c18b7e9d8e 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/FlourishingDefenses.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/FlourishingDefenses.java @@ -90,9 +90,6 @@ class FlourishingDefensesTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (event.getData().equals(CounterType.M1M1.getName())) { Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId()); - if (permanent == null) { - permanent = game.getPermanentEntering(event.getTargetId()); - } if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) { return true; } diff --git a/Mage.Sets/src/mage/sets/speedvscunning/AquamorphEntity.java b/Mage.Sets/src/mage/sets/speedvscunning/AquamorphEntity.java index 3d57c2229d..c286fd7ffb 100644 --- a/Mage.Sets/src/mage/sets/speedvscunning/AquamorphEntity.java +++ b/Mage.Sets/src/mage/sets/speedvscunning/AquamorphEntity.java @@ -44,6 +44,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -112,7 +113,7 @@ class AquamorphEntityReplacementEffect extends ReplacementEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) { if (event.getTargetId().equals(source.getSourceId())) { - Permanent sourcePermanent = game.getPermanentEntering(source.getSourceId()); + Permanent sourcePermanent = ((EntersTheBattlefieldEvent) event).getTarget();; if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) { return true; } @@ -133,7 +134,7 @@ class AquamorphEntityReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanentEntering(source.getSourceId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null) { Choice choice = new ChoiceImpl(true); choice.setMessage("Choose what the creature becomes to"); diff --git a/Mage.Sets/src/mage/sets/tempest/Dracoplasm.java b/Mage.Sets/src/mage/sets/tempest/Dracoplasm.java index 33b9e60a02..8776797ba0 100644 --- a/Mage.Sets/src/mage/sets/tempest/Dracoplasm.java +++ b/Mage.Sets/src/mage/sets/tempest/Dracoplasm.java @@ -48,6 +48,7 @@ import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -122,7 +123,7 @@ class DracoplasmEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = game.getPermanentEntering(event.getTargetId()); + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); Player controller = game.getPlayer(source.getControllerId()); if (creature != null && controller != null) { Target target = new TargetControlledPermanent(0, Integer.MAX_VALUE, filter, true); diff --git a/Mage.Sets/src/mage/sets/tempest/LivingDeath.java b/Mage.Sets/src/mage/sets/tempest/LivingDeath.java index fd01450856..f3c071223d 100644 --- a/Mage.Sets/src/mage/sets/tempest/LivingDeath.java +++ b/Mage.Sets/src/mage/sets/tempest/LivingDeath.java @@ -43,6 +43,7 @@ import mage.game.ExileZone; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; + /** * * @author Plopman @@ -53,7 +54,6 @@ public class LivingDeath extends CardImpl { super(ownerId, 36, "Living Death", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{B}{B}"); this.expansionSetCode = "TMP"; - // Each player exiles all creature cards from his or her graveyard, then sacrifices all creatures he or she controls, then puts all cards he or she exiled this way onto the battlefield. this.getSpellAbility().addEffect(new LivingDeathEffect()); } @@ -67,6 +67,7 @@ public class LivingDeath extends CardImpl { return new LivingDeath(this); } } + class LivingDeathEffect extends OneShotEffect { public LivingDeathEffect() { @@ -89,16 +90,16 @@ class LivingDeathEffect extends OneShotEffect { MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { // move creature cards from graveyard to exile - for (UUID playerId: controller.getInRange()){ + for (UUID playerId : controller.getInRange()) { Player player = game.getPlayer(playerId); if (player != null) { - for (Card card :player.getGraveyard().getCards(new FilterCreatureCard(), game)) { + for (Card card : player.getGraveyard().getCards(new FilterCreatureCard(), game)) { controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.GRAVEYARD, true); } } } // sacrifice all creatures - for (Permanent permanent :game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) { permanent.sacrifice(source.getSourceId(), game); } // put exiled cards to battlefield @@ -107,6 +108,7 @@ class LivingDeathEffect extends OneShotEffect { for (Card card : exileZone.getCards(game)) { Player player = game.getPlayer(card.getOwnerId()); if (player != null) { + player.moveCards(card, Zone.EXILED, source, game); player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId()); } } diff --git a/Mage.Sets/src/mage/sets/tempest/RootMaze.java b/Mage.Sets/src/mage/sets/tempest/RootMaze.java index 26835f74da..eb57322664 100644 --- a/Mage.Sets/src/mage/sets/tempest/RootMaze.java +++ b/Mage.Sets/src/mage/sets/tempest/RootMaze.java @@ -38,6 +38,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -79,7 +80,7 @@ class RootMazeEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent target = game.getPermanentEntering(event.getTargetId()); + Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { target.setTapped(true); } @@ -93,7 +94,7 @@ class RootMazeEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanentEntering(event.getTargetId()); + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); return permanent != null && (permanent.getCardType().contains(CardType.LAND) || permanent.getCardType().contains(CardType.ARTIFACT)); } diff --git a/Mage.Sets/src/mage/sets/theros/PyxisOfPandemonium.java b/Mage.Sets/src/mage/sets/theros/PyxisOfPandemonium.java index 62ce1a931b..3b1e6e3e83 100644 --- a/Mage.Sets/src/mage/sets/theros/PyxisOfPandemonium.java +++ b/Mage.Sets/src/mage/sets/theros/PyxisOfPandemonium.java @@ -173,7 +173,7 @@ class PyxisOfPandemoniumPutOntoBattlefieldEffect extends OneShotEffect { for (Card card : exileZone.getCards(game)) { card.setFaceDown(false, game); if (CardUtil.isPermanentCard(card)) { - player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId()); + player.moveCards(card, Zone.EXILED, source, game); } } } diff --git a/Mage.Sets/src/mage/sets/theros/XenagosTheReveler.java b/Mage.Sets/src/mage/sets/theros/XenagosTheReveler.java index b71a4b0cc0..cb9bcd6c96 100644 --- a/Mage.Sets/src/mage/sets/theros/XenagosTheReveler.java +++ b/Mage.Sets/src/mage/sets/theros/XenagosTheReveler.java @@ -198,7 +198,7 @@ class XenagosExileEffect extends OneShotEffect { for (UUID targetId : target1.getTargets()) { Card card = cards.get(targetId, game); if (card != null) { - player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId()); + player.moveCards(card, Zone.EXILED, source, game); } } } diff --git a/Mage.Sets/src/mage/sets/timespiral/LivingEnd.java b/Mage.Sets/src/mage/sets/timespiral/LivingEnd.java index 398a3e28fc..de93d360d5 100644 --- a/Mage.Sets/src/mage/sets/timespiral/LivingEnd.java +++ b/Mage.Sets/src/mage/sets/timespiral/LivingEnd.java @@ -63,7 +63,7 @@ public class LivingEnd extends CardImpl { // Each player exiles all creature cards from his or her graveyard, then sacrifices all creatures // he or she controls, then puts all cards he or she exiled this way onto the battlefield. this.getSpellAbility().addEffect(new LivingEndEffect()); - + } public LivingEnd(final LivingEnd card) { @@ -98,16 +98,16 @@ class LivingEndEffect extends OneShotEffect { MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { // move creature cards from graveyard to exile - for (UUID playerId: controller.getInRange()){ + for (UUID playerId : controller.getInRange()) { Player player = game.getPlayer(playerId); if (player != null) { - for (Card card :player.getGraveyard().getCards(new FilterCreatureCard(), game)) { + for (Card card : player.getGraveyard().getCards(new FilterCreatureCard(), game)) { controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.GRAVEYARD, true); } } } // sacrifice all creatures - for (Permanent permanent :game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) { permanent.sacrifice(source.getSourceId(), game); } // put exiled cards to battlefield @@ -116,7 +116,7 @@ class LivingEndEffect extends OneShotEffect { for (Card card : exileZone.getCards(game)) { Player player = game.getPlayer(card.getOwnerId()); if (player != null) { - player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId()); + player.moveCards(card, Zone.EXILED, source, game); } } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/FathomMageTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/FathomMageTest.java index 0d26c441ff..145785ccc8 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/FathomMageTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/FathomMageTest.java @@ -60,7 +60,7 @@ public class FathomMageTest extends CardTestPlayerBase { assertPowerToughness(playerA, "Fathom Mage", 3, 3); Permanent fathomMage = getPermanent("Fathom Mage", playerA); - Assert.assertEquals("Fathom Mage has to be a Mutant", fathomMage.getSubtype().contains("Mutant"), true); + Assert.assertEquals("Fathom Mage has to be a Mutant", true, fathomMage.getSubtype().contains("Mutant")); assertHandCount(playerA, 2); } diff --git a/Mage/src/mage/abilities/effects/common/AmplifyEffect.java b/Mage/src/mage/abilities/effects/common/AmplifyEffect.java index dcae210584..b05ddd626c 100644 --- a/Mage/src/mage/abilities/effects/common/AmplifyEffect.java +++ b/Mage/src/mage/abilities/effects/common/AmplifyEffect.java @@ -116,7 +116,7 @@ public class AmplifyEffect extends ReplacementEffectImpl { cards.addAll(target.getTargets()); int amountCounters = cards.size() * amplifyFactor.getFactor(); sourceCreature.addCounters(CounterType.P1P1.createInstance(amountCounters), game); - controller.revealCards(sourceCreature.getName(), cards, game); + controller.revealCards(sourceCreature.getIdName(), cards, game); } } } diff --git a/Mage/src/mage/abilities/effects/common/DevourEffect.java b/Mage/src/mage/abilities/effects/common/DevourEffect.java index b2baf9ef7c..18432616aa 100644 --- a/Mage/src/mage/abilities/effects/common/DevourEffect.java +++ b/Mage/src/mage/abilities/effects/common/DevourEffect.java @@ -39,6 +39,7 @@ import mage.counters.CounterType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -116,7 +117,7 @@ public class DevourEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getTargetId().equals(source.getSourceId())) { - Permanent sourcePermanent = game.getPermanentEntering(source.getSourceId()); + Permanent sourcePermanent = ((EntersTheBattlefieldEvent) event).getTarget(); game.getState().setValue(sourcePermanent.getId().toString() + "devoured", null); return true; } @@ -130,7 +131,7 @@ public class DevourEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = game.getPermanentEntering(event.getTargetId()); + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); Player controller = game.getPlayer(source.getControllerId()); if (creature != null && controller != null) { Target target = new TargetControlledCreaturePermanent(1, Integer.MAX_VALUE, filter, true); diff --git a/Mage/src/mage/abilities/effects/common/continuous/AddCardSubTypeTargetEffect.java b/Mage/src/mage/abilities/effects/common/continuous/AddCardSubTypeTargetEffect.java index 475a7f8d6b..e4ed2543d9 100644 --- a/Mage/src/mage/abilities/effects/common/continuous/AddCardSubTypeTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continuous/AddCardSubTypeTargetEffect.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.effects.common.continuous; import mage.abilities.Ability; @@ -42,7 +41,7 @@ import mage.game.permanent.Permanent; * @author nantuko */ public class AddCardSubTypeTargetEffect extends ContinuousEffectImpl { - + private final String addedSubType; public AddCardSubTypeTargetEffect(String addedSubType, Duration duration) { diff --git a/Mage/src/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java b/Mage/src/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java index add455f4b1..d523a5cbd0 100644 --- a/Mage/src/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java @@ -1,16 +1,16 @@ /* * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR @@ -20,12 +20,11 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.effects.common.continuous; import mage.MageObject; @@ -76,7 +75,10 @@ public class SetPowerToughnessSourceEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { - MageObject mageObject = game.getObject(source.getSourceId()); + MageObject mageObject = game.getObject(source.getSourceId()); + if (mageObject == null) { + game.getPermanentEntering(source.getSourceId()); + } if (mageObject == null) { if (duration.equals(Duration.Custom)) { discard(); diff --git a/Mage/src/mage/abilities/keyword/UnleashAbility.java b/Mage/src/mage/abilities/keyword/UnleashAbility.java index 07cccfe488..953d482278 100644 --- a/Mage/src/mage/abilities/keyword/UnleashAbility.java +++ b/Mage/src/mage/abilities/keyword/UnleashAbility.java @@ -37,6 +37,7 @@ import mage.constants.Outcome; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -97,10 +98,10 @@ class UnleashReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = game.getPermanentEntering(source.getSourceId()); + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); Player controller = game.getPlayer(source.getControllerId()); if (creature != null && controller != null) { - if (controller.chooseUse(outcome, "Unleash " + creature.getName() + "?", source, game)) { + if (controller.chooseUse(outcome, "Unleash " + creature.getLogName() + "?", source, game)) { if (!game.isSimulation()) { game.informPlayers(controller.getLogName() + " unleashes " + creature.getName()); }