Skip to content
Snippets Groups Projects
Commit e4fd1a08 authored by Zoey76's avatar Zoey76
Browse files

Updating Fear effect to use Pathfinding

parent a873365c
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package handlers.effecthandlers; package handlers.effecthandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData; import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlEvent; import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.ai.CtrlIntention;
...@@ -105,7 +106,17 @@ public final class Fear extends AbstractEffect ...@@ -105,7 +106,17 @@ public final class Fear extends AbstractEffect
info.getEffected().setRunning(); info.getEffected().setRunning();
} }
final Location destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId()); // 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().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
} }
} }
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