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

@ -140,7 +140,6 @@ public final class Wastelands extends AbstractNpcAI
{ {
guard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack guard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
monster.reduceCurrentHp(1, guard, null); monster.reduceCurrentHp(1, guard, null);
guard.setCanStopAttackByTime(false);
if ((guard.getId() != COMMANDO) && (guard.getId() != COMMANDO_CAPTAIN)) if ((guard.getId() != COMMANDO) && (guard.getId() != COMMANDO_CAPTAIN))
{ {
@ -161,7 +160,6 @@ public final class Wastelands extends AbstractNpcAI
{ {
decoGuard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack decoGuard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
monster.reduceCurrentHp(1, decoGuard, null); monster.reduceCurrentHp(1, decoGuard, null);
decoGuard.setCanStopAttackByTime(false);
decoGuard.setIsInvul(true); decoGuard.setIsInvul(true);
} }
} }
@ -303,7 +301,6 @@ public final class Wastelands extends AbstractNpcAI
commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack
sakum.reduceCurrentHp(1, commander, null); sakum.reduceCurrentHp(1, commander, null);
commander.setCanStopAttackByTime(false);
notifyEvent("START_ATTACK", commander, null); notifyEvent("START_ATTACK", commander, null);
} }
@ -319,7 +316,6 @@ public final class Wastelands extends AbstractNpcAI
commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack
sakum.reduceCurrentHp(1, commander, null); sakum.reduceCurrentHp(1, commander, null);
commander.setCanStopAttackByTime(false);
notifyEvent("START_ATTACK", commander, null); notifyEvent("START_ATTACK", commander, null);
} }

View File

@ -521,7 +521,6 @@ public class Lindvior extends AbstractNpcAI
} }
case LYN_DRACO_ATTACKER_GENERATORS: case LYN_DRACO_ATTACKER_GENERATORS:
{ {
((L2Attackable) npc).setCanStopAttackByTime(false);
((L2Attackable) npc).setCanReturnToSpawnPoint(false); ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("attack_generator", 10000, npc, null, true); startQuestTimer("attack_generator", 10000, npc, null, true);
break; break;

View File

@ -228,7 +228,6 @@ public final class ChamberOfProphecies extends AbstractInstance
{ {
npc.setRunning(); npc.setRunning();
((L2Attackable) npc).setCanReturnToSpawnPoint(false); ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
((L2Attackable) npc).setCanStopAttackByTime(false);
if (npc.isScriptValue(0) && world.getAliveNpcs(L2MonsterInstance.class).isEmpty()) if (npc.isScriptValue(0) && world.getAliveNpcs(L2MonsterInstance.class).isEmpty())
{ {
npc.setTarget(player); npc.setTarget(player);

View File

@ -300,7 +300,6 @@ public class NornilsGarden extends AbstractInstance
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId())))
{ {
((L2Attackable) npc).setCanStopAttackByTime(false);
((L2Attackable) npc).setCanReturnToSpawnPoint(false); ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("check_agrro", 1000, npc, null, true); startQuestTimer("check_agrro", 1000, npc, null, true);
} }

View File

@ -505,7 +505,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
} }
// Chance to forget attackers after some time // 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.clearAggroList();
npc.getAttackByList().clear(); 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 // 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 // Stop hating this target after the attack timeout or if target is dead
npc.stopHating(target); npc.stopHating(target);
return;
}
if (_attackTimeout < GameTimeController.getInstance().getGameTicks())
{
// Set the AI Intention to AI_INTENTION_ACTIVE // Set the AI Intention to AI_INTENTION_ACTIVE
setIntention(AI_INTENTION_ACTIVE); setIntention(AI_INTENTION_ACTIVE);
@ -673,6 +677,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{ {
npc.setWalking(); npc.setWalking();
} }
// Monster teleport to spawn
if (npc.isMonster() && (npc.getSpawn() != null))
{
npc.teleToLocation(npc.getSpawn(), false);
}
return; return;
} }

View File

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

View File

