From 6ce343c9f82d5b6c0734ee9a4e01e94012584ea4 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 27 Apr 2013 02:05:12 +0200 Subject: [PATCH] Used framework effect for GlacialChasm. --- .../src/mage/sets/iceage/GlacialChasm.java | 50 +------------------ 1 file changed, 2 insertions(+), 48 deletions(-) diff --git a/Mage.Sets/src/mage/sets/iceage/GlacialChasm.java b/Mage.Sets/src/mage/sets/iceage/GlacialChasm.java index b65f3742bf..d0012b163e 100644 --- a/Mage.Sets/src/mage/sets/iceage/GlacialChasm.java +++ b/Mage.Sets/src/mage/sets/iceage/GlacialChasm.java @@ -40,8 +40,8 @@ import mage.abilities.costs.common.PayLifeCost; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.PreventionEffectImpl; import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.PreventAllDamageToControllerEffect; import mage.abilities.keyword.CumulativeUpkeepAbility; import mage.cards.CardImpl; import mage.filter.FilterPermanent; @@ -71,7 +71,7 @@ public class GlacialChasm extends CardImpl { // Creatures you control can't attack. this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new CantAttackEffect())); // Prevent all damage that would be dealt to you. - this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new PreventAllDamageToControllerEffect())); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new PreventAllDamageToControllerEffect(Duration.WhileOnBattlefield))); } public GlacialChasm(final GlacialChasm card) { @@ -189,49 +189,3 @@ class CantAttackEffect extends ReplacementEffectImpl { return false; } } - -class PreventAllDamageToControllerEffect extends PreventionEffectImpl { - - - public PreventAllDamageToControllerEffect() { - super(Duration.WhileOnBattlefield); - staticText = "Prevent all damage that would be dealt to you"; - } - - public PreventAllDamageToControllerEffect(final PreventAllDamageToControllerEffect effect) { - super(effect); - } - - @Override - public PreventAllDamageToControllerEffect copy() { - return new PreventAllDamageToControllerEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), event.getAmount(), false); - if (!game.replaceEvent(preventEvent)) { - int damage = event.getAmount(); - event.setAmount(0); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), damage)); - } - return false; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (super.applies(event, source, game)) { - if (event.getTargetId().equals(source.getControllerId())){ - return true; - } - - } - return false; - } - -}