diff --git a/Mage/src/mage/abilities/effects/PreventionEffectImpl.java b/Mage/src/mage/abilities/effects/PreventionEffectImpl.java index 9fea34802c..b639452fb1 100644 --- a/Mage/src/mage/abilities/effects/PreventionEffectImpl.java +++ b/Mage/src/mage/abilities/effects/PreventionEffectImpl.java @@ -60,6 +60,7 @@ public abstract class PreventionEffectImpl> ex this.effectType = EffectType.PREVENTION; this.amountToPrevent = amountToPrevent; this.onlyCombat = onlyCombat; + this.consumable = consumable; } public PreventionEffectImpl(final PreventionEffectImpl effect) { @@ -83,7 +84,7 @@ public abstract class PreventionEffectImpl> ex amountToPrevent = preventionData.getRemainingAmount(); } if (amountToPrevent == 0) { - this.used = true; + this.discard(); } } return preventionData; diff --git a/Mage/src/mage/abilities/effects/common/PreventDamageSourceEffect.java b/Mage/src/mage/abilities/effects/common/PreventDamageSourceEffect.java index 45fb3e8347..dbfb2d24aa 100644 --- a/Mage/src/mage/abilities/effects/common/PreventDamageSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/PreventDamageSourceEffect.java @@ -27,10 +27,10 @@ */ package mage.abilities.effects.common; -import mage.constants.Duration; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.effects.PreventionEffectImpl; +import mage.constants.Duration; import mage.game.Game; import mage.game.events.GameEvent; @@ -40,16 +40,12 @@ import mage.game.events.GameEvent; */ public class PreventDamageSourceEffect extends PreventionEffectImpl { - private int amount; - - public PreventDamageSourceEffect(Duration duration, int amount) { - super(duration); - this.amount = amount; + public PreventDamageSourceEffect(Duration duration, int amountToPrevent) { + super(duration, amountToPrevent, false); } public PreventDamageSourceEffect(final PreventDamageSourceEffect effect) { super(effect); - this.amount = effect.amount; } @Override @@ -62,31 +58,9 @@ public class PreventDamageSourceEffect extends PreventionEffectImpl= this.amount) { - int damage = amount; - event.setAmount(event.getAmount() - amount); - this.used = true; - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getSourceId(), source.getId(), source.getControllerId(), damage)); - } else { - int damage = event.getAmount(); - event.setAmount(0); - amount -= damage; - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getSourceId(), source.getId(), source.getControllerId(), damage)); - } - } - return false; - } - @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (!this.used && super.applies(event, source, game) && event.getTargetId().equals(source.getSourceId())) { - return true; - } - return false; + return super.applies(event, source, game) && event.getTargetId().equals(source.getSourceId()); } @Override @@ -95,10 +69,10 @@ public class PreventDamageSourceEffect extends PreventionEffectImpl> implements Game, Serializa } if (amountToPrevent != Integer.MAX_VALUE) { // set remaining amount - event.setData(Integer.toString(amountToPrevent -= result.getPreventedDamage())); + result.setRemainingAmount(amountToPrevent -= result.getPreventedDamage()); } MageObject damageSource = game.getObject(damageEvent.getSourceId()); MageObject preventionSource = game.getObject(source.getSourceId());