From a0ed2c2cdb2510dba1defa6d60074071805bd5bb Mon Sep 17 00:00:00 2001 From: Neil Gentleman Date: Sat, 7 Nov 2015 10:54:28 -0800 Subject: [PATCH] Desolation Angel: remove custom effect now using the same template as Desolation Giant --- .../mage/sets/apocalypse/DesolationAngel.java | 51 +++++-------------- 1 file changed, 13 insertions(+), 38 deletions(-) diff --git a/Mage.Sets/src/mage/sets/apocalypse/DesolationAngel.java b/Mage.Sets/src/mage/sets/apocalypse/DesolationAngel.java index dd1b5db3a3..be3613ad5a 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/DesolationAngel.java +++ b/Mage.Sets/src/mage/sets/apocalypse/DesolationAngel.java @@ -29,26 +29,31 @@ package mage.sets.apocalypse; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.condition.common.KickedCondition; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.common.DestroyAllEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.KickerAbility; -import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; +import mage.constants.TargetController; import mage.filter.common.FilterLandPermanent; -import mage.game.Game; -import mage.game.permanent.Permanent; +import mage.filter.predicate.permanent.ControllerPredicate; /** * @author Loki */ public class DesolationAngel extends CardImpl { + private static final FilterLandPermanent filter = new FilterLandPermanent("lands"); + private static final FilterLandPermanent filter2 = new FilterLandPermanent("lands you control"); + + static { + filter2.add(new ControllerPredicate(TargetController.YOU)); + } + public DesolationAngel(UUID ownerId) { super(ownerId, 38, "Desolation Angel", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{B}{B}"); this.expansionSetCode = "APC"; @@ -64,7 +69,8 @@ public class DesolationAngel extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // When Desolation Angel enters the battlefield, destroy all lands you control. If it was kicked, destroy all lands instead. - this.addAbility(new EntersBattlefieldTriggeredAbility(new DesolationAngelEntersBattlefieldEffect())); + this.addAbility(new EntersBattlefieldTriggeredAbility(new ConditionalOneShotEffect(new DestroyAllEffect(filter), + new DestroyAllEffect(filter2), KickedCondition.getInstance(), "destroy all lands you control. If it was kicked, destroy all lands instead."))); } public DesolationAngel(final DesolationAngel card) { @@ -76,34 +82,3 @@ public class DesolationAngel extends CardImpl { return new DesolationAngel(this); } } - -class DesolationAngelEntersBattlefieldEffect extends OneShotEffect { - - DesolationAngelEntersBattlefieldEffect() { - super(Outcome.DestroyPermanent); - staticText = "destroy all lands you control. If it was kicked, destroy all lands instead"; - } - - DesolationAngelEntersBattlefieldEffect(final DesolationAngelEntersBattlefieldEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Card p = game.getCard(source.getSourceId()); - boolean kicked = KickedCondition.getInstance().apply(game, source); - for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterLandPermanent(), source.getControllerId(), source.getSourceId(), game)) { - if ((!kicked && permanent.getControllerId().equals(source.getControllerId())) - || kicked) { - permanent.destroy(source.getSourceId(), game, false); - } - } - return true; - } - - @Override - public DesolationAngelEntersBattlefieldEffect copy() { - return new DesolationAngelEntersBattlefieldEffect(this); - } - -}