actual freya branch

This commit is contained in:
2026-09-12 15:41:31 +00:00
parent 8049e0a882
commit 68c1cd27d4
3510 changed files with 336689 additions and 302906 deletions
@@ -0,0 +1,66 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectAbortCast extends L2Effect
{
public EffectAbortCast(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.ABORT_CAST;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if ((getEffected() == null) || (getEffected() == getEffector()))
{
return false;
}
if (getEffected().isRaid())
{
return false;
}
getEffected().breakCast();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
}
@@ -0,0 +1,87 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author decad
*/
public class EffectBetray extends L2Effect
{
public EffectBetray(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BETRAY;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if ((getEffector() instanceof L2PcInstance) && (getEffected() instanceof L2Summon))
{
L2PcInstance targetOwner = getEffected().getActingPlayer();
getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, targetOwner);
return true;
}
return false;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_BETRAYED;
}
}
@@ -0,0 +1,69 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.AbnormalEffect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author LBaldi
*/
public class EffectBigHead extends L2Effect
{
public EffectBigHead(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BUFF;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().startAbnormalEffect(AbnormalEffect.BIG_HEAD);
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopAbnormalEffect(AbnormalEffect.BIG_HEAD);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
}
@@ -0,0 +1,56 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author UnAfraid
*/
public class EffectBlockResurrection extends L2Effect
{
public EffectBlockResurrection(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BLOCK_RESURRECTION;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_BLOCK_RESURRECTION;
}
}
@@ -0,0 +1,81 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2SiegeSummonInstance;
import com.l2jserver.gameserver.network.serverpackets.StartRotation;
import com.l2jserver.gameserver.network.serverpackets.StopRotation;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author decad Implementation of the Bluff Effect
*/
public class EffectBluff extends L2Effect
{
public EffectBluff(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BLUFF; // test for bluff effect
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if (getEffected() instanceof L2NpcInstance)
{
return false;
}
if ((getEffected() instanceof L2Npc) && (((L2Npc) getEffected()).getNpcId() == 35062))
{
return false;
}
if (getEffected() instanceof L2SiegeSummonInstance)
{
return false;
}
getEffected().broadcastPacket(new StartRotation(getEffected().getObjectId(), getEffected().getHeading(), 1, 65535));
getEffected().broadcastPacket(new StopRotation(getEffected().getObjectId(), getEffector().getHeading(), 65535));
getEffected().setHeading(getEffector().getHeading());
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
}
@@ -0,0 +1,59 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author mkizub
*/
public class EffectBuff extends L2Effect
{
public EffectBuff(Env env, EffectTemplate template)
{
super(env, template);
}
// Special constructor to steal this effect
public EffectBuff(Env env, L2Effect effect)
{
super(env, effect);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#effectCanBeStolen()
*/
@Override
protected boolean effectCanBeStolen()
{
return true;
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BUFF;
}
@Override
public boolean onActionTime()
{
// just stop this effect
return false;
}
}
@@ -0,0 +1,244 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import java.util.logging.Logger;
import com.l2jserver.Config;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.skills.Formulas;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
import com.l2jserver.util.Rnd;
import com.l2jserver.util.StringUtil;
/**
* @author DS
*/
public class EffectCancel extends L2Effect
{
protected static final Logger _log = Logger.getLogger(EffectCancel.class.getName());
public EffectCancel(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.CANCEL;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
return cancel(getEffector(), getEffected(), this);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
private static boolean cancel(L2Character caster, L2Character target, L2Effect effect)
{
if (!(target instanceof L2PcInstance) || target.isDead())
{
return false;
}
final int cancelLvl = effect.getSkill().getMagicLevel();
int count = effect.getSkill().getMaxNegatedEffects();
double rate = effect.getEffectPower();
final double vulnModifier = Formulas.calcSkillTypeVulnerability(0, target, effect.getSkillType());
final double profModifier = Formulas.calcSkillTypeProficiency(0, caster, target, effect.getSkillType());
double res = vulnModifier + profModifier;
double resMod = 1;
if (res != 0)
{
if (res < 0)
{
resMod = 1 - (0.075 * res);
resMod = 1 / resMod;
}
else
{
resMod = 1 + (0.02 * res);
}
rate *= resMod;
}
if (caster.isDebug())
{
final StringBuilder stat = new StringBuilder(100);
StringUtil.append(stat, effect.getSkill().getName(), " power:", String.valueOf((int) effect.getEffectPower()), " lvl:", String.valueOf(cancelLvl), " res:", String.format("%1.2f", resMod), "(", String.format("%1.2f", profModifier), "/", String.format("%1.2f", vulnModifier), ") total:", String.valueOf(rate));
final String result = stat.toString();
if (caster.isDebug())
{
caster.sendDebugMessage(result);
}
if (Config.DEVELOPER)
{
_log.info(result);
}
}
final L2Effect[] effects = target.getAllEffects();
if (effect.getSkill().getNegateAbnormals() != null) // Cancel for abnormals
{
for (L2Effect eff : effects)
{
if (eff == null)
{
continue;
}
for (String negateAbnormalType : effect.getSkill().getNegateAbnormals().keySet())
{
if (negateAbnormalType.equalsIgnoreCase(eff.getAbnormalType()) && (effect.getSkill().getNegateAbnormals().get(negateAbnormalType) >= eff.getAbnormalLvl()))
{
if (calcCancelSuccess(eff, cancelLvl, (int) rate))
{
eff.exit();
}
}
}
}
}
else
{
L2Effect eff;
int lastCanceledSkillId = 0;
for (int i = effects.length; --i >= 0;)
{
eff = effects[i];
if (eff == null)
{
continue;
}
if (!eff.canBeStolen())
{
effects[i] = null;
continue;
}
// first pass - dances/songs only
if (!eff.getSkill().isDance())
{
continue;
}
if (eff.getSkill().getId() == lastCanceledSkillId)
{
eff.exit(); // this skill already canceled
continue;
}
if (!calcCancelSuccess(eff, cancelLvl, (int) rate))
{
continue;
}
lastCanceledSkillId = eff.getSkill().getId();
eff.exit();
count--;
if (count == 0)
{
break;
}
}
if (count != 0)
{
lastCanceledSkillId = 0;
for (int i = effects.length; --i >= 0;)
{
eff = effects[i];
if (eff == null)
{
continue;
}
// second pass - all except dances/songs
if (eff.getSkill().isDance())
{
continue;
}
if (eff.getSkill().getId() == lastCanceledSkillId)
{
eff.exit(); // this skill already canceled
continue;
}
if (!calcCancelSuccess(eff, cancelLvl, (int) rate))
{
continue;
}
lastCanceledSkillId = eff.getSkill().getId();
eff.exit();
count--;
if (count == 0)
{
break;
}
}
}
}
return true;
}
private static boolean calcCancelSuccess(L2Effect effect, int cancelLvl, int baseRate)
{
int rate = 2 * (cancelLvl - effect.getSkill().getMagicLevel());
rate += effect.getAbnormalTime() / 120;
rate += baseRate;
if (rate < 25)
{
rate = 25;
}
else if (rate > 75)
{
rate = 75;
}
return Rnd.get(100) < rate;
}
}
@@ -0,0 +1,173 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.skills.Formulas;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
import com.l2jserver.gameserver.templates.skills.L2SkillType;
import com.l2jserver.util.Rnd;
/**
* @author UnAfraid
*/
public class EffectCancelDebuff extends L2Effect
{
public EffectCancelDebuff(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.CANCEL_DEBUFF;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
return cancel(getEffector(), getEffected(), getSkill(), getEffectTemplate().effectType);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
private static boolean cancel(L2Character caster, L2Character target, L2Skill skill, L2SkillType effectType)
{
if (!(target instanceof L2PcInstance) || target.isDead())
{
return false;
}
final int cancelLvl = skill.getMagicLevel();
int count = skill.getMaxNegatedEffects();
double baseRate = Formulas.calcSkillTypeProficiency(skill.getPower(), caster, target, effectType);
baseRate += Formulas.calcSkillTypeVulnerability(baseRate, caster, effectType);
L2Effect effect;
int lastCanceledSkillId = 0;
final L2Effect[] effects = target.getAllEffects();
for (int i = effects.length; --i >= 0;)
{
effect = effects[i];
if (effect == null)
{
continue;
}
if (!effect.getSkill().isDebuff() || !effect.getSkill().canBeDispeled())
{
effects[i] = null;
continue;
}
if (effect.getSkill().getId() == lastCanceledSkillId)
{
effect.exit(); // this skill already canceled
continue;
}
if (!calcCancelSuccess(effect, cancelLvl, (int) baseRate))
{
continue;
}
lastCanceledSkillId = effect.getSkill().getId();
effect.exit();
count--;
if (count == 0)
{
break;
}
}
if (count != 0)
{
lastCanceledSkillId = 0;
for (int i = effects.length; --i >= 0;)
{
effect = effects[i];
if (effect == null)
{
continue;
}
if (!effect.getSkill().isDebuff() || !effect.getSkill().canBeDispeled())
{
effects[i] = null;
continue;
}
if (effect.getSkill().getId() == lastCanceledSkillId)
{
effect.exit(); // this skill already canceled
continue;
}
if (!calcCancelSuccess(effect, cancelLvl, (int) baseRate))
{
continue;
}
lastCanceledSkillId = effect.getSkill().getId();
effect.exit();
count--;
if (count == 0)
{
break;
}
}
}
return true;
}
private static boolean calcCancelSuccess(L2Effect effect, int cancelLvl, int baseRate)
{
int rate = 2 * (cancelLvl - effect.getSkill().getMagicLevel());
rate += (effect.getAbnormalTime() - effect.getTime()) / 1200;
rate += baseRate;
if (rate < 25)
{
rate = 25;
}
else if (rate > 75)
{
rate = 75;
}
return Rnd.get(100) < rate;
}
}
@@ -0,0 +1,116 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
import com.l2jserver.gameserver.templates.skills.L2SkillType;
public class EffectChameleonRest extends L2Effect
{
public EffectChameleonRest(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.RELAXING;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if (getEffected() instanceof L2PcInstance)
{
((L2PcInstance) getEffected()).sitDown(false);
}
else
{
getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_REST);
}
return super.onStart();
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
super.onExit();
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
if (getEffected().isDead())
{
return false;
}
// Only cont skills shouldn't end
if (getSkill().getSkillType() != L2SkillType.CONT)
{
return false;
}
if (getEffected() instanceof L2PcInstance)
{
if (!((L2PcInstance) getEffected()).isSitting())
{
return false;
}
}
double manaDam = calc();
if (manaDam > getEffected().getCurrentMp())
{
getEffected().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
return false;
}
getEffected().reduceCurrentMp(manaDam);
return true;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return (CharEffectList.EFFECT_FLAG_SILENT_MOVE | CharEffectList.EFFECT_FLAG_RELAXING);
}
}
@@ -0,0 +1,111 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.ChanceCondition;
import com.l2jserver.gameserver.model.IChanceSkillTrigger;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectChanceSkillTrigger extends L2Effect implements IChanceSkillTrigger
{
private final int _triggeredId;
private final int _triggeredLevel;
private final ChanceCondition _chanceCondition;
public EffectChanceSkillTrigger(Env env, EffectTemplate template)
{
super(env, template);
_triggeredId = template.triggeredId;
_triggeredLevel = template.triggeredLevel;
_chanceCondition = template.chanceCondition;
}
// Special constructor to steal this effect
public EffectChanceSkillTrigger(Env env, L2Effect effect)
{
super(env, effect);
_triggeredId = effect.getEffectTemplate().triggeredId;
_triggeredLevel = effect.getEffectTemplate().triggeredLevel;
_chanceCondition = effect.getEffectTemplate().chanceCondition;
}
@Override
protected boolean effectCanBeStolen()
{
return true;
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.CHANCE_SKILL_TRIGGER;
}
@Override
public boolean onStart()
{
getEffected().addChanceTrigger(this);
getEffected().onStartChanceEffect(getSkill().getElement());
return super.onStart();
}
@Override
public boolean onActionTime()
{
getEffected().onActionTimeChanceEffect(getSkill().getElement());
return false;
}
@Override
public void onExit()
{
// trigger only if effect in use and successfully ticked to the end
if (getInUse() && (getCount() == 0))
{
getEffected().onExitChanceEffect(getSkill().getElement());
}
getEffected().removeChanceEffect(this);
super.onExit();
}
@Override
public int getTriggeredChanceId()
{
return _triggeredId;
}
@Override
public int getTriggeredChanceLevel()
{
return _triggeredLevel;
}
@Override
public boolean triggersChanceSkill()
{
return _triggeredId > 1;
}
@Override
public ChanceCondition getTriggeredChanceCondition()
{
return _chanceCondition;
}
}
@@ -0,0 +1,88 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.EtcStatusUpdate;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author nBd
*/
public class EffectCharmOfCourage extends L2Effect
{
public EffectCharmOfCourage(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.CHARMOFCOURAGE;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if (getEffected() instanceof L2PcInstance)
{
getEffected().broadcastPacket(new EtcStatusUpdate((L2PcInstance) getEffected()));
return true;
}
return false;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
if (getEffected() instanceof L2PcInstance)
{
getEffected().broadcastPacket(new EtcStatusUpdate((L2PcInstance) getEffected()));
}
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_CHARM_OF_COURAGE;
}
}
@@ -0,0 +1,80 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author kerberos_20
*/
public class EffectCharmOfLuck extends L2Effect
{
public EffectCharmOfLuck(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.CHARM_OF_LUCK;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
((L2Playable) getEffected()).stopCharmOfLuck(this);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// just stop this effect
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_CHARM_OF_LUCK;
}
}
@@ -0,0 +1,83 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.AbnormalEffect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author ZaKaX (Ghost @ L2D)
*/
public class EffectClanGate extends L2Effect
{
public EffectClanGate(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().startAbnormalEffect(AbnormalEffect.MAGIC_CIRCLE);
if (getEffected() instanceof L2PcInstance)
{
L2Clan clan = ((L2PcInstance) getEffected()).getClan();
if (clan != null)
{
SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.COURT_MAGICIAN_CREATED_PORTAL);
clan.broadcastToOtherOnlineMembers(msg, ((L2PcInstance) getEffected()));
}
}
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopAbnormalEffect(AbnormalEffect.MAGIC_CIRCLE);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.CLAN_GATE;
}
}
@@ -0,0 +1,72 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectCombatPointHeal extends L2Effect
{
public EffectCombatPointHeal(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.COMBAT_POINT_HEAL;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
@Override
public boolean onStart()
{
L2Character target = getEffected();
if (target.isInvul())
{
return false;
}
double cp = calc();
if ((target.getCurrentCp() + cp) > target.getMaxCp())
{
cp = target.getMaxCp() - target.getCurrentCp();
}
target.setCurrentCp(cp + target.getCurrentCp());
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CP_WILL_BE_RESTORED);
sm.addNumber((int) cp);
target.sendPacket(sm);
return false;
}
}
@@ -0,0 +1,79 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectCombatPointHealOverTime extends L2Effect
{
public EffectCombatPointHealOverTime(Env env, EffectTemplate template)
{
super(env, template);
}
// Special constructor to steal this effect
public EffectCombatPointHealOverTime(Env env, L2Effect effect)
{
super(env, effect);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#effectCanBeStolen()
*/
@Override
protected boolean effectCanBeStolen()
{
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.COMBAT_POINT_HEAL_OVER_TIME;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
if (getEffected().isDead())
{
return false;
}
double cp = getEffected().getCurrentCp();
double maxcp = getEffected().getMaxCp();
cp += calc();
if (cp > maxcp)
{
cp = maxcp;
}
getEffected().setCurrentCp(cp);
StatusUpdate sump = new StatusUpdate(getEffected());
sump.addAttribute(StatusUpdate.CUR_CP, (int) cp);
getEffected().sendPacket(sump);
return true;
}
}
@@ -0,0 +1,119 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import java.util.Collection;
import java.util.List;
import javolution.util.FastList;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Attackable;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
import com.l2jserver.util.Rnd;
/**
* @author littlecrow Implementation of the Confusion Effect
*/
public class EffectConfuseMob extends L2Effect
{
public EffectConfuseMob(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.CONFUSE_MOB_ONLY;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().startConfused();
onActionTime();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopConfused(this);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
List<L2Character> targetList = new FastList<>();
// Getting the possible targets
Collection<L2Object> objs = getEffected().getKnownList().getKnownObjects().values();
// synchronized (getEffected().getKnownList().getKnownObjects())
{
for (L2Object obj : objs)
{
if ((obj instanceof L2Attackable) && (obj != getEffected()))
{
targetList.add((L2Character) obj);
}
}
}
// if there is no target, exit function
if (targetList.isEmpty())
{
return true;
}
// Choosing randomly a new target
int nextTargetIdx = Rnd.nextInt(targetList.size());
L2Object target = targetList.get(nextTargetIdx);
// Attacking the target
getEffected().setTarget(target);
getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
return true;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_CONFUSED;
}
}
@@ -0,0 +1,119 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import java.util.Collection;
import java.util.List;
import javolution.util.FastList;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
import com.l2jserver.util.Rnd;
/**
* @author littlecrow Implementation of the Confusion Effect
*/
public class EffectConfusion extends L2Effect
{
public EffectConfusion(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.CONFUSION;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().startConfused();
onActionTime();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopConfused(this);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
List<L2Character> targetList = new FastList<>();
// Getting the possible targets
Collection<L2Object> objs = getEffected().getKnownList().getKnownObjects().values();
// synchronized (getEffected().getKnownList().getKnownObjects())
{
for (L2Object obj : objs)
{
if ((obj instanceof L2Character) && (obj != getEffected()))
{
targetList.add((L2Character) obj);
}
}
}
// if there is no target, exit function
if (targetList.isEmpty())
{
return true;
}
// Choosing randomly a new target
int nextTargetIdx = Rnd.nextInt(targetList.size());
L2Object target = targetList.get(nextTargetIdx);
// Attacking the target
getEffected().setTarget(target);
getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
return true;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_CONFUSED;
}
}
@@ -0,0 +1,41 @@
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author Zoey76
*/
public class EffectCpDamPercent extends L2Effect
{
public EffectCpDamPercent(Env env, EffectTemplate template)
{
super(env, template);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.CPDAMPERCENT;
}
@Override
public boolean onActionTime()
{
if (getEffected().isDead())
{
return false;
}
double cp = (getEffected().getCurrentCp() * (100 - getEffectPower())) / 100;
getEffected().setCurrentCp(cp);
StatusUpdate sucp = new StatusUpdate(getEffected());
sucp.addAttribute(StatusUpdate.CUR_CP, (int) cp);
getEffected().sendPacket(sucp);
return false;
}
}
@@ -0,0 +1,76 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectDamOverTime extends L2Effect
{
public EffectDamOverTime(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DMG_OVER_TIME;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
if (getEffected().isDead())
{
return false;
}
double damage = calc();
if (damage >= (getEffected().getCurrentHp() - 1))
{
if (getSkill().isToggle())
{
getEffected().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_HP));
return false;
}
// For DOT skills that will not kill effected player.
if (!getSkill().killByDOT())
{
// Fix for players dying by DOTs if HP < 1 since reduceCurrentHP method will kill them
if (getEffected().getCurrentHp() <= 1)
{
return true;
}
damage = getEffected().getCurrentHp() - 1;
}
}
getEffected().reduceCurrentHpByDOT(damage, getEffector(), getSkill());
return true;
}
}
@@ -0,0 +1,47 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectDebuff extends L2Effect
{
public EffectDebuff(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DEBUFF;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// just stop this effect
return false;
}
}
@@ -0,0 +1,85 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author nBd
*/
public class EffectDisarm extends L2Effect
{
public EffectDisarm(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.DISARM;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if (!(getEffected() instanceof L2PcInstance))
{
return false;
}
((L2PcInstance) getEffected()).disarmWeapons();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_DISARMED;
}
}
@@ -0,0 +1,113 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import java.util.logging.Logger;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.network.serverpackets.FlyToLocation;
import com.l2jserver.gameserver.network.serverpackets.FlyToLocation.FlyType;
import com.l2jserver.gameserver.network.serverpackets.ValidateLocation;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectEnemyCharge extends L2Effect
{
static final Logger _log = Logger.getLogger(EffectEnemyCharge.class.getName());
private int _x, _y, _z;
public EffectEnemyCharge(Env env, EffectTemplate template)
{
super(env, template);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BUFF;
}
@Override
public boolean onStart()
{
// Get current position of the L2Character
final int curX = getEffector().getX();
final int curY = getEffector().getY();
final int curZ = getEffector().getZ();
// Calculate distance (dx,dy) between current position and destination
double dx = getEffected().getX() - curX;
double dy = getEffected().getY() - curY;
double dz = getEffected().getZ() - curZ;
double distance = Math.sqrt((dx * dx) + (dy * dy));
if (distance > 2000)
{
_log.info("EffectEnemyCharge was going to use invalid coordinates for characters, getEffector: " + curX + "," + curY + " and getEffected: " + getEffected().getX() + "," + getEffected().getY());
return false;
}
int offset = Math.max((int) distance - getSkill().getFlyRadius(), 30);
double cos;
double sin;
// approximation for moving closer when z coordinates are different
// TODO: handle Z axis movement better
offset -= Math.abs(dz);
if (offset < 5)
{
offset = 5;
}
// If no distance
if ((distance < 1) || ((distance - offset) <= 0))
{
return false;
}
// Calculate movement angles needed
sin = dy / distance;
cos = dx / distance;
// Calculate the new destination with offset included
_x = curX + (int) ((distance - offset) * cos);
_y = curY + (int) ((distance - offset) * sin);
_z = getEffected().getZ();
if (Config.GEODATA > 0)
{
Location destiny = GeoData.getInstance().moveCheck(getEffector().getX(), getEffector().getY(), getEffector().getZ(), _x, _y, _z, getEffector().getInstanceId());
_x = destiny.getX();
_y = destiny.getY();
}
getEffector().broadcastPacket(new FlyToLocation(getEffector(), _x, _y, _z, FlyType.CHARGE));
// maybe is need force set X,Y,Z
getEffector().setXYZ(_x, _y, _z);
getEffector().broadcastPacket(new ValidateLocation(getEffector()));
return true;
}
@Override
public boolean onActionTime()
{
return false;
}
}
@@ -0,0 +1,87 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author mkizub
*/
public class EffectFakeDeath extends L2Effect
{
public EffectFakeDeath(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.FAKE_DEATH;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().startFakeDeath();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopFakeDeath(false);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
if (getEffected().isDead())
{
return false;
}
double manaDam = calc();
if (manaDam > getEffected().getCurrentMp())
{
if (getSkill().isToggle())
{
getEffected().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
return false;
}
}
getEffected().reduceCurrentMp(manaDam);
return true;
}
}
@@ -0,0 +1,170 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2CharPosition;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.instance.L2DefenderInstance;
import com.l2jserver.gameserver.model.actor.instance.L2FortCommanderInstance;
import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
import com.l2jserver.gameserver.model.actor.instance.L2SiegeFlagInstance;
import com.l2jserver.gameserver.model.actor.instance.L2SiegeSummonInstance;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author littlecrow Implementation of the Fear Effect
*/
public class EffectFear extends L2Effect
{
public static final int FEAR_RANGE = 500;
private int _dX = -1;
private int _dY = -1;
public EffectFear(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.FEAR;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
// Fear skills cannot be used l2pcinstance to l2pcinstance. Heroic
// Dread, Curse: Fear, Fear, Horror, Sword Symphony, Word of Fear, Hell Scream and
// Mass Curse Fear are the exceptions.
if ((getEffected() instanceof L2PcInstance) && (getEffector() instanceof L2PcInstance))
{
switch (getSkill().getId())
{
case 1376:
case 1169:
case 65:
case 1092:
case 98:
case 1272:
case 1381:
case 763:
break;
default:
return false;
}
}
if ((getEffected() instanceof L2NpcInstance) || (getEffected() instanceof L2DefenderInstance) || (getEffected() instanceof L2FortCommanderInstance) || (getEffected() instanceof L2SiegeFlagInstance) || (getEffected() instanceof L2SiegeSummonInstance))
{
return false;
}
if (!getEffected().isAfraid())
{
if (getEffected().isCastingNow() && getEffected().canAbortCast())
{
getEffected().abortCast();
}
if (getEffected().getX() > getEffector().getX())
{
_dX = 1;
}
if (getEffected().getY() > getEffector().getY())
{
_dY = 1;
}
getEffected().startFear();
onActionTime();
return true;
}
return false;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopFear(false);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
int posX = getEffected().getX();
int posY = getEffected().getY();
int posZ = getEffected().getZ();
if (getEffected().getX() > getEffector().getX())
{
_dX = 1;
}
if (getEffected().getY() > getEffector().getY())
{
_dY = 1;
}
posX += _dX * FEAR_RANGE;
posY += _dY * FEAR_RANGE;
if (Config.GEODATA > 0)
{
Location destiny = GeoData.getInstance().moveCheck(getEffected().getX(), getEffected().getY(), getEffected().getZ(), posX, posY, posZ, getEffected().getInstanceId());
posX = destiny.getX();
posY = destiny.getY();
}
if (!(getEffected() instanceof L2PetInstance))
{
getEffected().setRunning();
}
getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(posX, posY, posZ, 0));
return true;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_FEAR;
}
}
@@ -0,0 +1,83 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author Kerberos
*/
public class EffectFusion extends L2Effect
{
public int _effect;
public int _maxEffect;
public EffectFusion(Env env, EffectTemplate template)
{
super(env, template);
_effect = getSkill().getLevel();
_maxEffect = SkillTable.getInstance().getMaxLevel(getSkill().getId());
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.FUSION;
}
public void increaseEffect()
{
if (_effect < _maxEffect)
{
_effect++;
updateBuff();
}
}
public void decreaseForce()
{
_effect--;
if (_effect < 1)
{
exit();
}
else
{
updateBuff();
}
}
private void updateBuff()
{
exit();
SkillTable.getInstance().getInfo(getSkill().getId(), _effect).getEffects(getEffector(), getEffected());
}
}
@@ -0,0 +1,72 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.skills.AbnormalEffect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectGrow extends L2Effect
{
public EffectGrow(Env env, EffectTemplate template)
{
super(env, template);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BUFF;
}
@Override
public boolean onStart()
{
if (getEffected() instanceof L2Npc)
{
L2Npc npc = (L2Npc) getEffected();
// TODO: Uncomment line when fix for mobs falling underground is found
// npc.setCollisionHeight((int) (npc.getCollisionHeight() * 1.24));
npc.setCollisionRadius((npc.getCollisionRadius() * 1.19));
getEffected().startAbnormalEffect(AbnormalEffect.GROW);
return true;
}
return false;
}
@Override
public boolean onActionTime()
{
return false;
}
@Override
public void onExit()
{
if (getEffected() instanceof L2Npc)
{
L2Npc npc = (L2Npc) getEffected();
// TODO: Uncomment line when fix for mobs falling underground is found
// npc.setCollisionHeight(npc.getTemplate().collisionHeight);
npc.setCollisionRadius(npc.getTemplate().fCollisionRadius);
getEffected().stopAbnormalEffect(AbnormalEffect.GROW);
}
}
}
@@ -0,0 +1,96 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jserver.gameserver.network.serverpackets.ExRegMax;
import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectHealOverTime extends L2Effect
{
public EffectHealOverTime(Env env, EffectTemplate template)
{
super(env, template);
}
// Special constructor to steal this effect
public EffectHealOverTime(Env env, L2Effect effect)
{
super(env, effect);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#effectCanBeStolen()
*/
@Override
protected boolean effectCanBeStolen()
{
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.HEAL_OVER_TIME;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().sendPacket(new ExRegMax(calc(), getTotalCount() * getAbnormalTime(), getAbnormalTime()));
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
if (getEffected().isDead())
{
return false;
}
if (getEffected() instanceof L2DoorInstance)
{
return false;
}
double hp = getEffected().getCurrentHp();
double maxhp = getEffected().getMaxHp();
hp += calc();
if (hp > maxhp)
{
hp = maxhp;
}
getEffected().setCurrentHp(hp);
StatusUpdate suhp = new StatusUpdate(getEffected());
suhp.addAttribute(StatusUpdate.CUR_HP, (int) hp);
getEffected().sendPacket(suhp);
return true;
}
}
@@ -0,0 +1,120 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.DeleteObject;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
import com.l2jserver.gameserver.skills.AbnormalEffect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author ZaKaX - nBd
*/
public class EffectHide extends L2Effect
{
public EffectHide(Env env, EffectTemplate template)
{
super(env, template);
}
public EffectHide(Env env, L2Effect effect)
{
super(env, effect);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.HIDE;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if (getEffected() instanceof L2PcInstance)
{
L2PcInstance activeChar = ((L2PcInstance) getEffected());
activeChar.getAppearance().setInvisible();
activeChar.startAbnormalEffect(AbnormalEffect.STEALTH);
if ((activeChar.getAI().getNextIntention() != null) && (activeChar.getAI().getNextIntention().getCtrlIntention() == CtrlIntention.AI_INTENTION_ATTACK))
{
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
L2GameServerPacket del = new DeleteObject(activeChar);
for (L2Character target : activeChar.getKnownList().getKnownCharacters())
{
try
{
if (target.getTarget() == activeChar)
{
target.setTarget(null);
target.abortAttack();
target.abortCast();
target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
if (target instanceof L2PcInstance)
{
target.sendPacket(del);
}
}
catch (NullPointerException e)
{
}
}
}
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
if (getEffected() instanceof L2PcInstance)
{
L2PcInstance activeChar = ((L2PcInstance) getEffected());
if (!activeChar.inObserverMode())
{
activeChar.getAppearance().setVisible();
}
activeChar.stopAbnormalEffect(AbnormalEffect.STEALTH);
}
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
}
@@ -0,0 +1,76 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author mkizub
*/
public class EffectImmobileBuff extends EffectBuff
{
public EffectImmobileBuff(Env env, EffectTemplate template)
{
super(env, template);
}
// Special constructor to steal this effect
public EffectImmobileBuff(Env env, L2Effect effect)
{
super(env, effect);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BUFF;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().setIsImmobilized(true);
return super.onStart();
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().setIsImmobilized(false);
super.onExit();
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// just stop this effect
return false;
}
}
@@ -0,0 +1,68 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author demonia
*/
public class EffectImmobilePetBuff extends L2Effect
{
private L2Summon _pet;
public EffectImmobilePetBuff(Env env, EffectTemplate template)
{
super(env, template);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BUFF;
}
@Override
public boolean onStart()
{
_pet = null;
if ((getEffected() instanceof L2Summon) && (getEffector() instanceof L2PcInstance) && (((L2Summon) getEffected()).getOwner() == getEffector()))
{
_pet = (L2Summon) getEffected();
_pet.setIsImmobilized(true);
return true;
}
return false;
}
@Override
public void onExit()
{
_pet.setIsImmobilized(false);
}
@Override
public boolean onActionTime()
{
// just stop this effect
return false;
}
}
@@ -0,0 +1,70 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author DS Effect will generate charges for L2PcInstance targets Number of charges in "value", maximum number in "count" effect variables
*/
public class EffectIncreaseCharges extends L2Effect
{
public EffectIncreaseCharges(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.INCREASE_CHARGES;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if (getEffected() == null)
{
return false;
}
if (!(getEffected() instanceof L2PcInstance))
{
return false;
}
((L2PcInstance) getEffected()).increaseCharges((int) calc(), getCount());
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false; // abort effect even if count > 1
}
}
@@ -0,0 +1,58 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectInvincible extends L2Effect
{
public EffectInvincible(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.INVINCIBLE;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// Simply stop the effect
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_INVUL;
}
}
@@ -0,0 +1,65 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectManaDamOverTime extends L2Effect
{
public EffectManaDamOverTime(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.MANA_DMG_OVER_TIME;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
if (getEffected().isDead())
{
return false;
}
double manaDam = calc();
if (manaDam > getEffected().getCurrentMp())
{
if (getSkill().isToggle())
{
getEffected().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
return false;
}
}
getEffected().reduceCurrentMp(manaDam);
return true;
}
}
@@ -0,0 +1,79 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectManaHealOverTime extends L2Effect
{
public EffectManaHealOverTime(Env env, EffectTemplate template)
{
super(env, template);
}
// Special constructor to steal this effect
public EffectManaHealOverTime(Env env, L2Effect effect)
{
super(env, effect);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#effectCanBeStolen()
*/
@Override
protected boolean effectCanBeStolen()
{
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.MANA_HEAL_OVER_TIME;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
if (getEffected().isDead())
{
return false;
}
double mp = getEffected().getCurrentMp();
double maxmp = getEffected().getMaxMp();
mp += calc();
if (mp > maxmp)
{
mp = maxmp;
}
getEffected().setCurrentMp(mp);
StatusUpdate sump = new StatusUpdate(getEffected());
sump.addAttribute(StatusUpdate.CUR_MP, (int) mp);
getEffected().sendPacket(sump);
return true;
}
}
@@ -0,0 +1,63 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectMpConsumePerLevel extends L2Effect
{
public EffectMpConsumePerLevel(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.MP_CONSUME_PER_LEVEL;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
if (getEffected().isDead())
{
return false;
}
double base = calc();
double consume = ((getEffected().getLevel() - 1) / 7.5) * base * getAbnormalTime();
if (consume > getEffected().getCurrentMp())
{
getEffected().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
return false;
}
getEffected().reduceCurrentMp(consume);
return true;
}
}
@@ -0,0 +1,77 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectMute extends L2Effect
{
public EffectMute(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.MUTE;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().startMuted();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// Simply stop the effect
return false;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopMuted(false);
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_MUTED;
}
}
@@ -0,0 +1,82 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
import com.l2jserver.gameserver.templates.skills.L2SkillType;
/**
* @author Gnat
*/
public class EffectNegate extends L2Effect
{
public EffectNegate(Env env, EffectTemplate template)
{
super(env, template);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.NEGATE;
}
@Override
public boolean onStart()
{
L2Skill skill = getSkill();
for (int negateSkillId : skill.getNegateId())
{
if (negateSkillId != 0)
{
getEffected().stopSkillEffects(negateSkillId);
}
}
for (L2SkillType negateSkillType : skill.getNegateStats())
{
getEffected().stopSkillEffects(negateSkillType, skill.getNegateLvl());
}
if (skill.getNegateAbnormals() != null)
{
for (L2Effect effect : getEffected().getAllEffects())
{
if (effect == null)
{
continue;
}
for (String negateAbnormalType : skill.getNegateAbnormals().keySet())
{
if (negateAbnormalType.equalsIgnoreCase(effect.getAbnormalType()) && (skill.getNegateAbnormals().get(negateAbnormalType) >= effect.getAbnormalLvl()))
{
effect.exit();
}
}
}
}
return true;
}
@Override
public boolean onActionTime()
{
return false;
}
}
@@ -0,0 +1,93 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author earendil
*/
public class EffectNoblesseBless extends L2Effect
{
public EffectNoblesseBless(Env env, EffectTemplate template)
{
super(env, template);
}
// Special constructor to steal this effect
public EffectNoblesseBless(Env env, L2Effect effect)
{
super(env, effect);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#effectCanBeStolen()
*/
@Override
protected boolean effectCanBeStolen()
{
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.NOBLESSE_BLESSING;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// just stop this effect
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_NOBLESS_BLESSING;
}
}
@@ -0,0 +1,95 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.AbnormalEffect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectParalyze extends L2Effect
{
public EffectParalyze(Env env, EffectTemplate template)
{
super(env, template);
}
// Special constructor to steal this effect
public EffectParalyze(Env env, L2Effect effect)
{
super(env, effect);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#effectCanBeStolen()
*/
@Override
protected boolean effectCanBeStolen()
{
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.PARALYZE;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().startAbnormalEffect(AbnormalEffect.HOLD_1);
getEffected().startParalyze();
return super.onStart();
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopAbnormalEffect(AbnormalEffect.HOLD_1);
getEffected().stopParalyze(false);
super.onExit();
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_PARALYZED;
}
}
@@ -0,0 +1,80 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.AbnormalEffect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectPetrification extends L2Effect
{
public EffectPetrification(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.PETRIFICATION;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().startAbnormalEffect(AbnormalEffect.HOLD_2);
getEffected().startParalyze();
return super.onStart();
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopAbnormalEffect(AbnormalEffect.HOLD_2);
getEffected().stopParalyze(false);
super.onExit();
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_PARALYZED | CharEffectList.EFFECT_FLAG_INVUL;
}
}
@@ -0,0 +1,83 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author Faror
*/
public class EffectPhoenixBless extends L2Effect
{
public EffectPhoenixBless(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.PHOENIX_BLESSING;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
if (getEffected() instanceof L2Playable)
{
((L2Playable) getEffected()).stopPhoenixBlessing(this);
}
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// just stop this effect
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_PHOENIX_BLESSING;
}
}
@@ -0,0 +1,80 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author -Rnn-
*/
public class EffectPhysicalAttackMute extends L2Effect
{
public EffectPhysicalAttackMute(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.PHYSICAL_ATTACK_MUTE;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().startPhysicalAttackMuted();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// Simply stop the effect
return false;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopPhysicalAttackMuted(this);
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_PSYCHICAL_ATTACK_MUTED;
}
}
@@ -0,0 +1,80 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author -Nemesiss-
*/
public class EffectPhysicalMute extends L2Effect
{
public EffectPhysicalMute(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.PHYSICAL_MUTE;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().startPsychicalMuted();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// Simply stop the effect
return false;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopPsychicalMuted(false);
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_PSYCHICAL_MUTED;
}
}
@@ -0,0 +1,70 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author kerberos_20
*/
public class EffectProtectionBlessing extends L2Effect
{
public EffectProtectionBlessing(Env env, EffectTemplate template)
{
super(env, template);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.PROTECTION_BLESSING;
}
/** Notify started */
@Override
public boolean onStart()
{
return false;
}
/** Notify exited */
@Override
public void onExit()
{
((L2Playable) getEffected()).stopProtectionBlessing(this);
}
@Override
public boolean onActionTime()
{
// just stop this effect
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_PROTECTION_BLESSING;
}
}
@@ -0,0 +1,72 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author Kerberos
*/
public class EffectRecovery extends L2Effect
{
public EffectRecovery(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.BUFF;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if (getEffected() instanceof L2PcInstance)
{
((L2PcInstance) getEffected()).reduceDeathPenaltyBuffLevel();
return true;
}
return false;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
}
@@ -0,0 +1,121 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectRelax extends L2Effect
{
public EffectRelax(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.RELAXING;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if (getEffected() instanceof L2PcInstance)
{
((L2PcInstance) getEffected()).sitDown(false);
}
else
{
getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_REST);
}
return super.onStart();
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
super.onExit();
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
if (getEffected().isDead())
{
return false;
}
if (getEffected() instanceof L2PcInstance)
{
if (!((L2PcInstance) getEffected()).isSitting())
{
return false;
}
}
if ((getEffected().getCurrentHp() + 1) > getEffected().getMaxHp())
{
if (getSkill().isToggle())
{
getEffected().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_DEACTIVATED_HP_FULL));
return false;
}
}
double manaDam = calc();
if (manaDam > getEffected().getCurrentMp())
{
if (getSkill().isToggle())
{
getEffected().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
return false;
}
}
getEffected().reduceCurrentMp(manaDam);
return true;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_RELAXING;
}
}
@@ -0,0 +1,73 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author -Nemesiss-
*/
public class EffectRemoveTarget extends L2Effect
{
public EffectRemoveTarget(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.REMOVE_TARGET;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().setTarget(null);
getEffected().abortAttack();
getEffected().abortCast();
getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, getEffector());
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
// nothing
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// nothing
return false;
}
}
@@ -0,0 +1,68 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author mkizub
*/
public class EffectRoot extends L2Effect
{
public EffectRoot(Env env, EffectTemplate template)
{
super(env, template);
}
@Override
public L2EffectType getEffectType()
{
return L2EffectType.ROOT;
}
@Override
public boolean onStart()
{
getEffected().startRooted();
return true;
}
@Override
public void onExit()
{
getEffected().stopRooting(false);
}
@Override
public boolean onActionTime()
{
// just stop this effect
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_ROOTED;
}
}
@@ -0,0 +1,131 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import javolution.util.FastList;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2EffectPointInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.skills.l2skills.L2SkillSignet;
import com.l2jserver.gameserver.skills.l2skills.L2SkillSignetCasttime;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @authors Forsaiken, Sami
*/
public class EffectSignet extends L2Effect
{
private L2Skill _skill;
private L2EffectPointInstance _actor;
private boolean _srcInArena;
public EffectSignet(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.SIGNET_EFFECT;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if (getSkill() instanceof L2SkillSignet)
{
_skill = SkillTable.getInstance().getInfo(((L2SkillSignet) getSkill()).effectId, getLevel());
}
else if (getSkill() instanceof L2SkillSignetCasttime)
{
_skill = SkillTable.getInstance().getInfo(((L2SkillSignetCasttime) getSkill()).effectId, getLevel());
}
_actor = (L2EffectPointInstance) getEffected();
_srcInArena = (getEffector().isInsideZone(L2Character.ZONE_PVP) && !getEffector().isInsideZone(L2Character.ZONE_SIEGE));
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
if (_skill == null)
{
return true;
}
int mpConsume = _skill.getMpConsume();
if (mpConsume > getEffector().getCurrentMp())
{
getEffector().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
return false;
}
getEffector().reduceCurrentMp(mpConsume);
FastList<L2Character> targets = FastList.newInstance();
for (L2Character cha : _actor.getKnownList().getKnownCharactersInRadius(getSkill().getSkillRadius()))
{
if (cha == null)
{
continue;
}
if (_skill.isOffensive() && !L2Skill.checkForAreaOffensiveSkills(getEffector(), cha, _skill, _srcInArena))
{
continue;
}
// there doesn't seem to be a visible effect with MagicSkillLaunched packet...
_actor.broadcastPacket(new MagicSkillUse(_actor, cha, _skill.getId(), _skill.getLevel(), 0, 0));
targets.add(cha);
}
if (!targets.isEmpty())
{
getEffector().callSkill(_skill, targets.toArray(new L2Character[targets.size()]));
}
FastList.recycle(targets);
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
if (_actor != null)
{
_actor.deleteMe();
}
}
}
@@ -0,0 +1,125 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2EffectPointInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author Forsaiken
*/
public class EffectSignetAntiSummon extends L2Effect
{
private L2EffectPointInstance _actor;
public EffectSignetAntiSummon(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.SIGNET_GROUND;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
_actor = (L2EffectPointInstance) getEffected();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
if (getCount() == (getTotalCount() - 1))
{
return true; // do nothing first time
}
int mpConsume = getSkill().getMpConsume();
L2PcInstance caster = (L2PcInstance) getEffector();
for (L2Character cha : _actor.getKnownList().getKnownCharactersInRadius(getSkill().getSkillRadius()))
{
if (cha == null)
{
continue;
}
if (cha instanceof L2Playable)
{
if (caster.canAttackCharacter(cha))
{
L2PcInstance owner = null;
if (cha instanceof L2Summon)
{
owner = ((L2Summon) cha).getOwner();
}
else
{
owner = (L2PcInstance) cha;
}
if ((owner != null) && (owner.getPet() != null))
{
if (mpConsume > getEffector().getCurrentMp())
{
getEffector().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
return false;
}
getEffector().reduceCurrentMp(mpConsume);
owner.getPet().unSummon(owner);
owner.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, getEffector());
}
}
}
}
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
if (_actor != null)
{
_actor.deleteMe();
}
}
}
@@ -0,0 +1,220 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @author Forsaiken
*/
package com.l2jserver.gameserver.skills.effects;
import javolution.util.FastList;
import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.datatables.NpcTable;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.L2ItemInstance;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.actor.L2Attackable;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2EffectPointInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.MagicSkillLaunched;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.skills.Formulas;
import com.l2jserver.gameserver.skills.l2skills.L2SkillSignetCasttime;
import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
import com.l2jserver.util.Point3D;
public class EffectSignetMDam extends L2Effect
{
private L2EffectPointInstance _actor;
public EffectSignetMDam(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.SIGNET_GROUND;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
L2NpcTemplate template;
if (getSkill() instanceof L2SkillSignetCasttime)
{
template = NpcTable.getInstance().getTemplate(((L2SkillSignetCasttime) getSkill())._effectNpcId);
}
else
{
return false;
}
L2EffectPointInstance effectPoint = new L2EffectPointInstance(IdFactory.getInstance().getNextId(), template, getEffector());
effectPoint.setCurrentHp(effectPoint.getMaxHp());
effectPoint.setCurrentMp(effectPoint.getMaxMp());
// L2World.getInstance().storeObject(effectPoint);
int x = getEffector().getX();
int y = getEffector().getY();
int z = getEffector().getZ();
if ((getEffector() instanceof L2PcInstance) && (getSkill().getTargetType() == L2Skill.SkillTargetType.TARGET_GROUND))
{
Point3D wordPosition = ((L2PcInstance) getEffector()).getCurrentSkillWorldPosition();
if (wordPosition != null)
{
x = wordPosition.getX();
y = wordPosition.getY();
z = wordPosition.getZ();
}
}
effectPoint.setIsInvul(true);
effectPoint.spawnMe(x, y, z);
_actor = effectPoint;
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
if (getCount() >= (getTotalCount() - 2))
{
return true; // do nothing first 2 times
}
int mpConsume = getSkill().getMpConsume();
L2PcInstance caster = (L2PcInstance) getEffector();
boolean ss = false;
boolean bss = false;
L2ItemInstance weaponInst = caster.getActiveWeaponInstance();
if (weaponInst != null)
{
switch (weaponInst.getChargedSpiritshot())
{
case L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT:
weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
bss = true;
break;
case L2ItemInstance.CHARGED_SPIRITSHOT:
weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
ss = true;
break;
}
}
FastList<L2Character> targets = new FastList<>();
for (L2Character cha : _actor.getKnownList().getKnownCharactersInRadius(getSkill().getSkillRadius()))
{
if ((cha == null) || (cha == caster))
{
continue;
}
if ((cha instanceof L2Attackable) || (cha instanceof L2Playable))
{
if (cha.isAlikeDead())
{
continue;
}
if (mpConsume > caster.getCurrentMp())
{
caster.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
return false;
}
caster.reduceCurrentMp(mpConsume);
if (cha instanceof L2Playable)
{
if (caster.canAttackCharacter(cha))
{
targets.add(cha);
caster.updatePvPStatus(cha);
}
}
else
{
targets.add(cha);
}
}
}
if (!targets.isEmpty())
{
caster.broadcastPacket(new MagicSkillLaunched(caster, getSkill().getId(), getSkill().getLevel(), targets.toArray(new L2Character[targets.size()])));
for (L2Character target : targets)
{
boolean mcrit = Formulas.calcMCrit(caster.getMCriticalHit(target, getSkill()));
byte shld = Formulas.calcShldUse(caster, target, getSkill());
int mdam = (int) Formulas.calcMagicDam(caster, target, getSkill(), shld, ss, bss, mcrit);
if (target instanceof L2Summon)
{
target.broadcastStatusUpdate();
}
if (mdam > 0)
{
if (!target.isRaid() && Formulas.calcAtkBreak(target, mdam))
{
target.breakAttack();
target.breakCast();
}
caster.sendDamageMessage(target, mdam, mcrit, false, false);
target.reduceCurrentHp(mdam, caster, getSkill());
}
target.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, caster);
}
}
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
if (_actor != null)
{
_actor.deleteMe();
}
}
}
@@ -0,0 +1,106 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2EffectPointInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @authors Forsaiken, Sami
*/
public class EffectSignetNoise extends L2Effect
{
private L2EffectPointInstance _actor;
public EffectSignetNoise(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.SIGNET_GROUND;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
_actor = (L2EffectPointInstance) getEffected();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
if (getCount() == (getTotalCount() - 1))
{
return true; // do nothing first time
}
L2PcInstance caster = (L2PcInstance) getEffector();
for (L2Character target : _actor.getKnownList().getKnownCharactersInRadius(getSkill().getSkillRadius()))
{
if ((target == null) || (target == caster))
{
continue;
}
if (caster.canAttackCharacter(target))
{
L2Effect[] effects = target.getAllEffects();
if (effects != null)
{
for (L2Effect effect : effects)
{
if (effect.getSkill().isDance())
{
effect.exit();
}
}
}
}
}
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
if (_actor != null)
{
_actor.deleteMe();
}
}
}
@@ -0,0 +1,78 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectSilenceMagicPhysical extends L2Effect
{
public EffectSilenceMagicPhysical(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.SILENCE_MAGIC_PHYSICAL;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().startMuted();
getEffected().startPsychicalMuted();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopMuted(false);
getEffected().stopPsychicalMuted(false);
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_MUTED | CharEffectList.EFFECT_FLAG_PSYCHICAL_MUTED;
}
}
@@ -0,0 +1,114 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
import com.l2jserver.gameserver.templates.skills.L2SkillType;
public class EffectSilentMove extends L2Effect
{
public EffectSilentMove(Env env, EffectTemplate template)
{
super(env, template);
}
// Special constructor to steal this effect
public EffectSilentMove(Env env, L2Effect effect)
{
super(env, effect);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#effectCanBeStolen()
*/
@Override
protected boolean effectCanBeStolen()
{
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
super.onStart();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
super.onExit();
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.SILENT_MOVE;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// Only cont skills shouldn't end
if (getSkill().getSkillType() != L2SkillType.CONT)
{
return false;
}
if (getEffected().isDead())
{
return false;
}
double manaDam = calc();
if (manaDam > getEffected().getCurrentMp())
{
getEffected().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
return false;
}
getEffected().reduceCurrentMp(manaDam);
return true;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_SILENT_MOVE;
}
}
@@ -0,0 +1,80 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author mkizub
*/
public class EffectSleep extends L2Effect
{
public EffectSleep(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.SLEEP;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().startSleeping();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopSleeping(false);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// just stop this effect
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_SLEEP;
}
}
@@ -0,0 +1,103 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.skills.Formulas;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author Ahmed This is the Effect support for spoil. This was originally done by _drunk_
*/
public class EffectSpoil extends L2Effect
{
public EffectSpoil(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.SPOIL;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if (!(getEffector() instanceof L2PcInstance))
{
return false;
}
if (!(getEffected() instanceof L2MonsterInstance))
{
return false;
}
L2MonsterInstance target = (L2MonsterInstance) getEffected();
if (target == null)
{
return false;
}
if (target.isSpoil())
{
getEffector().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ALREADY_SPOILED));
return false;
}
// SPOIL SYSTEM by Lbaldi
boolean spoil = false;
if (target.isDead() == false)
{
spoil = Formulas.calcMagicSuccess(getEffector(), target, getSkill());
if (spoil)
{
target.setSpoil(true);
target.setIsSpoiledBy(getEffector().getObjectId());
getEffector().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SPOIL_SUCCESS));
}
target.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, getEffector());
}
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
}
@@ -0,0 +1,80 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author mkizub
*/
public class EffectStun extends L2Effect
{
public EffectStun(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.STUN;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffected().startStunning();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopStunning(false);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// just stop this effect
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_STUNNED;
}
}
@@ -0,0 +1,83 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectStunSelf extends L2Effect
{
public EffectStunSelf(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.STUN_SELF;
}
@Override
public boolean isSeflEffectType()
{
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
getEffector().startStunning();
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffector().stopStunning(false);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// just stop this effect
return false;
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_STUNNED;
}
}
@@ -0,0 +1,100 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.L2Attackable;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2SiegeSummonInstance;
import com.l2jserver.gameserver.network.serverpackets.MyTargetSelected;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author -Nemesiss-
*/
public class EffectTargetMe extends L2Effect
{
public EffectTargetMe(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.TARGET_ME;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if (getEffected() instanceof L2Playable)
{
if (getEffected() instanceof L2SiegeSummonInstance)
{
return false;
}
if (getEffected().getTarget() != getEffector())
{
// Target is different
getEffected().setTarget(getEffector());
if (getEffected() instanceof L2PcInstance)
{
getEffected().sendPacket(new MyTargetSelected(getEffector().getObjectId(), 0));
}
}
((L2Playable) getEffected()).setLockedTarget(getEffector());
return true;
}
else if ((getEffected() instanceof L2Attackable) && !getEffected().isRaid())
{
return true;
}
return false;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
if (getEffected() instanceof L2Playable)
{
((L2Playable) getEffected()).setLockedTarget(null);
}
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
// nothing
return false;
}
}
@@ -0,0 +1,140 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import java.util.logging.Logger;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.model.CharEffectList;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.network.serverpackets.FlyToLocation;
import com.l2jserver.gameserver.network.serverpackets.FlyToLocation.FlyType;
import com.l2jserver.gameserver.network.serverpackets.ValidateLocation;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
public class EffectThrowUp extends L2Effect
{
static final Logger _log = Logger.getLogger(EffectThrowUp.class.getName());
private int _x, _y, _z;
public EffectThrowUp(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.THROW_UP;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
// Get current position of the L2Character
final int curX = getEffected().getX();
final int curY = getEffected().getY();
final int curZ = getEffected().getZ();
// Calculate distance between effector and effected current position
double dx = getEffector().getX() - curX;
double dy = getEffector().getY() - curY;
double dz = getEffector().getZ() - curZ;
double distance = Math.sqrt((dx * dx) + (dy * dy));
if (distance > 2000)
{
_log.info("EffectThrow was going to use invalid coordinates for characters, getEffected: " + curX + "," + curY + " and getEffector: " + getEffector().getX() + "," + getEffector().getY());
return false;
}
int offset = Math.min((int) distance + getSkill().getFlyRadius(), 1400);
double cos;
double sin;
// approximation for moving futher when z coordinates are different
// TODO: handle Z axis movement better
offset += Math.abs(dz);
if (offset < 5)
{
offset = 5;
}
// If no distance
if (distance < 1)
{
return false;
}
// Calculate movement angles needed
sin = dy / distance;
cos = dx / distance;
// Calculate the new destination with offset included
_x = getEffector().getX() - (int) (offset * cos);
_y = getEffector().getY() - (int) (offset * sin);
_z = getEffected().getZ();
if (Config.GEODATA > 0)
{
Location destiny = GeoData.getInstance().moveCheck(getEffected().getX(), getEffected().getY(), getEffected().getZ(), _x, _y, _z, getEffected().getInstanceId());
_x = destiny.getX();
_y = destiny.getY();
}
getEffected().startStunning();
getEffected().broadcastPacket(new FlyToLocation(getEffected(), _x, _y, _z, FlyType.THROW_UP));
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
*/
@Override
public void onExit()
{
getEffected().stopStunning(false);
getEffected().setXYZ(_x, _y, _z);
getEffected().broadcastPacket(new ValidateLocation(getEffected()));
}
/*
* (non-Javadoc)
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
*/
@Override
public int getEffectFlags()
{
return CharEffectList.EFFECT_FLAG_STUNNED;
}
}
@@ -0,0 +1,98 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.gameserver.instancemanager.TransformationManager;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
/**
* @author nBd
*/
public class EffectTransformation extends L2Effect
{
public EffectTransformation(Env env, EffectTemplate template)
{
super(env, template);
}
// Special constructor to steal this effect
public EffectTransformation(Env env, L2Effect effect)
{
super(env, effect);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.TRANSFORMATION;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
if (!(getEffected() instanceof L2PcInstance))
{
return false;
}
L2PcInstance trg = (L2PcInstance) getEffected();
if (trg == null)
{
return false;
}
if (trg.isAlikeDead() || trg.isCursedWeaponEquipped())
{
return false;
}
if (trg.getTransformation() != null)
{
trg.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN));
return false;
}
TransformationManager.getInstance().transformPlayer(getSkill().getTransformId(), trg);
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
@Override
public void onExit()
{
getEffected().stopTransformation(false);
}
}
@@ -0,0 +1,115 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.skills.effects;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.network.serverpackets.FlyToLocation;
import com.l2jserver.gameserver.network.serverpackets.FlyToLocation.FlyType;
import com.l2jserver.gameserver.network.serverpackets.ValidateLocation;
import com.l2jserver.gameserver.skills.Env;
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
import com.l2jserver.gameserver.util.Util;
/**
* This class handles warp effects, disappear and quickly turn up in a near location. If geodata enabled and an object is between initial and final point, flight is stopped just before colliding with object. Flight course and radius are set as skill properties (flyCourse and flyRadius): <li>Fly
* Radius means the distance between starting point and final point, it must be an integer.</li> <li>Fly Course means the movement direction: imagine a compass above player's head, making north player's heading. So if fly course is 180, player will go backwards (good for blink, e.g.). By the way, if
* flyCourse = 360 or 0, player will be moved in in front of him. <br>
* <br>
* If target is effector, put in XML self = "1". This will make _actor = getEffector(). This, combined with target type, allows more complex actions like flying target's backwards or player's backwards.<br>
* <br>
* @author House
*/
public class EffectWarp extends L2Effect
{
private int x, y, z;
private L2Character _actor;
public EffectWarp(Env env, EffectTemplate template)
{
super(env, template);
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
*/
@Override
public L2EffectType getEffectType()
{
return L2EffectType.WARP;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
*/
@Override
public boolean onStart()
{
_actor = isSelfEffect() ? getEffector() : getEffected();
if (_actor.isMovementDisabled())
{
return false;
}
int _radius = getSkill().getFlyRadius();
double angle = Util.convertHeadingToDegree(_actor.getHeading());
double radian = Math.toRadians(angle);
double course = Math.toRadians(getSkill().getFlyCourse());
int x1 = (int) (Math.cos(Math.PI + radian + course) * _radius);
int y1 = (int) (Math.sin(Math.PI + radian + course) * _radius);
x = _actor.getX() + x1;
y = _actor.getY() + y1;
z = _actor.getZ();
if (Config.GEODATA > 0)
{
Location destiny = GeoData.getInstance().moveCheck(_actor.getX(), _actor.getY(), _actor.getZ(), x, y, z, _actor.getInstanceId());
x = destiny.getX();
y = destiny.getY();
z = destiny.getZ();
}
// TODO: check if this AI intention is retail-like. This stops player's
// previous movement
_actor.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
_actor.broadcastPacket(new FlyToLocation(_actor, x, y, z, FlyType.DUMMY));
_actor.abortAttack();
_actor.abortCast();
_actor.setXYZ(x, y, z);
_actor.broadcastPacket(new ValidateLocation(_actor));
return true;
}
/**
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
*/
@Override
public boolean onActionTime()
{
return false;
}
}