* Wall of Deceit - Fixed not working "Turn face down" ability.
@@ -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;
/**
*
@@ -58,9 +60,7 @@ public class WallOfDeceit extends CardImpl {
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. <i>(It becomes a 2/2 creature.)</i>");
- 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;
+ }
+}
