package com.aionemu.gameserver.skillengine.effect;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.model.stats.container.StatEnum;
import com.aionemu.gameserver.skillengine.model.Effect;
/**
* @author Sippolo
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NoFlyEffect")
public class NoFlyEffect extends EffectTemplate {
@Override
public void calculate(Effect effect) {
// Affects only players (for now as we dont have flying Npc's)
if (effect.getEffected() instanceof Player)
super.calculate(effect, StatEnum.NOFLY_RESISTANCE, null);
}
@Override
public void applyEffect(Effect effect) {
effect.addToEffectedController();
}
@Override
public void startEffect(Effect effect) {
((Player) effect.getEffected()).getFlyController().endFly(true);
effect.setAbnormal(AbnormalState.NOFLY);
effect.getEffected().getEffectController().setAbnormal(AbnormalState.NOFLY);
}
@Override
public void endEffect(Effect effect) {
effect.getEffected().getEffectController().unsetAbnormal(AbnormalState.NOFLY);
}
}