From ad2ed11f9eb91ede510dd1e390e988cbad1e1c21 Mon Sep 17 00:00:00 2001 From: mobius <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 2 Jan 2015 12:07:01 +0000 Subject: [PATCH] Monster teleport to spawn. --- .../l2jserver/gameserver/ai/L2AttackableAI.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/trunk/java/com/l2jserver/gameserver/ai/L2AttackableAI.java b/trunk/java/com/l2jserver/gameserver/ai/L2AttackableAI.java index 00fdf5422a..85270f89ef 100644 --- a/trunk/java/com/l2jserver/gameserver/ai/L2AttackableAI.java +++ b/trunk/java/com/l2jserver/gameserver/ai/L2AttackableAI.java @@ -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