* Songs of the Dryad - Fixed that the target did not become colorless.

This commit is contained in:
LevelX2 2015-10-09 00:12:21 +02:00
parent 5b7105a440
commit ebd8ecd494

View file

@ -30,14 +30,20 @@ package mage.sets.commander2014;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BecomesBasicLandEnchantedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.mana.GreenManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
/**
@ -51,7 +57,6 @@ public class SongOfTheDryads extends CardImpl {
this.expansionSetCode = "C14";
this.subtype.add("Aura");
// Enchant permanent
TargetPermanent auraTarget = new TargetPermanent();
this.getSpellAbility().addTarget(auraTarget);
@ -60,7 +65,7 @@ public class SongOfTheDryads extends CardImpl {
this.addAbility(ability);
// Enchanted permanent is a colorless Forest land.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesBasicLandEnchantedEffect("Forest")));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesColorlessForestLandEffect()));
}
@ -73,3 +78,61 @@ public class SongOfTheDryads extends CardImpl {
return new SongOfTheDryads(this);
}
}
class BecomesColorlessForestLandEffect extends ContinuousEffectImpl {
public BecomesColorlessForestLandEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this.staticText = "Enchanted permanent is a colorless Forest land";
}
public BecomesColorlessForestLandEffect(final BecomesColorlessForestLandEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public BecomesColorlessForestLandEffect copy() {
return new BecomesColorlessForestLandEffect(this);
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {
Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
if (permanent != null) {
switch (layer) {
case ColorChangingEffects_5:
permanent.getColor(game).setWhite(false);
permanent.getColor(game).setGreen(false);
permanent.getColor(game).setBlack(false);
permanent.getColor(game).setBlue(false);
permanent.getColor(game).setRed(false);
break;
case AbilityAddingRemovingEffects_6:
permanent.removeAllAbilities(source.getSourceId(), game);
permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game);
break;
case TypeChangingEffects_4:
permanent.getCardType().clear();
permanent.getCardType().add(CardType.LAND);
permanent.getSubtype().clear();
permanent.getSubtype().add("Forest");
break;
}
return true;
}
}
return false;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.ColorChangingEffects_5 || layer == Layer.TypeChangingEffects_4;
}
}