mirror of
https://github.com/correl/mage.git
synced 2025-01-12 11:08:01 +00:00
fixed an issue with Tajic, Legion's Edge's prevention effect
This commit is contained in:
parent
d6f87d709a
commit
32fd543824
2 changed files with 16 additions and 21 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue