From 4025b312ad54802d380c3b3c434b0ce10ef42f6f Mon Sep 17 00:00:00 2001 From: xenohedron Date: Sun, 2 Jun 2024 02:42:13 -0400 Subject: [PATCH] cleanup calls to respect range of influence --- Mage.Sets/src/mage/cards/a/AlphaStatus.java | 2 +- Mage.Sets/src/mage/cards/a/AminatouTheFateshifter.java | 2 +- Mage.Sets/src/mage/cards/a/ArmoryAutomaton.java | 6 +++--- Mage.Sets/src/mage/cards/b/Banishment.java | 2 +- Mage.Sets/src/mage/cards/b/BrunaLightOfAlabaster.java | 4 ++-- Mage.Sets/src/mage/cards/c/CommonCause.java | 2 +- Mage.Sets/src/mage/cards/c/CorneredMarket.java | 4 ++-- Mage.Sets/src/mage/cards/d/DeathbringerRegent.java | 2 +- Mage.Sets/src/mage/cards/d/Disarm.java | 2 +- Mage.Sets/src/mage/cards/f/FacesOfThePast.java | 4 ++-- Mage.Sets/src/mage/cards/g/GlobalRuin.java | 4 ++-- Mage.Sets/src/mage/cards/g/GreaterWerewolf.java | 2 +- Mage.Sets/src/mage/cards/j/JoragaInvocation.java | 2 +- Mage.Sets/src/mage/cards/m/MarchOfTheMachines.java | 2 +- Mage.Sets/src/mage/cards/m/Mirrorweave.java | 2 +- Mage.Sets/src/mage/cards/p/ParallelEvolution.java | 3 +-- Mage.Sets/src/mage/cards/p/PuppetsVerdict.java | 4 ++-- Mage.Sets/src/mage/cards/r/RhysTheRedeemed.java | 2 +- Mage.Sets/src/mage/cards/r/RootGreevil.java | 2 +- Mage.Sets/src/mage/cards/s/ScreamsFromWithin.java | 2 +- Mage.Sets/src/mage/cards/s/SeasonOfTheWitch.java | 2 +- Mage.Sets/src/mage/cards/s/StenchOfEvil.java | 2 +- Mage.Sets/src/mage/cards/t/TitaniasSong.java | 2 +- Mage.Sets/src/mage/cards/v/VisionCharm.java | 2 +- Mage.Sets/src/mage/cards/v/VulshokBattlemaster.java | 2 +- Mage.Sets/src/mage/cards/w/WardSliver.java | 3 +-- .../mage/abilities/dynamicvalue/common/CountersCount.java | 6 +++--- .../mage/abilities/effects/common/UntapLandsEffect.java | 2 +- .../mage/target/common/TargetTappedPermanentAsYouCast.java | 4 ++-- 29 files changed, 39 insertions(+), 41 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AlphaStatus.java b/Mage.Sets/src/mage/cards/a/AlphaStatus.java index d3c56679191..36f8a0db5af 100644 --- a/Mage.Sets/src/mage/cards/a/AlphaStatus.java +++ b/Mage.Sets/src/mage/cards/a/AlphaStatus.java @@ -59,7 +59,7 @@ class AlphaStatusDynamicValue implements DynamicValue { if (enchantment != null && enchantment.getAttachedTo() != null) { Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); if (enchanted != null) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, sourceAbility.getControllerId(), sourceAbility, game)) { if (!permanent.getId().equals(enchanted.getId())) { if (enchanted.shareCreatureTypes(game, permanent)) { xValue += 2; diff --git a/Mage.Sets/src/mage/cards/a/AminatouTheFateshifter.java b/Mage.Sets/src/mage/cards/a/AminatouTheFateshifter.java index 0c7d13496d3..ae9c55446d9 100644 --- a/Mage.Sets/src/mage/cards/a/AminatouTheFateshifter.java +++ b/Mage.Sets/src/mage/cards/a/AminatouTheFateshifter.java @@ -163,7 +163,7 @@ class AminatouUltimateEffect extends OneShotEffect { } FilterNonlandPermanent nextPlayerNonlandPermanentsFilter = new FilterNonlandPermanent(); nextPlayerNonlandPermanentsFilter.add(new ControllerIdPredicate(nextPlayer)); - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(nextPlayerNonlandPermanentsFilter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(nextPlayerNonlandPermanentsFilter, source.getControllerId(), source, game)) { if (permanent.getId().equals(source.getSourceId())) { continue; } diff --git a/Mage.Sets/src/mage/cards/a/ArmoryAutomaton.java b/Mage.Sets/src/mage/cards/a/ArmoryAutomaton.java index d335569fedb..c7487805f22 100644 --- a/Mage.Sets/src/mage/cards/a/ArmoryAutomaton.java +++ b/Mage.Sets/src/mage/cards/a/ArmoryAutomaton.java @@ -58,7 +58,7 @@ class ArmoryAutomatonEffect extends OneShotEffect { filter.add(SubType.EQUIPMENT.getPredicate()); } - public ArmoryAutomatonEffect() { + ArmoryAutomatonEffect() { super(Outcome.Benefit); this.staticText = "attach any number of target Equipment to it"; } @@ -84,7 +84,7 @@ class ArmoryAutomatonEffect extends OneShotEffect { filterSourceId.add(new CardIdPredicate(source.getSourceId())); currentFilter.add(Predicates.not(new AttachedToPredicate(filterSourceId))); - int countBattlefield = game.getBattlefield().getAllActivePermanents(currentFilter, game).size(); + int countBattlefield = game.getBattlefield().getActivePermanents(currentFilter, source.getControllerId(), source, game).size(); while (player.canRespond() && countBattlefield > 0 && player.chooseUse(Outcome.Benefit, "Select and attach a target Equipment?", source, game)) { Target targetEquipment = new TargetPermanent(currentFilter); targetEquipment.setRequired(false); @@ -102,7 +102,7 @@ class ArmoryAutomatonEffect extends OneShotEffect { } else { break; } - countBattlefield = game.getBattlefield().getAllActivePermanents(currentFilter, game).size(); + countBattlefield = game.getBattlefield().getActivePermanents(currentFilter, source.getControllerId(), source, game).size(); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/Banishment.java b/Mage.Sets/src/mage/cards/b/Banishment.java index 53055c83af4..9e0695d1dd5 100644 --- a/Mage.Sets/src/mage/cards/b/Banishment.java +++ b/Mage.Sets/src/mage/cards/b/Banishment.java @@ -87,7 +87,7 @@ class BanishmentEffect extends OneShotEffect { FilterPermanent filter = new FilterNonlandPermanent(); filter.add(new NamePredicate(targeted.getName())); - Set toExile = game.getBattlefield().getAllActivePermanents(filter, game) + Set toExile = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game) .stream().filter(p -> controller.hasOpponent(p.getControllerId(),game)) .collect(Collectors.toCollection(LinkedHashSet::new)); diff --git a/Mage.Sets/src/mage/cards/b/BrunaLightOfAlabaster.java b/Mage.Sets/src/mage/cards/b/BrunaLightOfAlabaster.java index dd32008ac29..3d1ed50412e 100644 --- a/Mage.Sets/src/mage/cards/b/BrunaLightOfAlabaster.java +++ b/Mage.Sets/src/mage/cards/b/BrunaLightOfAlabaster.java @@ -100,7 +100,7 @@ class BrunaLightOfAlabasterEffect extends OneShotEffect { List fromBattlefield = new ArrayList<>(); List fromHandGraveyard = new ArrayList<>(); - int countBattlefield = game.getBattlefield().getAllActivePermanents(filterAura, game).size() - sourcePermanent.getAttachments().size(); + int countBattlefield = game.getBattlefield().getActivePermanents(filterAura, source.getControllerId(), source, game).size() - sourcePermanent.getAttachments().size(); while (controller.canRespond() && countBattlefield > 0 && controller.chooseUse(Outcome.Benefit, "Attach an Aura from the battlefield?", source, game)) { @@ -117,7 +117,7 @@ class BrunaLightOfAlabasterEffect extends OneShotEffect { fromBattlefield.add(aura); filterAura.add(Predicates.not(new CardIdPredicate(aura.getId()))); - countBattlefield = game.getBattlefield().getAllActivePermanents(filterAura, game).size() - sourcePermanent.getAttachments().size(); + countBattlefield = game.getBattlefield().getActivePermanents(filterAura, source.getControllerId(), source, game).size() - sourcePermanent.getAttachments().size(); } int countHand = controller.getHand().count(filterAuraCard, game); diff --git a/Mage.Sets/src/mage/cards/c/CommonCause.java b/Mage.Sets/src/mage/cards/c/CommonCause.java index 0d29bc22199..79795401de5 100644 --- a/Mage.Sets/src/mage/cards/c/CommonCause.java +++ b/Mage.Sets/src/mage/cards/c/CommonCause.java @@ -58,7 +58,7 @@ enum AllColorCondition implements Condition { FilterCreaturePermanent filter = new FilterCreaturePermanent("Nonartifact creatures"); filter.add(Predicates.not(CardType.ARTIFACT.getPredicate())); ObjectColor allColor = new ObjectColor("WUBRG"); - for (Permanent thing : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent thing : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { allColor = allColor.intersection(thing.getColor(game)); } return !allColor.isColorless(); diff --git a/Mage.Sets/src/mage/cards/c/CorneredMarket.java b/Mage.Sets/src/mage/cards/c/CorneredMarket.java index 72c7679c0ce..5f1f66791fc 100644 --- a/Mage.Sets/src/mage/cards/c/CorneredMarket.java +++ b/Mage.Sets/src/mage/cards/c/CorneredMarket.java @@ -87,7 +87,7 @@ class CorneredMarketReplacementEffect extends ContinuousRuleModifyingEffectImpl // play land check if (card.isLand(game) && !card.isBasic(game)) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { if (permanent != null) { if (CardUtil.haveSameNames(card, permanent.getName(), game)) { return true; @@ -98,7 +98,7 @@ class CorneredMarketReplacementEffect extends ContinuousRuleModifyingEffectImpl } // cast spell check if (spell != null) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { if (permanent != null) { if (CardUtil.haveSameNames(card, permanent.getName(), game)) { return true; diff --git a/Mage.Sets/src/mage/cards/d/DeathbringerRegent.java b/Mage.Sets/src/mage/cards/d/DeathbringerRegent.java index 7a627b3c6ce..53052971d2c 100644 --- a/Mage.Sets/src/mage/cards/d/DeathbringerRegent.java +++ b/Mage.Sets/src/mage/cards/d/DeathbringerRegent.java @@ -64,6 +64,6 @@ class DeathbringerRegentCondition implements Condition { @Override public boolean apply(Game game, Ability source) { return CastFromHandSourcePermanentCondition.instance.apply(game, source) - && game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, game).size() >= 6; + && game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source, game).size() >= 6; } } diff --git a/Mage.Sets/src/mage/cards/d/Disarm.java b/Mage.Sets/src/mage/cards/d/Disarm.java index 4c683f26764..2fa62c3e986 100644 --- a/Mage.Sets/src/mage/cards/d/Disarm.java +++ b/Mage.Sets/src/mage/cards/d/Disarm.java @@ -67,7 +67,7 @@ class DisarmEffect extends OneShotEffect { equipmentFilter.add(new AttachedToPredicate(creatureFilter)); equipmentFilter.add(SubType.EQUIPMENT.getPredicate()); - for (Permanent equipment : game.getBattlefield().getAllActivePermanents(equipmentFilter, game)) { + for (Permanent equipment : game.getBattlefield().getActivePermanents(equipmentFilter, source.getControllerId(), source, game)) { creature.removeAttachment(equipment.getId(), source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/f/FacesOfThePast.java b/Mage.Sets/src/mage/cards/f/FacesOfThePast.java index d24055e7788..d89e4e68ce3 100644 --- a/Mage.Sets/src/mage/cards/f/FacesOfThePast.java +++ b/Mage.Sets/src/mage/cards/f/FacesOfThePast.java @@ -61,13 +61,13 @@ class FacesOfThePastEffect extends OneShotEffect { Player controller = game.getPlayer(targetPermanent.getControllerId()); if (controller != null) { if (controller.chooseUse(outcome, "Tap all untapped creatures that share a creature type with " + targetPermanent.getLogName() + "? (Otherwise, untaps all tapped)", source, game)) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source, game)) { if (!permanent.isTapped() && targetPermanent.shareCreatureTypes(game, permanent)) { permanent.tap(source, game); } } } else { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source, game)) { if (permanent.isTapped() && targetPermanent.shareCreatureTypes(game, permanent)) { permanent.untap(game); } diff --git a/Mage.Sets/src/mage/cards/g/GlobalRuin.java b/Mage.Sets/src/mage/cards/g/GlobalRuin.java index 4a41e9eaf9c..b7f7084ab97 100644 --- a/Mage.Sets/src/mage/cards/g/GlobalRuin.java +++ b/Mage.Sets/src/mage/cards/g/GlobalRuin.java @@ -65,7 +65,7 @@ class GlobalRuinDestroyLandEffect extends OneShotEffect { Set lands = new HashSet<>(); for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); - if(player != null) { + if (player != null) { for (SubType landName : Arrays.stream(SubType.values()).filter(p -> p.getSubTypeSet() == SubTypeSet.BasicLandType).collect(Collectors.toSet())) { FilterControlledLandPermanent filter = new FilterControlledLandPermanent(landName + " you control"); filter.add(landName.getPredicate()); @@ -77,7 +77,7 @@ class GlobalRuinDestroyLandEffect extends OneShotEffect { } } } - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_LAND, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), source, game)) { if (!lands.contains(permanent.getId())) { permanent.sacrifice(source, game); } diff --git a/Mage.Sets/src/mage/cards/g/GreaterWerewolf.java b/Mage.Sets/src/mage/cards/g/GreaterWerewolf.java index d8bcf08945a..881a8d01c87 100644 --- a/Mage.Sets/src/mage/cards/g/GreaterWerewolf.java +++ b/Mage.Sets/src/mage/cards/g/GreaterWerewolf.java @@ -70,7 +70,7 @@ class GreaterWerewolfEffect extends OneShotEffect { if (sourcePermanent != null) { FilterCreaturePermanent filter = new FilterCreaturePermanent(); filter.add(Predicates.or(new BlockedByIdPredicate(sourcePermanent.getId()), new BlockingAttackerIdPredicate(sourcePermanent.getId()))); - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { Effect effect = new AddCountersTargetEffect(CounterType.M0M2.createInstance(), Outcome.UnboostCreature); effect.setTargetPointer(new FixedTarget(permanent, game)); effect.apply(game, source); diff --git a/Mage.Sets/src/mage/cards/j/JoragaInvocation.java b/Mage.Sets/src/mage/cards/j/JoragaInvocation.java index d788bd90223..9c528fee3af 100644 --- a/Mage.Sets/src/mage/cards/j/JoragaInvocation.java +++ b/Mage.Sets/src/mage/cards/j/JoragaInvocation.java @@ -63,7 +63,7 @@ class JoragaInvocationEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source, game)) { ContinuousEffect effect = new MustBeBlockedByAtLeastOneTargetEffect(); effect.setTargetPointer(new FixedTarget(permanent, game)); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/m/MarchOfTheMachines.java b/Mage.Sets/src/mage/cards/m/MarchOfTheMachines.java index 44f5d5c02ea..7bf7233ac8b 100644 --- a/Mage.Sets/src/mage/cards/m/MarchOfTheMachines.java +++ b/Mage.Sets/src/mage/cards/m/MarchOfTheMachines.java @@ -67,7 +67,7 @@ class MarchOfTheMachinesEffect extends ContinuousEffectImpl { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { affectedObjectList.clear(); - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { if (permanent != null) { affectedObjectList.add(new MageObjectReference(permanent, game)); permanent.addCardType(game, CardType.CREATURE); diff --git a/Mage.Sets/src/mage/cards/m/Mirrorweave.java b/Mage.Sets/src/mage/cards/m/Mirrorweave.java index fc1d5e5f629..7b1d5e8da1b 100644 --- a/Mage.Sets/src/mage/cards/m/Mirrorweave.java +++ b/Mage.Sets/src/mage/cards/m/Mirrorweave.java @@ -75,7 +75,7 @@ class MirrorWeaveEffect extends OneShotEffect { Permanent copyFromCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source); if (copyFromCreature != null) { filter.add(Predicates.not(new PermanentIdPredicate(copyFromCreature.getId()))); - for (Permanent copyToCreature : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent copyToCreature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { if (copyToCreature != null) { game.copyPermanent(Duration.EndOfTurn, copyFromCreature, copyToCreature.getId(), source, new EmptyCopyApplier()); } diff --git a/Mage.Sets/src/mage/cards/p/ParallelEvolution.java b/Mage.Sets/src/mage/cards/p/ParallelEvolution.java index 345adec2f18..277fcb80df8 100644 --- a/Mage.Sets/src/mage/cards/p/ParallelEvolution.java +++ b/Mage.Sets/src/mage/cards/p/ParallelEvolution.java @@ -11,7 +11,6 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; -import mage.constants.TimingRule; import mage.filter.FilterPermanent; import mage.filter.predicate.permanent.TokenPredicate; import mage.game.Game; @@ -69,7 +68,7 @@ class ParallelEvolutionEffect 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, game)) { CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(permanent.getControllerId()); effect.setTargetPointer(new FixedTarget(permanent, game)); effect.apply(game, source); diff --git a/Mage.Sets/src/mage/cards/p/PuppetsVerdict.java b/Mage.Sets/src/mage/cards/p/PuppetsVerdict.java index 40541f845c0..15e44f84d62 100644 --- a/Mage.Sets/src/mage/cards/p/PuppetsVerdict.java +++ b/Mage.Sets/src/mage/cards/p/PuppetsVerdict.java @@ -58,14 +58,14 @@ class PuppetsVerdictEffect extends OneShotEffect { FilterCreaturePermanent filterPower2OrLess = new FilterCreaturePermanent("all creatures power 2 or less"); filterPower2OrLess.add(new PowerPredicate(ComparisonType.FEWER_THAN, 3)); - for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filterPower2OrLess, game)) { + for (Permanent permanent: game.getBattlefield().getActivePermanents(filterPower2OrLess, source.getControllerId(), source, game)) { permanent.destroy(source, game, false); } return true; } else { FilterCreaturePermanent filterPower3OrGreater = new FilterCreaturePermanent("all creatures power 3 or greater"); filterPower3OrGreater.add(new PowerPredicate(ComparisonType.MORE_THAN, 2)); - for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filterPower3OrGreater, game)) { + for (Permanent permanent: game.getBattlefield().getActivePermanents(filterPower3OrGreater, source.getControllerId(), source, game)) { permanent.destroy(source, game, false); } return true; diff --git a/Mage.Sets/src/mage/cards/r/RhysTheRedeemed.java b/Mage.Sets/src/mage/cards/r/RhysTheRedeemed.java index 813dc840b28..c729359f8e3 100644 --- a/Mage.Sets/src/mage/cards/r/RhysTheRedeemed.java +++ b/Mage.Sets/src/mage/cards/r/RhysTheRedeemed.java @@ -89,7 +89,7 @@ class RhysTheRedeemedEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { if (permanent.isControlledBy(source.getControllerId())) { CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(); effect.setTargetPointer(new FixedTarget(permanent, game)); diff --git a/Mage.Sets/src/mage/cards/r/RootGreevil.java b/Mage.Sets/src/mage/cards/r/RootGreevil.java index a4a47d4763d..cb48a78c633 100644 --- a/Mage.Sets/src/mage/cards/r/RootGreevil.java +++ b/Mage.Sets/src/mage/cards/r/RootGreevil.java @@ -73,7 +73,7 @@ public final class RootGreevil extends CardImpl { if (controller != null && controller.choose(Outcome.DestroyPermanent, choice, game)) { FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent(); filter.add(new ColorPredicate(choice.getColor())); - for (Permanent enchantment : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent enchantment : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { enchantment.destroy(source, game, false); } return true; diff --git a/Mage.Sets/src/mage/cards/s/ScreamsFromWithin.java b/Mage.Sets/src/mage/cards/s/ScreamsFromWithin.java index b7afb4433ed..af7f919633b 100644 --- a/Mage.Sets/src/mage/cards/s/ScreamsFromWithin.java +++ b/Mage.Sets/src/mage/cards/s/ScreamsFromWithin.java @@ -75,7 +75,7 @@ class ScreamsFromWithinEffect extends OneShotEffect { Card aura = game.getCard(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); if (aura != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD && player != null && player.getGraveyard().contains(source.getSourceId())) { - for (Permanent creaturePermanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, game)) { + for (Permanent creaturePermanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source, game)) { for (Target target : aura.getSpellAbility().getTargets()) { if (target.canTarget(creaturePermanent.getId(), game)) { return player.moveCards(aura, Zone.BATTLEFIELD, source, game); diff --git a/Mage.Sets/src/mage/cards/s/SeasonOfTheWitch.java b/Mage.Sets/src/mage/cards/s/SeasonOfTheWitch.java index b047f23b55a..f4800d395d3 100644 --- a/Mage.Sets/src/mage/cards/s/SeasonOfTheWitch.java +++ b/Mage.Sets/src/mage/cards/s/SeasonOfTheWitch.java @@ -77,7 +77,7 @@ class SeasonOfTheWitchEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player activePlayer = game.getPlayer(game.getActivePlayerId()); if (activePlayer != null) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source, game)) { // Noncreature cards are safe. if (!permanent.isCreature(game)) { continue; diff --git a/Mage.Sets/src/mage/cards/s/StenchOfEvil.java b/Mage.Sets/src/mage/cards/s/StenchOfEvil.java index c371eb99217..2c5226e201d 100644 --- a/Mage.Sets/src/mage/cards/s/StenchOfEvil.java +++ b/Mage.Sets/src/mage/cards/s/StenchOfEvil.java @@ -63,7 +63,7 @@ class StenchOfEvilEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent land : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent land : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { UUID landControllerId = land.getControllerId(); if (land.destroy(source, game, false)) { Cost cost = new ManaCostsImpl<>("{2}"); diff --git a/Mage.Sets/src/mage/cards/t/TitaniasSong.java b/Mage.Sets/src/mage/cards/t/TitaniasSong.java index c32368596cb..ab1f6455c30 100644 --- a/Mage.Sets/src/mage/cards/t/TitaniasSong.java +++ b/Mage.Sets/src/mage/cards/t/TitaniasSong.java @@ -73,7 +73,7 @@ class TitaniasSongEffect extends ContinuousEffectImpl { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { affectedObjectList.clear(); - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { if (permanent != null) { affectedObjectList.add(new MageObjectReference(permanent, game)); permanent.addCardType(game, CardType.CREATURE); diff --git a/Mage.Sets/src/mage/cards/v/VisionCharm.java b/Mage.Sets/src/mage/cards/v/VisionCharm.java index ae759f5b79b..281275ee27e 100644 --- a/Mage.Sets/src/mage/cards/v/VisionCharm.java +++ b/Mage.Sets/src/mage/cards/v/VisionCharm.java @@ -104,7 +104,7 @@ class VisionCharmEffect extends ContinuousEffectImpl { FilterPermanent filter = new FilterLandPermanent(); filter.add(SubType.byDescription(targetLandType).getPredicate()); if (getAffectedObjectsSet()) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { affectedObjectList.add(new MageObjectReference(permanent, game)); } } diff --git a/Mage.Sets/src/mage/cards/v/VulshokBattlemaster.java b/Mage.Sets/src/mage/cards/v/VulshokBattlemaster.java index ff63b0753b8..7d6ccd31a0b 100644 --- a/Mage.Sets/src/mage/cards/v/VulshokBattlemaster.java +++ b/Mage.Sets/src/mage/cards/v/VulshokBattlemaster.java @@ -65,7 +65,7 @@ public final class VulshokBattlemaster extends CardImpl { if (battlemaster != null) { FilterPermanent filter = new FilterPermanent(); filter.add(SubType.EQUIPMENT.getPredicate()); - for (Permanent equipment : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent equipment : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) { if (equipment != null) { //If an Equipment can't equip Vulshok Battlemaster, it isn't attached to the Battlemaster, and it doesn't become unattached (if it's attached to a creature). (https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=48125) if (!battlemaster.cantBeAttachedBy(equipment, source, game, false)) { diff --git a/Mage.Sets/src/mage/cards/w/WardSliver.java b/Mage.Sets/src/mage/cards/w/WardSliver.java index 8354967ef26..59ce823dbc4 100644 --- a/Mage.Sets/src/mage/cards/w/WardSliver.java +++ b/Mage.Sets/src/mage/cards/w/WardSliver.java @@ -17,7 +17,6 @@ import mage.constants.*; import mage.filter.FilterObject; import mage.filter.FilterPermanent; import mage.filter.StaticFilters; -import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.permanent.Permanent; @@ -89,7 +88,7 @@ class WardSliverGainAbilityControlledEffect extends ContinuousEffectImpl { } } if (protectionFilter != null) { - for (Permanent perm: game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_ALL_SLIVERS, game)) { + for (Permanent perm: game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_ALL_SLIVERS, source.getControllerId(), source, game)) { perm.addAbility(new ProtectionAbility(protectionFilter), source.getSourceId(), game); } return true; diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersCount.java index df5a55ce0cf..5e56e7e5f29 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersCount.java @@ -14,8 +14,8 @@ import mage.game.permanent.Permanent; */ public class CountersCount implements DynamicValue { - private CounterType counter; - private FilterPermanent filter; + private final CounterType counter; + private final FilterPermanent filter; public CountersCount(CounterType counterType) { this(counterType, new FilterPermanent()); @@ -34,7 +34,7 @@ public class CountersCount implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, sourceAbility.getControllerId(), sourceAbility, game)) { count += permanent.getCounters(game).getCount(counter); } return count; diff --git a/Mage/src/main/java/mage/abilities/effects/common/UntapLandsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/UntapLandsEffect.java index 4b7e930dc14..376e33c0203 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/UntapLandsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/UntapLandsEffect.java @@ -63,7 +63,7 @@ public class UntapLandsEffect extends OneShotEffect { if (upTo) { tappedLands = game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game).size(); } else { - tappedLands = game.getBattlefield().getAllActivePermanents(filter, game).size(); + tappedLands = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game).size(); } TargetLandPermanent target = new TargetLandPermanent(upTo ? 0 : Math.min(tappedLands, amount), amount, filter, true); if (target.canChoose(source.getControllerId(), source, game)) { diff --git a/Mage/src/main/java/mage/target/common/TargetTappedPermanentAsYouCast.java b/Mage/src/main/java/mage/target/common/TargetTappedPermanentAsYouCast.java index cef004cf5d1..539b477fac9 100644 --- a/Mage/src/main/java/mage/target/common/TargetTappedPermanentAsYouCast.java +++ b/Mage/src/main/java/mage/target/common/TargetTappedPermanentAsYouCast.java @@ -30,7 +30,7 @@ public class TargetTappedPermanentAsYouCast extends TargetPermanent { @Override public Set possibleTargets(UUID sourceControllerId, Ability source, Game game) { - return game.getBattlefield().getAllActivePermanents(getFilter(), game).stream() + return game.getBattlefield().getActivePermanents(getFilter(), source.getControllerId(), source, game).stream() .filter(Permanent::isTapped) .map(Permanent::getId) .collect(Collectors.toSet()); @@ -38,7 +38,7 @@ public class TargetTappedPermanentAsYouCast extends TargetPermanent { @Override public boolean canChoose(UUID sourceControllerId, Ability source, Game game) { - return game.getBattlefield().getAllActivePermanents(getFilter(), game).stream() + return game.getBattlefield().getActivePermanents(getFilter(), source.getControllerId(), source, game).stream() .anyMatch(Permanent::isTapped); }