diff --git a/Mage.Sets/src/mage/cards/s/SnowFortress.java b/Mage.Sets/src/mage/cards/s/SnowFortress.java index 7ec925286b..1d58404c88 100644 --- a/Mage.Sets/src/mage/cards/s/SnowFortress.java +++ b/Mage.Sets/src/mage/cards/s/SnowFortress.java @@ -42,12 +42,10 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterAttackingCreature; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.AbilityPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.target.common.TargetCreatureOrPlayer; +import mage.target.common.FilterCreatureAttackingYou; +import mage.target.common.TargetCreaturePermanent; /** * @@ -55,7 +53,7 @@ import mage.target.common.TargetCreatureOrPlayer; */ public class SnowFortress extends CardImpl { - private static final SnowFortressFilter filter = new SnowFortressFilter(); + private static final FilterCreatureAttackingYou filter = new FilterCreatureAttackingYou("creature without flying that's attacking you"); static { filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); @@ -79,7 +77,7 @@ public class SnowFortress extends CardImpl { // {3}: Snow Fortress deals 1 damage to target creature without flying that's attacking you. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new GenericManaCost(3)); - ability.addTarget(new TargetCreatureOrPlayer()); + ability.addTarget(new TargetCreaturePermanent(filter)); this.addAbility(ability); } @@ -92,26 +90,3 @@ public class SnowFortress extends CardImpl { return new SnowFortress(this); } } - -class SnowFortressFilter extends FilterAttackingCreature { - - public SnowFortressFilter() { - super("creature without flying that's attacking you"); - } - - public SnowFortressFilter(final SnowFortressFilter filter) { - super(filter); - } - - @Override - public SnowFortressFilter copy() { - return new SnowFortressFilter(this); - } - - @Override - public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) { - return super.match(permanent, sourceId, playerId, game) - && permanent.isAttacking() // to prevent unneccessary combat checking if not attacking - && playerId.equals(game.getCombat().getDefenderId(permanent.getId())); - } -} diff --git a/Mage.Sets/src/mage/cards/s/StalkingLeonin.java b/Mage.Sets/src/mage/cards/s/StalkingLeonin.java index c917e94728..a181a42116 100644 --- a/Mage.Sets/src/mage/cards/s/StalkingLeonin.java +++ b/Mage.Sets/src/mage/cards/s/StalkingLeonin.java @@ -44,10 +44,10 @@ import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; import mage.constants.Zone; -import mage.filter.common.FilterAttackingCreature; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; +import mage.target.common.FilterCreatureAttackingYou; import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetOpponent; import mage.util.CardUtil; @@ -72,7 +72,7 @@ public class StalkingLeonin extends CardImpl { this.addAbility(new EntersBattlefieldTriggeredAbility(new StalkingLeoninChooseOpponent(), false)); // Reveal the player you chose: Exile target creature that's attacking you if it's controlled by the chosen player. Activate this ability only once. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new StalkingLeoninEffect(), new StalkingLeoninRevealOpponentCost()); - ability.addTarget(new TargetCreaturePermanent(new StalkingLeoninFilter())); + ability.addTarget(new TargetCreaturePermanent(new FilterCreatureAttackingYou())); this.addAbility(ability); } @@ -217,25 +217,3 @@ class StalkingLeoninEffect extends OneShotEffect { return false; } } - -class StalkingLeoninFilter extends FilterAttackingCreature { - - public StalkingLeoninFilter() { - super("creature that's attacking you"); - } - - public StalkingLeoninFilter(final StalkingLeoninFilter filter) { - super(filter); - } - - @Override - public StalkingLeoninFilter copy() { - return new StalkingLeoninFilter(this); - } - - @Override - public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) { - return super.match(permanent, sourceId, playerId, game) - && playerId.equals(game.getCombat().getDefenderId(permanent.getId())); - } -}