@ -140,7 +140,6 @@ public final class Wastelands extends AbstractNpcAI
{ {
guard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack guard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
monster.reduceCurrentHp(1, guard, null); monster.reduceCurrentHp(1, guard, null);
guard.setCanStopAttackByTime(false);
if ((guard.getId() != COMMANDO) && (guard.getId() != COMMANDO_CAPTAIN)) if ((guard.getId() != COMMANDO) && (guard.getId() != COMMANDO_CAPTAIN))
{ {
@ -161,7 +160,6 @@ public final class Wastelands extends AbstractNpcAI
{ {
decoGuard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack decoGuard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
monster.reduceCurrentHp(1, decoGuard, null); monster.reduceCurrentHp(1, decoGuard, null);
decoGuard.setCanStopAttackByTime(false);
decoGuard.setIsInvul(true); decoGuard.setIsInvul(true);
} }
} }
@ -303,7 +301,6 @@ public final class Wastelands extends AbstractNpcAI
commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack
sakum.reduceCurrentHp(1, commander, null); sakum.reduceCurrentHp(1, commander, null);
commander.setCanStopAttackByTime(false);
notifyEvent("START_ATTACK", commander, null); notifyEvent("START_ATTACK", commander, null);
} }
@ -319,7 +316,6 @@ public final class Wastelands extends AbstractNpcAI
commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack
sakum.reduceCurrentHp(1, commander, null); sakum.reduceCurrentHp(1, commander, null);
commander.setCanStopAttackByTime(false);
notifyEvent("START_ATTACK", commander, null); notifyEvent("START_ATTACK", commander, null);
} }

View File

@ -521,7 +521,6 @@ public class Lindvior extends AbstractNpcAI
} }
case LYN_DRACO_ATTACKER_GENERATORS: case LYN_DRACO_ATTACKER_GENERATORS:
{ {
((L2Attackable) npc).setCanStopAttackByTime(false);
((L2Attackable) npc).setCanReturnToSpawnPoint(false); ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("attack_generator", 10000, npc, null, true); startQuestTimer("attack_generator", 10000, npc, null, true);
break; break;

View File

@ -228,7 +228,6 @@ public final class ChamberOfProphecies extends AbstractInstance
{ {
npc.setRunning(); npc.setRunning();
((L2Attackable) npc).setCanReturnToSpawnPoint(false); ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
((L2Attackable) npc).setCanStopAttackByTime(false);
if (npc.isScriptValue(0) && world.getAliveNpcs(L2MonsterInstance.class).isEmpty()) if (npc.isScriptValue(0) && world.getAliveNpcs(L2MonsterInstance.class).isEmpty())
{ {
npc.setTarget(player); npc.setTarget(player);

View File

@ -300,7 +300,6 @@ public class NornilsGarden extends AbstractInstance
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId())))
{ {
((L2Attackable) npc).setCanStopAttackByTime(false);
((L2Attackable) npc).setCanReturnToSpawnPoint(false); ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("check_agrro", 1000, npc, null, true); startQuestTimer("check_agrro", 1000, npc, null, true);
} }

View File

@ -505,7 +505,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
} }
// Chance to forget attackers after some time // 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.clearAggroList();
npc.getAttackByList().clear(); 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 // 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 // Stop hating this target after the attack timeout or if target is dead
npc.stopHating(target); npc.stopHating(target);
return;
}
if (_attackTimeout < GameTimeController.getInstance().getGameTicks())
{
// Set the AI Intention to AI_INTENTION_ACTIVE // Set the AI Intention to AI_INTENTION_ACTIVE
setIntention(AI_INTENTION_ACTIVE); setIntention(AI_INTENTION_ACTIVE);
@ -673,6 +677,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{ {
npc.setWalking(); npc.setWalking();
} }
// Monster teleport to spawn
if (npc.isMonster() && (npc.getSpawn() != null))
{
npc.teleToLocation(npc.getSpawn(), false);
}
return; return;
} }

View File

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

View File

@ -140,7 +140,6 @@ public final class Wastelands extends AbstractNpcAI
{ {
guard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack guard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
monster.reduceCurrentHp(1, guard, null); monster.reduceCurrentHp(1, guard, null);
guard.setCanStopAttackByTime(false);
if ((guard.getId() != COMMANDO) && (guard.getId() != COMMANDO_CAPTAIN)) if ((guard.getId() != COMMANDO) && (guard.getId() != COMMANDO_CAPTAIN))
{ {
@ -161,7 +160,6 @@ public final class Wastelands extends AbstractNpcAI
{ {
decoGuard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack decoGuard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
monster.reduceCurrentHp(1, decoGuard, null); monster.reduceCurrentHp(1, decoGuard, null);
decoGuard.setCanStopAttackByTime(false);
decoGuard.setIsInvul(true); decoGuard.setIsInvul(true);
} }
} }
@ -303,7 +301,6 @@ public final class Wastelands extends AbstractNpcAI
commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack
sakum.reduceCurrentHp(1, commander, null); sakum.reduceCurrentHp(1, commander, null);
commander.setCanStopAttackByTime(false);
notifyEvent("START_ATTACK", commander, null); notifyEvent("START_ATTACK", commander, null);
} }
@ -319,7 +316,6 @@ public final class Wastelands extends AbstractNpcAI
commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack
sakum.reduceCurrentHp(1, commander, null); sakum.reduceCurrentHp(1, commander, null);
commander.setCanStopAttackByTime(false);
notifyEvent("START_ATTACK", commander, null); notifyEvent("START_ATTACK", commander, null);
} }

