Skip to content
Snippets Groups Projects
Commit a68af355 authored by Nos's avatar Nos
Browse files

BETA: Reworked `Fear` effect movement effected now runs a straight line away...

BETA: Reworked `Fear` effect movement effected now runs a straight line away from effector as long as effect lasts.

Reported by: Tavo22
Reviewed by: !UnAfraid
parent 79f286bf
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@ import com.l2jserver.gameserver.model.effects.AbstractEffect;
import com.l2jserver.gameserver.model.effects.EffectFlag;
import com.l2jserver.gameserver.model.effects.L2EffectType;
import com.l2jserver.gameserver.model.skills.BuffInfo;
import com.l2jserver.gameserver.util.Util;
/**
* Fear effect implementation.
......@@ -70,27 +71,38 @@ public final class Fear extends AbstractEffect
return L2EffectType.FEAR;
}
@Override
public int getTicks()
{
return 5;
}
@Override
public boolean onActionTime(BuffInfo info)
{
int posX = info.getEffected().getX();
int posY = info.getEffected().getY();
int posZ = info.getEffected().getZ();
int _dX = -1;
int _dY = -1;
if (info.getEffected().getX() > info.getEffector().getX())
fearAction(info, false);
return false;
}
@Override
public void onStart(BuffInfo info)
{
if (info.getEffected().isCastingNow() && info.getEffected().canAbortCast())
{
_dX = 1;
info.getEffected().abortCast();
}
if (info.getEffected().getY() > info.getEffector().getY())
{
_dY = 1;
}
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID);
fearAction(info, true);
}
private void fearAction(BuffInfo info, boolean start)
{
double radians = Math.toRadians(start ? Util.calculateAngleFrom(info.getEffector(), info.getEffected()) : Util.convertHeadingToDegree(info.getEffected().getHeading()));
posX += _dX * FEAR_RANGE;
posY += _dY * FEAR_RANGE;
int posX = (int) (info.getEffected().getX() + (FEAR_RANGE * Math.cos(radians)));
int posY = (int) (info.getEffected().getY() + (FEAR_RANGE * Math.sin(radians)));
int posZ = info.getEffected().getZ();
if (Config.GEODATA > 0)
{
......@@ -105,18 +117,5 @@ public final class Fear extends AbstractEffect
}
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, posZ));
return false;
}
@Override
public void onStart(BuffInfo info)
{
if (info.getEffected().isCastingNow() && info.getEffected().canAbortCast())
{
info.getEffected().abortCast();
}
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID);
onActionTime(info);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment