From 127e63ce0dd925152c11c0650e8051b3de3a49f1 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 13 Feb 2013 01:24:36 +0100 Subject: [PATCH] Changed used battlefield.count or battlefield.getActivePermanents methods to take player range into account. --- .../mage/sets/apocalypse/DesolationAngel.java | 2 +- .../mage/sets/apocalypse/TranquilPath.java | 12 +++++---- .../avacynrestored/AngelOfGlorysRise.java | 12 ++++----- .../sets/avacynrestored/DevastationTide.java | 11 ++++---- .../sets/betrayersofkamigawa/AuraBarbs.java | 4 +-- .../betrayersofkamigawa/FinalJudgment.java | 2 +- .../PatronOfTheOrochi.java | 2 +- .../betrayersofkamigawa/ReduceToDreams.java | 2 +- .../mage/sets/conflux/WretchedBanquet.java | 3 ++- .../src/mage/sets/darksteel/Soulscour.java | 2 +- .../mage/sets/fallenempires/Seasinger.java | 26 +++++++------------ .../mage/sets/innistrad/BlasphemousAct.java | 6 ++--- .../mage/sets/magic2010/PlanarCleansing.java | 2 +- .../mage/sets/magic2010/TempestOfLight.java | 2 +- .../mage/sets/magic2012/Scrambleverse.java | 2 +- .../mage/sets/magic2013/PublicExecution.java | 25 ++++++++---------- .../src/mage/sets/magic2013/Worldfire.java | 2 +- .../sets/planechase/AkromasVengeance.java | 2 +- .../sets/returntoravnica/CyclonicRift.java | 2 +- .../sets/returntoravnica/RakdosCharm.java | 2 +- .../mage/sets/returntoravnica/Teleportal.java | 2 +- .../sets/riseoftheeldrazi/KhalniHydra.java | 10 ++++--- .../sets/riseoftheeldrazi/SarkhanTheMad.java | 2 +- .../sets/scarsofmirrodin/PrecursorGolem.java | 2 +- .../src/mage/sets/stronghold/Evacuation.java | 2 +- .../mage/sets/stronghold/IntruderAlarm.java | 2 +- .../src/mage/sets/tempest/Tranquility.java | 2 +- .../src/mage/sets/urzaslegacy/Rebuild.java | 2 +- .../src/mage/sets/urzassaga/AcidicSoil.java | 5 ++-- .../src/mage/sets/urzassaga/Hibernation.java | 2 +- Mage.Sets/src/mage/sets/urzassaga/Hush.java | 2 +- .../mage/sets/worldwake/StoneIdolTrap.java | 2 +- .../continious/BoostOpponentsEffect.java | 4 +-- 33 files changed, 80 insertions(+), 82 deletions(-) diff --git a/Mage.Sets/src/mage/sets/apocalypse/DesolationAngel.java b/Mage.Sets/src/mage/sets/apocalypse/DesolationAngel.java index 4bf30ffce2..3718caf6b1 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/DesolationAngel.java +++ b/Mage.Sets/src/mage/sets/apocalypse/DesolationAngel.java @@ -92,7 +92,7 @@ class DesolationAngelEntersBattlefieldEffect extends OneShotEffect { super(ownerId, 89, "Tranquil Path", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{4}{G}"); this.expansionSetCode = "APC"; this.color.setGreen(true); + + // Destroy all enchantments. this.getSpellAbility().addEffect(new TranquilPathEffect()); + // Draw a card. this.getSpellAbility().addEffect(new DrawCardControllerEffect(1)); } @@ -74,7 +76,7 @@ class TranquilPathEffect extends OneShotEffect { } public TranquilPathEffect() { - super(Constants.Outcome.DestroyPermanent); + super(Outcome.DestroyPermanent); staticText = "Destroy all enchantments"; } @@ -84,7 +86,7 @@ class TranquilPathEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.destroy(source.getId(), game, false); } return true; @@ -95,4 +97,4 @@ class TranquilPathEffect extends OneShotEffect { return new TranquilPathEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/AngelOfGlorysRise.java b/Mage.Sets/src/mage/sets/avacynrestored/AngelOfGlorysRise.java index cfc1e06f4c..514ec5f1cd 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/AngelOfGlorysRise.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/AngelOfGlorysRise.java @@ -34,16 +34,16 @@ import mage.Constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.FlyingAbility; +import mage.cards.Card; import mage.cards.CardImpl; import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreaturePermanent; -import mage.game.Game; -import mage.abilities.effects.OneShotEffect; -import mage.cards.Card; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.players.Player; +import mage.game.Game; import mage.game.permanent.Permanent; +import mage.players.Player; /** * @@ -105,7 +105,7 @@ class AngelOfGlorysRiseEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - for (Permanent zombie : game.getBattlefield().getAllActivePermanents(filterZombie, game)) { + for (Permanent zombie : game.getBattlefield().getActivePermanents(filterZombie, source.getControllerId(), source.getSourceId(), game)) { zombie.moveToExile(source.getId(), zombie.getName(), source.getSourceId(), game); } for (Card human : player.getGraveyard().getCards(filterHuman, game)) { @@ -114,4 +114,4 @@ class AngelOfGlorysRiseEffect extends OneShotEffect { } return true; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DevastationTide.java b/Mage.Sets/src/mage/sets/avacynrestored/DevastationTide.java index 85c14e2e1c..8d3dd6878f 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/DevastationTide.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/DevastationTide.java @@ -27,9 +27,11 @@ */ package mage.sets.avacynrestored; -import mage.Constants; +import java.util.UUID; import mage.Constants.CardType; +import mage.Constants.Outcome; import mage.Constants.Rarity; +import mage.Constants.Zone; import mage.abilities.Ability; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; @@ -39,7 +41,6 @@ import mage.filter.common.FilterNonlandPermanent; import mage.game.Game; import mage.game.permanent.Permanent; -import java.util.UUID; /** * @@ -73,7 +74,7 @@ public class DevastationTide extends CardImpl { class DevastationTideEffect extends OneShotEffect { public DevastationTideEffect() { - super(Constants.Outcome.ReturnToHand); + super(Outcome.ReturnToHand); staticText = "Return all nonland permanents to their owners' hands"; } @@ -83,8 +84,8 @@ class DevastationTideEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterNonlandPermanent(), game)) { - creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true); + for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterNonlandPermanent(), source.getControllerId(), source.getSourceId(), game)) { + creature.moveToZone(Zone.HAND, source.getSourceId(), game, true); } return true; } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/AuraBarbs.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/AuraBarbs.java index 1ec26fc6dc..a048f2cd13 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/AuraBarbs.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/AuraBarbs.java @@ -83,7 +83,7 @@ public class AuraBarbs extends CardImpl { FilterPermanent filterEnchantments = new FilterPermanent(); filterEnchantments.add(new CardTypePredicate(CardType.ENCHANTMENT)); - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filterEnchantments, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) { Player controller = game.getPlayer(permanent.getControllerId()); if (controller != null) { controller.damage(2, permanent.getId(), game, false, true); @@ -92,7 +92,7 @@ public class AuraBarbs extends CardImpl { } filterEnchantments.add(new SubtypePredicate("Aura")); - for (Permanent auraEnchantment : game.getBattlefield().getAllActivePermanents(filterEnchantments, game)) { + for (Permanent auraEnchantment : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) { if (auraEnchantment.getAttachedTo() != null) { Permanent attachedToCreature = game.getPermanent(auraEnchantment.getAttachedTo()); if (attachedToCreature != null && attachedToCreature.getCardType().contains(CardType.CREATURE)) { diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/FinalJudgment.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/FinalJudgment.java index 3238e54994..483c051574 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/FinalJudgment.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/FinalJudgment.java @@ -84,7 +84,7 @@ class FinalJudgmentEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.moveToExile(null, null,source.getId(), game); } return true; diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheOrochi.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheOrochi.java index 6e7176874e..6b2548bd7b 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheOrochi.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheOrochi.java @@ -104,7 +104,7 @@ class PatronOfTheOrochiEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.untap(game); } return true; diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/ReduceToDreams.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ReduceToDreams.java index e1a33fd3c2..e88855b43d 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/ReduceToDreams.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ReduceToDreams.java @@ -87,7 +87,7 @@ class ReduceToDreamsEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true); } return true; diff --git a/Mage.Sets/src/mage/sets/conflux/WretchedBanquet.java b/Mage.Sets/src/mage/sets/conflux/WretchedBanquet.java index 03a7f82aa6..bc1f8b61f5 100644 --- a/Mage.Sets/src/mage/sets/conflux/WretchedBanquet.java +++ b/Mage.Sets/src/mage/sets/conflux/WretchedBanquet.java @@ -35,6 +35,7 @@ import mage.Constants.Rarity; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; @@ -85,7 +86,7 @@ class WretchedBanquetEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent targetCreature = game.getPermanent(source.getFirstTarget()); - List creatures = game.getBattlefield().getAllActivePermanents(CardType.CREATURE); + List creatures = game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game); int minPower = targetCreature.getPower().getValue() + 1; for (Permanent creature : creatures) { diff --git a/Mage.Sets/src/mage/sets/darksteel/Soulscour.java b/Mage.Sets/src/mage/sets/darksteel/Soulscour.java index ed487f156c..17217038d1 100644 --- a/Mage.Sets/src/mage/sets/darksteel/Soulscour.java +++ b/Mage.Sets/src/mage/sets/darksteel/Soulscour.java @@ -86,7 +86,7 @@ class SoulscourEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.destroy(source.getId(), game, false); } return true; diff --git a/Mage.Sets/src/mage/sets/fallenempires/Seasinger.java b/Mage.Sets/src/mage/sets/fallenempires/Seasinger.java index 28759f3715..fdae5dba6b 100644 --- a/Mage.Sets/src/mage/sets/fallenempires/Seasinger.java +++ b/Mage.Sets/src/mage/sets/fallenempires/Seasinger.java @@ -36,21 +36,20 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.StateTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.effects.common.SacrificeSourceEffect; -import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; import mage.abilities.common.SkipUntapOptionalAbility; import mage.abilities.condition.Condition; import mage.abilities.condition.common.ControlsPermanentCondition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.decorator.ConditionalContinousEffect; +import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.continious.GainControlTargetEffect; +import mage.cards.CardImpl; +import mage.filter.FilterPermanent; import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterLandPermanent; import mage.filter.predicate.Predicate; import mage.filter.predicate.mageobject.CardIdPredicate; -import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.GameEvent; @@ -110,14 +109,14 @@ public class Seasinger extends CardImpl { } class ControllerControlsIslandPredicate implements Predicate { + public static final FilterLandPermanent filter = new FilterLandPermanent("Island"); + { + filter.add(new SubtypePredicate("Island")); + } @Override public boolean apply(Permanent input, Game game) { - FilterLandPermanent islandControlledByTargetCreatureController = new FilterLandPermanent("Island"); - islandControlledByTargetCreatureController.add(new SubtypePredicate("Island")); - UUID controllerId = input.getControllerId(); - islandControlledByTargetCreatureController.add(new ControllerIdPredicate(controllerId)); - return !game.getBattlefield().getAllActivePermanents(islandControlledByTargetCreatureController, game).isEmpty(); + return (game.getBattlefield().countAll(filter, input.getControllerId(), game) > 0); } @Override @@ -143,12 +142,7 @@ class SeasingerTriggeredAbility extends StateTriggeredAbility { @Override public void adjustCosts(Ability ability, Game game) { - int creatureCount = game.getState().getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), game).size(); + int creatureCount = game.getState().getBattlefield().count(new FilterCreaturePermanent(), ability.getSourceId(), ability.getControllerId(), game); int cost = 8 - creatureCount; String adjustedCost = "{R}"; if (cost > 0) { diff --git a/Mage.Sets/src/mage/sets/magic2010/PlanarCleansing.java b/Mage.Sets/src/mage/sets/magic2010/PlanarCleansing.java index 3a8f6a01ef..23a9817e17 100644 --- a/Mage.Sets/src/mage/sets/magic2010/PlanarCleansing.java +++ b/Mage.Sets/src/mage/sets/magic2010/PlanarCleansing.java @@ -80,7 +80,7 @@ class PlanarCleansingEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.destroy(source.getId(), game, false); } return true; diff --git a/Mage.Sets/src/mage/sets/magic2010/TempestOfLight.java b/Mage.Sets/src/mage/sets/magic2010/TempestOfLight.java index 48acffaab0..6d0742b9fc 100644 --- a/Mage.Sets/src/mage/sets/magic2010/TempestOfLight.java +++ b/Mage.Sets/src/mage/sets/magic2010/TempestOfLight.java @@ -82,7 +82,7 @@ class TempestOfLightEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.destroy(source.getId(), game, false); } return true; diff --git a/Mage.Sets/src/mage/sets/magic2012/Scrambleverse.java b/Mage.Sets/src/mage/sets/magic2012/Scrambleverse.java index b64563c7df..5a992066a9 100644 --- a/Mage.Sets/src/mage/sets/magic2012/Scrambleverse.java +++ b/Mage.Sets/src/mage/sets/magic2012/Scrambleverse.java @@ -89,7 +89,7 @@ class ScrambleverseEffect extends OneShotEffect { int count = players.size(); if (count > 1) { FilterNonlandPermanent nonLand = new FilterNonlandPermanent(); - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(nonLand, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(nonLand, source.getControllerId(), source.getSourceId(), game)) { ContinuousEffect effect = new ScrambleverseControlEffect(players.get(random.nextInt(count))); effect.setTargetPointer(new FixedTarget(permanent.getId())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/sets/magic2013/PublicExecution.java b/Mage.Sets/src/mage/sets/magic2013/PublicExecution.java index f5995289bd..4b68b0904d 100644 --- a/Mage.Sets/src/mage/sets/magic2013/PublicExecution.java +++ b/Mage.Sets/src/mage/sets/magic2013/PublicExecution.java @@ -33,13 +33,16 @@ import mage.Constants.CardType; import mage.Constants.Rarity; import mage.Constants.TargetController; import mage.abilities.Ability; -import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DestroyTargetEffect; -import mage.abilities.effects.common.continious.BoostSourceEffect; +import mage.abilities.effects.common.continious.BoostAllEffect; import mage.cards.CardImpl; import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.filter.predicate.permanent.ControllerPredicate; +import mage.filter.predicate.permanent.PermanentIdPredicate; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; @@ -80,12 +83,6 @@ public class PublicExecution extends CardImpl { class PublicExecutionEffect extends OneShotEffect { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("each other creature an opponent controls"); - - static { - filter.add(new ControllerPredicate(TargetController.NOT_YOU)); - } - public PublicExecutionEffect() { super(Constants.Outcome.Benefit); staticText = "Each other creature that player controls gets -2/-0 until end of turn"; @@ -101,11 +98,11 @@ class PublicExecutionEffect extends OneShotEffect { if (target != null) { UUID opponent = target.getControllerId(); if (opponent != null) { - for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter, game)) { - if (creature != null && creature.getControllerId() == opponent && creature != target) { - creature.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostSourceEffect(-2, 0, Constants.Duration.EndOfTurn)), game); - } - } + FilterCreaturePermanent filter = new FilterCreaturePermanent("each other creature that player controls"); + filter.add(new ControllerIdPredicate(opponent)); + filter.add(Predicates.not(new PermanentIdPredicate(target.getId()))); + ContinuousEffect effect = new BoostAllEffect(-2,0, Constants.Duration.EndOfTurn, filter, false); + game.addEffect(effect, source); return true; } } @@ -116,4 +113,4 @@ class PublicExecutionEffect extends OneShotEffect { public PublicExecutionEffect copy() { return new PublicExecutionEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/magic2013/Worldfire.java b/Mage.Sets/src/mage/sets/magic2013/Worldfire.java index ad5e6c704c..fe3c3de4b7 100644 --- a/Mage.Sets/src/mage/sets/magic2013/Worldfire.java +++ b/Mage.Sets/src/mage/sets/magic2013/Worldfire.java @@ -86,7 +86,7 @@ class WorldfireEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.moveToExile(id, "all permanents", id, game); } for (UUID playerId : game.getPlayerList()) { diff --git a/Mage.Sets/src/mage/sets/planechase/AkromasVengeance.java b/Mage.Sets/src/mage/sets/planechase/AkromasVengeance.java index faf2a5ee37..2c449b3e82 100644 --- a/Mage.Sets/src/mage/sets/planechase/AkromasVengeance.java +++ b/Mage.Sets/src/mage/sets/planechase/AkromasVengeance.java @@ -89,7 +89,7 @@ class AkromasVengeanceEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.destroy(source.getId(), game, false); } return true; diff --git a/Mage.Sets/src/mage/sets/returntoravnica/CyclonicRift.java b/Mage.Sets/src/mage/sets/returntoravnica/CyclonicRift.java index 4d071cc66d..16b3953765 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/CyclonicRift.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/CyclonicRift.java @@ -96,7 +96,7 @@ class CyclonicRiftEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (!creature.getControllerId().equals(source.getControllerId())) { creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true); } diff --git a/Mage.Sets/src/mage/sets/returntoravnica/RakdosCharm.java b/Mage.Sets/src/mage/sets/returntoravnica/RakdosCharm.java index 1b6b5f8ec2..b6ec737c19 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/RakdosCharm.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/RakdosCharm.java @@ -102,7 +102,7 @@ public class RakdosCharm extends CardImpl { FilterPermanent filterEnchantments = new FilterPermanent(); filterEnchantments.add(new CardTypePredicate(CardType.CREATURE)); - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filterEnchantments, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) { Player controller = game.getPlayer(permanent.getControllerId()); if (controller != null) { controller.damage(1, permanent.getId(), game, false, true); diff --git a/Mage.Sets/src/mage/sets/returntoravnica/Teleportal.java b/Mage.Sets/src/mage/sets/returntoravnica/Teleportal.java index 1907427ceb..1422a4c362 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/Teleportal.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/Teleportal.java @@ -106,7 +106,7 @@ class TeleportalEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { UnblockableTargetEffect effect = new UnblockableTargetEffect(); effect.setTargetPointer(new FixedTarget(creature.getId())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/KhalniHydra.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KhalniHydra.java index 3bf9beaf41..46045bf038 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/KhalniHydra.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KhalniHydra.java @@ -77,13 +77,15 @@ public class KhalniHydra extends CardImpl { @Override public void adjustCosts(Ability ability, Game game) { super.adjustCosts(ability, game); - int reductionAmount = game.getBattlefield().getAllActivePermanents(filter, game).size(); + int reductionAmount = game.getBattlefield().count(filter, ability.getSourceId(), ability.getControllerId(), game); Iterator iter = ability.getManaCostsToPay().iterator(); while ( reductionAmount > 0 && iter.hasNext() ) { - iter.next(); - iter.remove(); - reductionAmount--; + ManaCost manaCost = iter.next(); + if (manaCost.getMana().getGreen() > 0) { // in case another effect adds additional mana cost + iter.remove(); + reductionAmount--; + } } } diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/SarkhanTheMad.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/SarkhanTheMad.java index 6cab4da2a6..7afe62e3de 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/SarkhanTheMad.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/SarkhanTheMad.java @@ -182,7 +182,7 @@ class SarkhanTheMadDragonDamageEffect extends OneShotEffect dragons = game.getBattlefield().getAllActivePermanents(filter, game); + List dragons = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); Player player = game.getPlayer(source.getTargets().getFirstTarget()); if ( player != null && dragons != null && !dragons.isEmpty() ) { for ( Permanent dragon : dragons ) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/PrecursorGolem.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/PrecursorGolem.java index e8804905ba..665599538d 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/PrecursorGolem.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/PrecursorGolem.java @@ -175,7 +175,7 @@ class PrecursorGolemCopySpellEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), game)) { + for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) { creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true); } return true; diff --git a/Mage.Sets/src/mage/sets/stronghold/IntruderAlarm.java b/Mage.Sets/src/mage/sets/stronghold/IntruderAlarm.java index 8037eebc1e..c8526ba200 100644 --- a/Mage.Sets/src/mage/sets/stronghold/IntruderAlarm.java +++ b/Mage.Sets/src/mage/sets/stronghold/IntruderAlarm.java @@ -174,7 +174,7 @@ class UntapAllCreatureEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - for (Permanent land: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), game)) { + for (Permanent land: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) { land.untap(game); } return true; diff --git a/Mage.Sets/src/mage/sets/tempest/Tranquility.java b/Mage.Sets/src/mage/sets/tempest/Tranquility.java index 2eb5bf28a7..45b938b09c 100644 --- a/Mage.Sets/src/mage/sets/tempest/Tranquility.java +++ b/Mage.Sets/src/mage/sets/tempest/Tranquility.java @@ -82,7 +82,7 @@ class TranquilityEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.destroy(source.getId(), game, false); } return true; diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/Rebuild.java b/Mage.Sets/src/mage/sets/urzaslegacy/Rebuild.java index da87ef9986..be0a8167ad 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/Rebuild.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/Rebuild.java @@ -80,7 +80,7 @@ class RebuildEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), game)) { + for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterArtifactPermanent(), source.getControllerId(), source.getSourceId(), game)) { creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true); } return true; diff --git a/Mage.Sets/src/mage/sets/urzassaga/AcidicSoil.java b/Mage.Sets/src/mage/sets/urzassaga/AcidicSoil.java index d8ad9d6f4b..b91951b8d1 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/AcidicSoil.java +++ b/Mage.Sets/src/mage/sets/urzassaga/AcidicSoil.java @@ -35,6 +35,7 @@ import mage.Constants.Rarity; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.filter.common.FilterLandPermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -77,8 +78,8 @@ class AcidicSoilEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - List permanents = game.getBattlefield().getAllActivePermanents(CardType.LAND); - for (UUID playerId : game.getPlayerList()) { + List permanents = game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), source.getSourceId(), game); + for (UUID playerId : game.getPlayer(source.getControllerId()).getInRange()) { Player player = game.getPlayer(playerId); if (player != null) { int amount = 0; diff --git a/Mage.Sets/src/mage/sets/urzassaga/Hibernation.java b/Mage.Sets/src/mage/sets/urzassaga/Hibernation.java index 3285f5e36e..0cc2b417a8 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/Hibernation.java +++ b/Mage.Sets/src/mage/sets/urzassaga/Hibernation.java @@ -85,7 +85,7 @@ class HibernationEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true); } return true; diff --git a/Mage.Sets/src/mage/sets/urzassaga/Hush.java b/Mage.Sets/src/mage/sets/urzassaga/Hush.java index 8359b19045..0643327c68 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/Hush.java +++ b/Mage.Sets/src/mage/sets/urzassaga/Hush.java @@ -85,7 +85,7 @@ class HushEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.destroy(source.getId(), game, false); } return true; diff --git a/Mage.Sets/src/mage/sets/worldwake/StoneIdolTrap.java b/Mage.Sets/src/mage/sets/worldwake/StoneIdolTrap.java index 8f6aede126..d7b343655a 100644 --- a/Mage.Sets/src/mage/sets/worldwake/StoneIdolTrap.java +++ b/Mage.Sets/src/mage/sets/worldwake/StoneIdolTrap.java @@ -103,7 +103,7 @@ class StoneIdolTrapCostReductionEffect extends CostModificationEffectImpl opponents = game.getOpponents(source.getControllerId()); - for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (opponents.contains(perm.getControllerId())) { objects.add(perm.getId()); } @@ -55,7 +55,7 @@ public class BoostOpponentsEffect extends ContinuousEffectImpl opponents = game.getOpponents(source.getControllerId()); - for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (!this.affectedObjectsSet || objects.contains(perm.getId())) { if (opponents.contains(perm.getControllerId())) { perm.addPower(power);