* Obscuring AEther - Fixed that the turn face down ability did not work.

This commit is contained in:
LevelX2 2015-03-28 16:33:54 +01:00
parent 4f63793578
commit e94a395b1d
2 changed files with 25 additions and 3 deletions

View file

@ -36,6 +36,7 @@ import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureEffect;
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
@ -61,7 +62,7 @@ public class ObscuringAEther extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionControllerEffect(filter, 1)));
// {1}{G}: Turn Obscuring AEther face down.
Effect effect = new BecomesFaceDownCreatureEffect(null, BecomesFaceDownCreatureEffect.FaceDownType.MANIFESTED);
Effect effect = new BecomesFaceDownCreatureEffect(Duration.Custom, BecomesFaceDownCreatureEffect.FaceDownType.MANUAL);
effect.setText("Turn Obscuring AEther face down. <i>(It becomes a 2/2 creature.)</i>");
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{G}")));

View file

@ -61,9 +61,10 @@ import mage.game.permanent.Permanent;
public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implements SourceEffect {
public enum FaceDownType {
MORPHED,
MANIFESTED,
MANUAL,
MEGAMORPHED,
MANIFESTED
MORPHED
}
protected int zoneChangeCounter;
@ -72,6 +73,9 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
protected boolean foundPermanent;
protected FaceDownType faceDownType;
public BecomesFaceDownCreatureEffect(Duration duration, FaceDownType faceDownType){
this(null, null, duration, faceDownType);
}
public BecomesFaceDownCreatureEffect(Costs<Cost> turnFaceUpCosts, FaceDownType faceDownType){
this(turnFaceUpCosts, null, faceDownType);
@ -123,6 +127,22 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
return costs;
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (faceDownType.equals(FaceDownType.MANUAL)) {
Permanent permanent;
if (objectReference != null) {
permanent = objectReference.getPermanent(game);
} else {
permanent = game.getPermanent(source.getSourceId());
}
if (permanent != null) {
permanent.setFaceDown(true, game);
}
}
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent permanent;
@ -137,6 +157,7 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
foundPermanent = true;
switch(faceDownType) {
case MANIFESTED:
case MANUAL: // sets manifested image
permanent.setManifested(true);
break;
case MORPHED: