fix inverted filter check in BlocksCreatureTriggeredAbility
@@ -2,12 +2,12 @@ package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
-import mage.abilities.keyword.FlyingAbility;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
+import mage.util.CardUtil;
/**
* @author Hiddevb
@@ -17,8 +17,7 @@ public class BlocksCreatureTriggeredAbility extends TriggeredAbilityImpl {
private final FilterCreaturePermanent filter;
public BlocksCreatureTriggeredAbility(Effect effect, boolean optional) {
- super(Zone.BATTLEFIELD, effect, optional);
- this.filter = StaticFilters.FILTER_PERMANENT_CREATURE;
+ this(effect, StaticFilters.FILTER_PERMANENT_CREATURE, optional);
}
public BlocksCreatureTriggeredAbility(Effect effect, FilterCreaturePermanent filter, boolean optional) {
@@ -39,14 +38,12 @@ public class BlocksCreatureTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getSourceId().equals(this.getSourceId())
- && !filter.match(game.getPermanent(event.getSourceId()), game);
+ && filter.match(game.getPermanent(event.getTargetId()), getControllerId(), this, game);
}
@Override
public String getTriggerPhrase() {
- return "Whenever {this} blocks "
- + (filter.getMessage().startsWith("an ") ? "" : "a ")
- + filter.getMessage() + ", " ;
+ return "Whenever {this} blocks " + CardUtil.addArticle(filter.getMessage()) + ", ";
}
@Override
