Sync with L2jServer HighFive Jun 14th 2015.
This commit is contained in:
@ -18,12 +18,8 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.GeoData;
|
||||
import com.l2jserver.gameserver.ai.CtrlEvent;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.enums.Race;
|
||||
import com.l2jserver.gameserver.model.Location;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2DefenderInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2FortCommanderInstance;
|
||||
@ -33,7 +29,6 @@ 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.
|
||||
@ -41,8 +36,6 @@ import com.l2jserver.gameserver.util.Util;
|
||||
*/
|
||||
public final class Fear extends AbstractEffect
|
||||
{
|
||||
public static final int FEAR_RANGE = 500;
|
||||
|
||||
public Fear(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
||||
{
|
||||
super(attachCond, applyCond, set, params);
|
||||
@ -77,7 +70,7 @@ public final class Fear extends AbstractEffect
|
||||
@Override
|
||||
public boolean onActionTime(BuffInfo info)
|
||||
{
|
||||
fearAction(info, false);
|
||||
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID, info.getEffector(), false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -89,34 +82,6 @@ public final class Fear extends AbstractEffect
|
||||
info.getEffected().abortCast();
|
||||
}
|
||||
|
||||
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()));
|
||||
|
||||
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 (!info.getEffected().isPet())
|
||||
{
|
||||
info.getEffected().setRunning();
|
||||
}
|
||||
|
||||
// If pathfinding enabled the creature will go to the defined destination (retail like).
|
||||
// Otherwise it will go to the nearest obstacle.
|
||||
final Location destination;
|
||||
if (Config.PATHFINDING > 0)
|
||||
{
|
||||
destination = new Location(posX, posY, posZ, info.getEffected().getInstanceId());
|
||||
}
|
||||
else
|
||||
{
|
||||
destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId());
|
||||
}
|
||||
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
|
||||
info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID, info.getEffector(), true);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user