From 9919a3403da8e141e7bbfd91e3e1e9af0633a560 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 2 May 2018 17:32:59 +0200 Subject: [PATCH] * Wall of Deceit - Fixed not working "Turn face down" ability. --- Mage.Sets/src/mage/cards/w/WallOfDeceit.java | 46 ++++++++++++++++---- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/Mage.Sets/src/mage/cards/w/WallOfDeceit.java b/Mage.Sets/src/mage/cards/w/WallOfDeceit.java index a9491133451..ac52e9db285 100644 --- a/Mage.Sets/src/mage/cards/w/WallOfDeceit.java +++ b/Mage.Sets/src/mage/cards/w/WallOfDeceit.java @@ -29,18 +29,20 @@ package mage.cards.w; import java.util.UUID; import mage.MageInt; +import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.Effect; -import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureEffect; +import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.DefenderAbility; import mage.abilities.keyword.MorphAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.Outcome; import mage.constants.SubType; -import mage.constants.Duration; import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; /** * @@ -49,19 +51,17 @@ import mage.constants.Zone; public class WallOfDeceit extends CardImpl { public WallOfDeceit(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); this.subtype.add(SubType.WALL); this.power = new MageInt(0); this.toughness = new MageInt(5); // Defender this.addAbility(DefenderAbility.getInstance()); - + // {3}: Turn Wall of Deceit face down. - Effect effect = new BecomesFaceDownCreatureEffect(Duration.Custom, BecomesFaceDownCreatureEffect.FaceDownType.MANIFESTED); - effect.setText("Turn Wall of Deceit face down. (It becomes a 2/2 creature.)"); - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{3}"))); - + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WallOfDeceitEffect(), new ManaCostsImpl("{3}"))); + // Morph {U} this.addAbility(new MorphAbility(this, new ManaCostsImpl("{U}"))); } @@ -75,3 +75,31 @@ public class WallOfDeceit extends CardImpl { return new WallOfDeceit(this); } } + +class WallOfDeceitEffect extends OneShotEffect { + + public WallOfDeceitEffect() { + super(Outcome.Detriment); + this.staticText = "Turn {this} face down"; + } + + public WallOfDeceitEffect(final WallOfDeceitEffect effect) { + super(effect); + } + + @Override + public WallOfDeceitEffect copy() { + return new WallOfDeceitEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); + if (sourcePermanent != null + && source.getSourceObjectZoneChangeCounter() == sourcePermanent.getZoneChangeCounter(game) // in case source was blinked after ability was set to stack + && !sourcePermanent.isFaceDown(game)) { + sourcePermanent.setFaceDown(true, game); + } + return true; + } +}