Monster teleport to spawn.

This commit is contained in:
mobius 2015-01-02 12:07:01 +00:00
parent 26a4c1480c
commit ad2ed11f9e

View File

@ -686,7 +686,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
L2Character originalAttackTarget = getAttackTarget();
// Check if target is dead or if timeout is expired to stop this attack
if ((originalAttackTarget == null) || originalAttackTarget.isAlikeDead() || ((_attackTimeout < GameTimeController.getInstance().getGameTicks()) && npc.canStopAttackByTime()))
if ((originalAttackTarget == null) || originalAttackTarget.isAlikeDead())
{
// Stop hating this target after the attack timeout or if target is dead
if (originalAttackTarget != null)
@ -701,6 +701,21 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
return;
}
if ((_attackTimeout < GameTimeController.getInstance().getGameTicks()) && npc.canStopAttackByTime())
{
// Set the AI Intention to AI_INTENTION_ACTIVE
setIntention(AI_INTENTION_ACTIVE);
npc.setWalking();
// Monster teleport to spawn
if (npc.isMonster() && (npc.getSpawn() != null))
{
npc.teleToLocation(npc.getSpawn(), false);
}
return;
}
final int collision = npc.getTemplate().getCollisionRadius();
// Handle all L2Object of its Faction inside the Faction Range