View File

@ -521,7 +521,6 @@ public class Lindvior extends AbstractNpcAI
} }
case LYN_DRACO_ATTACKER_GENERATORS: case LYN_DRACO_ATTACKER_GENERATORS:
{ {
((L2Attackable) npc).setCanStopAttackByTime(false);
((L2Attackable) npc).setCanReturnToSpawnPoint(false); ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("attack_generator", 10000, npc, null, true); startQuestTimer("attack_generator", 10000, npc, null, true);
break; break;

View File

@ -228,7 +228,6 @@ public final class ChamberOfProphecies extends AbstractInstance
{ {
npc.setRunning(); npc.setRunning();
((L2Attackable) npc).setCanReturnToSpawnPoint(false); ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
((L2Attackable) npc).setCanStopAttackByTime(false);
if (npc.isScriptValue(0) && world.getAliveNpcs(L2MonsterInstance.class).isEmpty()) if (npc.isScriptValue(0) && world.getAliveNpcs(L2MonsterInstance.class).isEmpty())
{ {
npc.setTarget(player); npc.setTarget(player);

View File

@ -300,7 +300,6 @@ public class NornilsGarden extends AbstractInstance
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId())))
{ {
((L2Attackable) npc).setCanStopAttackByTime(false);
((L2Attackable) npc).setCanReturnToSpawnPoint(false); ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("check_agrro", 1000, npc, null, true); startQuestTimer("check_agrro", 1000, npc, null, true);
} }

View File

@ -505,7 +505,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
} }
// Chance to forget attackers after some time // 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.clearAggroList();
npc.getAttackByList().clear(); 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 // 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 // Stop hating this target after the attack timeout or if target is dead
npc.stopHating(target); npc.stopHating(target);
return;
}
if (_attackTimeout < GameTimeController.getInstance().getGameTicks())
{
// Set the AI Intention to AI_INTENTION_ACTIVE // Set the AI Intention to AI_INTENTION_ACTIVE
setIntention(AI_INTENTION_ACTIVE); setIntention(AI_INTENTION_ACTIVE);
@ -673,6 +677,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{ {
npc.setWalking(); npc.setWalking();
} }
// Monster teleport to spawn
if (npc.isMonster() && (npc.getSpawn() != null))
{
npc.teleToLocation(npc.getSpawn(), false);
}
return; return;
} }

View File

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

View File

@ -140,7 +140,6 @@ public final class Wastelands extends AbstractNpcAI
{ {
guard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack guard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
monster.reduceCurrentHp(1, guard, null); monster.reduceCurrentHp(1, guard, null);
guard.setCanStopAttackByTime(false);
if ((guard.getId() != COMMANDO) && (guard.getId() != COMMANDO_CAPTAIN)) if ((guard.getId() != COMMANDO) && (guard.getId() != COMMANDO_CAPTAIN))
{ {
@ -161,7 +160,6 @@ public final class Wastelands extends AbstractNpcAI
{ {
decoGuard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack decoGuard.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
monster.reduceCurrentHp(1, decoGuard, null); monster.reduceCurrentHp(1, decoGuard, null);
decoGuard.setCanStopAttackByTime(false);
decoGuard.setIsInvul(true); decoGuard.setIsInvul(true);
} }
} }
@ -303,7 +301,6 @@ public final class Wastelands extends AbstractNpcAI
commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack
sakum.reduceCurrentHp(1, commander, null); sakum.reduceCurrentHp(1, commander, null);
commander.setCanStopAttackByTime(false);
notifyEvent("START_ATTACK", commander, null); notifyEvent("START_ATTACK", commander, null);
} }
@ -319,7 +316,6 @@ public final class Wastelands extends AbstractNpcAI
commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack commander.reduceCurrentHp(1, sakum, null); // TODO: Find better way for attack
sakum.reduceCurrentHp(1, commander, null); sakum.reduceCurrentHp(1, commander, null);
commander.setCanStopAttackByTime(false);
notifyEvent("START_ATTACK", commander, null); notifyEvent("START_ATTACK", commander, null);
} }

View File

