some DDF reprints, moving continious effects to separate package

This commit is contained in:
Loki 2011-02-09 23:11:52 +02:00
parent 6d40aa63d0
commit d17fd869c3
180 changed files with 1019 additions and 299 deletions

View file

@ -0,0 +1,60 @@
package mage.abilities.effects.common.continious;
import mage.Constants;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
* @author nantuko
*/
public class ControlEnchantedEffect extends ContinuousEffectImpl<ControlEnchantedEffect> {
public ControlEnchantedEffect() {
super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Detriment);
}
public ControlEnchantedEffect(final ControlEnchantedEffect effect) {
super(effect);
}
@Override
public ControlEnchantedEffect copy() {
return new ControlEnchantedEffect(this);
}
@Override
public boolean apply(Constants.Layer layer, Constants.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 ControlChangingEffects_2:
if (sublayer == Constants.SubLayer.NA) {
permanent.changeControllerId(source.getControllerId(), game);
}
break;
}
return true;
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean hasLayer(Constants.Layer layer) {
return layer == Constants.Layer.ControlChangingEffects_2;
}
@Override
public String getText(Ability source) {
return "You control enchanted creature";
}
}