diff --git a/Mage.Sets/src/mage/cards/m/MarkOfAsylum.java b/Mage.Sets/src/mage/cards/m/MarkOfAsylum.java index 8249e5af577..64af2f0f625 100644 --- a/Mage.Sets/src/mage/cards/m/MarkOfAsylum.java +++ b/Mage.Sets/src/mage/cards/m/MarkOfAsylum.java @@ -1,7 +1,6 @@ package mage.cards.m; -import java.util.UUID; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.PreventAllNonCombatDamageToAllEffect; import mage.cards.CardImpl; @@ -9,23 +8,26 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreatureInPlay; +import mage.filter.StaticFilters; + +import java.util.UUID; /** - * * @author jeffwadsworth */ public final class MarkOfAsylum extends CardImpl { - - private static final FilterControlledCreatureInPlay filter = new FilterControlledCreatureInPlay("creatures you control"); - - public MarkOfAsylum(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}"); + public MarkOfAsylum(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); // Prevent all noncombat damage that would be dealt to creatures you control. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PreventAllNonCombatDamageToAllEffect(Duration.WhileOnBattlefield, filter))); - + this.addAbility(new SimpleStaticAbility( + Zone.BATTLEFIELD, + new PreventAllNonCombatDamageToAllEffect( + Duration.WhileOnBattlefield, + StaticFilters.FILTER_CONTROLLED_CREATURES + ) + )); } public MarkOfAsylum(final MarkOfAsylum card) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventAllNonCombatDamageToAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventAllNonCombatDamageToAllEffect.java index 601f0423c81..5c857c93c28 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventAllNonCombatDamageToAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventAllNonCombatDamageToAllEffect.java @@ -6,6 +6,7 @@ import mage.constants.Duration; import mage.abilities.Ability; import mage.abilities.effects.PreventionEffectImpl; import mage.filter.FilterInPlay; +import mage.filter.FilterPermanent; import mage.game.Game; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; @@ -18,9 +19,9 @@ import mage.players.Player; */ public class PreventAllNonCombatDamageToAllEffect extends PreventionEffectImpl { - protected FilterInPlay filter; + protected final FilterPermanent filter; - public PreventAllNonCombatDamageToAllEffect(Duration duration, FilterInPlay filter) { + public PreventAllNonCombatDamageToAllEffect(Duration duration, FilterPermanent filter) { super(duration, Integer.MAX_VALUE, false); this.filter = filter; staticText = "Prevent all non combat damage that would be dealt to " + filter.getMessage() + ' ' + duration.toString(); @@ -42,15 +43,7 @@ public class PreventAllNonCombatDamageToAllEffect extends PreventionEffectImpl { && !((DamageEvent) event).isCombatDamage()) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null) { - if (filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) { - return true; - } - } - else { - Player player = game.getPlayer(event.getTargetId()); - if (player != null && filter.match(player, source.getSourceId(), source.getControllerId(), game)) { - return true; - } + return filter.match(permanent, source.getSourceId(), source.getControllerId(), game); } } return false;