Fixed possible static filter manipulation.

This commit is contained in:
LevelX2 2018-06-21 22:33:02 +02:00
parent a46c70bd68
commit 083d4cee6d
4 changed files with 10 additions and 16 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.m;
import java.util.UUID;
@ -7,7 +6,7 @@ import mage.abilities.effects.common.TapAllTargetPlayerControlsEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.common.FilterLandPermanent;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
@ -39,7 +38,7 @@ public final class ManaShort extends CardImpl {
class ManaShortEffect extends TapAllTargetPlayerControlsEffect {
public ManaShortEffect() {
super(new FilterLandPermanent());
super(StaticFilters.FILTER_LANDS);
staticText = "Tap all lands target player controls and that player loses all unspent mana";
}

View file

@ -1,4 +1,3 @@
package mage.cards.t;
import java.util.UUID;
@ -10,7 +9,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent;
import static mage.filter.StaticFilters.FILTER_PERMANENT_CREATURES;
import mage.target.common.TargetOpponent;
/**
@ -28,7 +27,7 @@ public final class TempestCaller extends CardImpl {
this.toughness = new MageInt(3);
// When Tempest Caller enters the battlefield, tap all creatures target opponent controls.
Ability ability = new EntersBattlefieldTriggeredAbility(new TapAllTargetPlayerControlsEffect(new FilterCreaturePermanent("creatures")));
Ability ability = new EntersBattlefieldTriggeredAbility(new TapAllTargetPlayerControlsEffect(FILTER_PERMANENT_CREATURES));
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}

View file

@ -1,4 +1,3 @@
package mage.cards.t;
import java.util.UUID;
@ -15,11 +14,11 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import static mage.filter.StaticFilters.FILTER_PERMANENT_CREATURES;
import mage.game.Game;
import mage.players.Player;
@ -30,7 +29,7 @@ import mage.players.Player;
public final class TorrentElemental extends CardImpl {
public TorrentElemental(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{U}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}");
this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(3);
this.toughness = new MageInt(5);
@ -38,7 +37,7 @@ public final class TorrentElemental extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Torrent Elemental attacks, tap all creatures defending player controls.
Effect effect = new TapAllTargetPlayerControlsEffect(new FilterCreaturePermanent());
Effect effect = new TapAllTargetPlayerControlsEffect(FILTER_PERMANENT_CREATURES);
effect.setText("tap all creatures defending player controls.");
this.addAbility(new AttacksTriggeredAbility(effect, false, null, SetTargetPointer.PLAYER));
// {3}{B/G}{B/G}: Put Torrent Elemental from exile onto the battlefield tapped. Activate this ability only any time you could cast a sorcery.

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common;
import java.util.List;
@ -7,7 +6,6 @@ import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -18,7 +16,7 @@ import mage.players.Player;
*/
public class TapAllTargetPlayerControlsEffect extends OneShotEffect {
private FilterPermanent filter;
private final FilterPermanent filter;
public TapAllTargetPlayerControlsEffect(FilterPermanent filter) {
super(Outcome.Tap);
@ -34,8 +32,7 @@ public class TapAllTargetPlayerControlsEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
if (player != null) {
filter.add(new ControllerIdPredicate(player.getId()));
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game);
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, player.getId(), game);
for (Permanent p : permanents) {
p.tap(game);
}