1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-11 01:01:05 -09:00

* Wall of Deceit - Fixed not working "Turn face down" ability.

This commit is contained in:
LevelX2 2018-05-02 17:32:59 +02:00
parent c824d012d1
commit 9919a3403d

View file

@ -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,7 +51,7 @@ 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);
@ -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;
}
}