Changed used battlefield.count or battlefield.getActivePermanents methods to take player range into account.

This commit is contained in:
LevelX2 2013-02-13 01:24:36 +01:00
parent efe277621e
commit 127e63ce0d
33 changed files with 80 additions and 82 deletions

View file

@ -92,7 +92,7 @@ class DesolationAngelEntersBattlefieldEffect extends OneShotEffect<DesolationAng
public boolean apply(Game game, Ability source) {
Card p = game.getCard(source.getSourceId());
boolean kicked = KickedCondition.getInstance().apply(game, source);
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterLandPermanent(),game)) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), source.getSourceId(), game)) {
if ((!kicked && permanent.getControllerId() == source.getControllerId())
|| kicked) {
permanent.destroy(source.getSourceId(), game, false);

View file

@ -28,9 +28,8 @@
package mage.sets.apocalypse;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -51,7 +50,10 @@ public class TranquilPath extends CardImpl<TranquilPath> {
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<TranquilPathEffect> {
}
public TranquilPathEffect() {
super(Constants.Outcome.DestroyPermanent);
super(Outcome.DestroyPermanent);
staticText = "Destroy all enchantments";
}
@ -84,7 +86,7 @@ class TranquilPathEffect extends OneShotEffect<TranquilPathEffect> {
@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<TranquilPathEffect> {
return new TranquilPathEffect(this);
}
}
}

View file

@ -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<AngelOfGlorysRiseEffect> {
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<AngelOfGlorysRiseEffect> {
}
return true;
}
}
}

View file

@ -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<DevastationTide> {
class DevastationTideEffect extends OneShotEffect<DevastationTideEffect> {
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<DevastationTideEffect> {
@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;
}

View file

@ -83,7 +83,7 @@ public class AuraBarbs extends CardImpl<AuraBarbs> {
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<AuraBarbs> {
}
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)) {

View file

@ -84,7 +84,7 @@ class FinalJudgmentEffect extends OneShotEffect<FinalJudgmentEffect> {
@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;

View file

@ -104,7 +104,7 @@ class PatronOfTheOrochiEffect extends OneShotEffect<PatronOfTheOrochiEffect> {
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;

View file

@ -87,7 +87,7 @@ class ReduceToDreamsEffect extends OneShotEffect<ReduceToDreamsEffect> {
@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;

View file

@ -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<WretchedBanquetEffect> {
@Override
public boolean apply(Game game, Ability source) {
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(CardType.CREATURE);
List<Permanent> creatures = game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game);
int minPower = targetCreature.getPower().getValue() + 1;
for (Permanent creature : creatures) {

View file

@ -86,7 +86,7 @@ class SoulscourEffect extends OneShotEffect<SoulscourEffect> {
@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;

View file

@ -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<Seasinger> {
}
class ControllerControlsIslandPredicate implements Predicate<Permanent> {
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<SeasingerTriggered
@Override
public boolean checkTrigger(GameEvent event, Game game) {
for (Permanent perm : game.getBattlefield().getAllActivePermanents(controllerId)) {
if (perm.getSubtype().contains("Island")) {
return false;
}
}
return true;
return (game.getBattlefield().countAll(ControllerControlsIslandPredicate.filter, controllerId, game) == 0);
}
@Override

View file

@ -27,6 +27,8 @@
*/
package mage.sets.innistrad;
import java.util.List;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
@ -37,8 +39,6 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.List;
import java.util.UUID;
/**
* @author nantuko
@ -59,7 +59,7 @@ public class BlasphemousAct extends CardImpl<BlasphemousAct> {
@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) {

View file

@ -80,7 +80,7 @@ class PlanarCleansingEffect extends OneShotEffect<PlanarCleansingEffect> {
@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;

View file

@ -82,7 +82,7 @@ class TempestOfLightEffect extends OneShotEffect<TempestOfLightEffect> {
@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;

View file

@ -89,7 +89,7 @@ class ScrambleverseEffect extends OneShotEffect<ScrambleverseEffect> {
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);

View file

@ -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<PublicExecution> {
class PublicExecutionEffect extends OneShotEffect<PublicExecutionEffect> {
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<PublicExecutionEffect> {
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<PublicExecutionEffect> {
public PublicExecutionEffect copy() {
return new PublicExecutionEffect(this);
}
}
}

View file

@ -86,7 +86,7 @@ class WorldfireEffect extends OneShotEffect<WorldfireEffect> {
@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()) {

View file

@ -89,7 +89,7 @@ class AkromasVengeanceEffect extends OneShotEffect<AkromasVengeanceEffect> {
@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;

View file

@ -96,7 +96,7 @@ class CyclonicRiftEffect extends OneShotEffect<CyclonicRiftEffect> {
@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);
}

View file

@ -102,7 +102,7 @@ public class RakdosCharm extends CardImpl<RakdosCharm> {
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);

View file

@ -106,7 +106,7 @@ class TeleportalEffect extends OneShotEffect<TeleportalEffect> {
@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);

View file

@ -77,13 +77,15 @@ public class KhalniHydra extends CardImpl<KhalniHydra> {
@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<ManaCost> 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--;
}
}
}

View file

@ -182,7 +182,7 @@ class SarkhanTheMadDragonDamageEffect extends OneShotEffect<SarkhanTheMadDragonD
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> dragons = game.getBattlefield().getAllActivePermanents(filter, game);
List<Permanent> 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 ) {

View file

@ -175,7 +175,7 @@ class PrecursorGolemCopySpellEffect extends OneShotEffect<PrecursorGolemCopySpel
if (spell != null) {
SpellAbility sa = spell.getSpellAbility();
UUID targetedGolem = (UUID) getValue("targetedGolem");
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filterGolem, game)) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterGolem, source.getControllerId(), source.getSourceId(), game)) {
if (permanent.getId().equals(targetedGolem)) {
continue; // copy only for other golems
}

View file

@ -80,7 +80,7 @@ class EvacuationEffect extends OneShotEffect<EvacuationEffect> {
@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;

View file

@ -174,7 +174,7 @@ class UntapAllCreatureEffect extends OneShotEffect<UntapAllCreatureEffect> {
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;

View file

@ -82,7 +82,7 @@ class TranquilityEffect extends OneShotEffect<TranquilityEffect> {
@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;

View file

@ -80,7 +80,7 @@ class RebuildEffect extends OneShotEffect<RebuildEffect> {
@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;

View file

@ -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<AcidicSoilEffect> {
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(CardType.LAND);
for (UUID playerId : game.getPlayerList()) {
List<Permanent> 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;

View file

@ -85,7 +85,7 @@ class HibernationEffect extends OneShotEffect<HibernationEffect> {
@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;

View file

@ -85,7 +85,7 @@ class HushEffect extends OneShotEffect<HushEffect> {
@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;

View file

@ -103,7 +103,7 @@ class StoneIdolTrapCostReductionEffect extends CostModificationEffectImpl<StoneI
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
int reductionAmount = game.getBattlefield().getAllActivePermanents(filter, game).size();
int reductionAmount = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(),game);
CardUtil.adjustCost(abilityToModify, reductionAmount);
return true;
}

View file

@ -44,7 +44,7 @@ public class BoostOpponentsEffect extends ContinuousEffectImpl<BoostOpponentsEff
super.init(source, game);
if (this.affectedObjectsSet) {
Set<UUID> 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<BoostOpponentsEff
@Override
public boolean apply(Game game, Ability source) {
Set<UUID> 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);