some fixes

This commit is contained in:
Evan Kranzler 2017-10-18 15:02:11 -04:00
parent bcc319a636
commit 53f77ac9cd
2 changed files with 6 additions and 53 deletions

View file

@ -42,12 +42,10 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterAttackingCreature;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate; import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game; import mage.target.common.FilterCreatureAttackingYou;
import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetCreatureOrPlayer;
/** /**
* *
@ -55,7 +53,7 @@ import mage.target.common.TargetCreatureOrPlayer;
*/ */
public class SnowFortress extends CardImpl { 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 { static {
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); 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. // {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 ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new GenericManaCost(3));
ability.addTarget(new TargetCreatureOrPlayer()); ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability); this.addAbility(ability);
} }
@ -92,26 +90,3 @@ public class SnowFortress extends CardImpl {
return new SnowFortress(this); 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()));
}
}

View file

@ -44,10 +44,10 @@ import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterAttackingCreature;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.FilterCreatureAttackingYou;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetOpponent; import mage.target.common.TargetOpponent;
import mage.util.CardUtil; import mage.util.CardUtil;
@ -72,7 +72,7 @@ public class StalkingLeonin extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new StalkingLeoninChooseOpponent(), false)); 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. // 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 ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new StalkingLeoninEffect(), new StalkingLeoninRevealOpponentCost());
ability.addTarget(new TargetCreaturePermanent(new StalkingLeoninFilter())); ability.addTarget(new TargetCreaturePermanent(new FilterCreatureAttackingYou()));
this.addAbility(ability); this.addAbility(ability);
} }
@ -217,25 +217,3 @@ class StalkingLeoninEffect extends OneShotEffect {
return false; 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()));
}
}