Monsters teleport back to spawn.

This commit is contained in:
MobiusDev
2018-04-18 18:16:14 +00:00
parent 19160dfd8f
commit 30bb3a55b5
29 changed files with 90 additions and 114 deletions

View File

@ -505,7 +505,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
// Chance to forget attackers after some time
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.nextInt(500) == 0) && npc.canStopAttackByTime())
if ((npc.getCurrentHp() == npc.getMaxHp()) && (npc.getCurrentMp() == npc.getMaxMp()) && !npc.getAttackByList().isEmpty() && (Rnd.nextInt(500) == 0))
{
npc.clearAggroList();
npc.getAttackByList().clear();
@ -661,11 +661,15 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
// Check if target is dead or if timeout is expired to stop this attack
if ((target == null) || target.isAlikeDead() || ((_attackTimeout < GameTimeController.getInstance().getGameTicks()) && npc.canStopAttackByTime()))
if ((target == null) || target.isAlikeDead())
{
// Stop hating this target after the attack timeout or if target is dead
npc.stopHating(target);
return;
}
if (_attackTimeout < GameTimeController.getInstance().getGameTicks())
{
// Set the AI Intention to AI_INTENTION_ACTIVE
setIntention(AI_INTENTION_ACTIVE);
@ -673,6 +677,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{
npc.setWalking();
}
// Monster teleport to spawn
if (npc.isMonster() && (npc.getSpawn() != null))
{
npc.teleToLocation(npc.getSpawn(), false);
}
return;
}

View File

@ -93,7 +93,6 @@ public class L2Attackable extends L2Npc
private boolean _isReturningToSpawnPoint = false;
private boolean _canReturnToSpawnPoint = true;
private boolean _seeThroughSilentMove = false;
private boolean _canStopAttackByTime = true;
// Manor
private boolean _seeded = false;
private L2Seed _seed = null;
@ -182,16 +181,6 @@ public class L2Attackable extends L2Npc
_seeThroughSilentMove = val;
}
public boolean canStopAttackByTime()
{
return _canStopAttackByTime;
}
public void setCanStopAttackByTime(boolean val)
{
_canStopAttackByTime = val;
}
/**
* Use the skill if minimum checks are pass.
* @param skill the skill