@ -521,7 +521,6 @@ public class Lindvior extends AbstractNpcAI
} }
case LYN_DRACO_ATTACKER_GENERATORS: case LYN_DRACO_ATTACKER_GENERATORS:
{ {
((L2Attackable) npc).setCanStopAttackByTime(false);
((L2Attackable) npc).setCanReturnToSpawnPoint(false); ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("attack_generator", 10000, npc, null, true); startQuestTimer("attack_generator", 10000, npc, null, true);
break; break;

View File

@ -228,7 +228,6 @@ public final class ChamberOfProphecies extends AbstractInstance
{ {
npc.setRunning(); npc.setRunning();
((L2Attackable) npc).setCanReturnToSpawnPoint(false); ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
((L2Attackable) npc).setCanStopAttackByTime(false);
if (npc.isScriptValue(0) && world.getAliveNpcs(L2MonsterInstance.class).isEmpty()) if (npc.isScriptValue(0) && world.getAliveNpcs(L2MonsterInstance.class).isEmpty())
{ {
npc.setTarget(player); npc.setTarget(player);

View File

@ -300,7 +300,6 @@ public class NornilsGarden extends AbstractInstance
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId())))
{ {
((L2Attackable) npc).setCanStopAttackByTime(false);
((L2Attackable) npc).setCanReturnToSpawnPoint(false); ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("check_agrro", 1000, npc, null, true); startQuestTimer("check_agrro", 1000, npc, null, true);
} }

View File

@ -505,7 +505,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
} }
// Chance to forget attackers after some time // 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.clearAggroList();
npc.getAttackByList().clear(); 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 // 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 // Stop hating this target after the attack timeout or if target is dead
npc.stopHating(target); npc.stopHating(target);
return;
}
if (_attackTimeout < GameTimeController.getInstance().getGameTicks())
{
// Set the AI Intention to AI_INTENTION_ACTIVE // Set the AI Intention to AI_INTENTION_ACTIVE
setIntention(AI_INTENTION_ACTIVE); setIntention(AI_INTENTION_ACTIVE);
@ -673,6 +677,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{ {
npc.setWalking(); npc.setWalking();
} }
// Monster teleport to spawn
if (npc.isMonster() && (npc.getSpawn() != null))
{
npc.teleToLocation(npc.getSpawn(), false);
}
return; return;
} }

View File

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

View File

@ -827,11 +827,15 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
// Check if target is dead or if timeout is expired to stop this attack // Check if target is dead or if timeout is expired to stop this attack
final L2Character originalAttackTarget = getAttackTarget(); final L2Character originalAttackTarget = getAttackTarget();
if ((originalAttackTarget == null) || originalAttackTarget.isAlikeDead() || (_attackTimeout < GameTimeController.getInstance().getGameTicks())) if ((originalAttackTarget == null) || originalAttackTarget.isAlikeDead())
{ {
// Stop hating this target after the attack timeout or if target is dead // Stop hating this target after the attack timeout or if target is dead
npc.stopHating(originalAttackTarget); npc.stopHating(originalAttackTarget);
return;
}
if (_attackTimeout < GameTimeController.getInstance().getGameTicks())
{
// Set the AI Intention to AI_INTENTION_ACTIVE // Set the AI Intention to AI_INTENTION_ACTIVE
setIntention(AI_INTENTION_ACTIVE); setIntention(AI_INTENTION_ACTIVE);
@ -839,6 +843,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{ {
npc.setWalking(); npc.setWalking();
} }
// Monster teleport to spawn
if (npc.isMonster() && (npc.getSpawn() != null))
{
npc.teleToLocation(npc.getSpawn(), false);
}
return; return;
} }

View File

@ -505,7 +505,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
} }
// Chance to forget attackers after some time // 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.clearAggroList();
npc.getAttackByList().clear(); 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 // 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 // Stop hating this target after the attack timeout or if target is dead
npc.stopHating(target); npc.stopHating(target);
return;
}
if (_attackTimeout < GameTimeController.getInstance().getGameTicks())
{
// Set the AI Intention to AI_INTENTION_ACTIVE // Set the AI Intention to AI_INTENTION_ACTIVE
setIntention(AI_INTENTION_ACTIVE); setIntention(AI_INTENTION_ACTIVE);
@ -673,6 +677,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{ {
npc.setWalking(); npc.setWalking();
} }
// Monster teleport to spawn
if (npc.isMonster() && (npc.getSpawn() != null))
{
npc.teleToLocation(npc.getSpawn(), false);
}
return; return;
} }

View File

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

View File

@ -505,7 +505,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
} }
// Chance to forget attackers after some time // 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.clearAggroList();
npc.getAttackByList().clear(); 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 // 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 // Stop hating this target after the attack timeout or if target is dead
npc.stopHating(target); npc.stopHating(target);
return;
}
if (_attackTimeout < GameTimeController.getInstance().getGameTicks())
{
// Set the AI Intention to AI_INTENTION_ACTIVE // Set the AI Intention to AI_INTENTION_ACTIVE
setIntention(AI_INTENTION_ACTIVE); setIntention(AI_INTENTION_ACTIVE);
@ -673,6 +677,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{ {
npc.setWalking(); npc.setWalking();
} }
// Monster teleport to spawn
if (npc.isMonster() && (npc.getSpawn() != null))
{
npc.teleToLocation(npc.getSpawn(), false);
}
return; return;
} }

View File

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