Update GameServer/src/org/moparscape/msc/gs/model/Npc.java

Check if Npc is about to start chasing player so it doesn't do a random walking path.
This commit is contained in:
latifundio 2012-09-07 08:05:42 -03:00
parent 96ea6cc2d6
commit 05277352b5

View File

@ -578,13 +578,18 @@ public class Npc extends Mob {
Instance.getDelayedEventHandler().add(fighting);
}
if (now - lastMovement > 2200) {
lastMovement = now;
int rand = DataConversions.random(0, 1);
if (!isBusy() && finishedPath() && rand == 1 && !this.isRemoved()) {
int newX = DataConversions.random(loc.minX(), loc.maxX());
int newY = DataConversions.random(loc.minY(), loc.maxY());
super.setPath(new Path(getX(), getY(), newX, newY));
if (now - lastMovement > 1800) {
if (now - getCombatTimer() < (getCombatState() ==
CombatState.WAITING ? 5000 : 500)) {
}
else {
lastMovement = now;
int rand = DataConversions.random(0, 1);
if (!isBusy() && finishedPath() && rand == 1 && !this.isRemoved()) {
int newX = DataConversions.random(loc.minX(), loc.maxX());
int newY = DataConversions.random(loc.minY(), loc.maxY());
super.setPath(new Path(getX(), getY(), newX, newY));
}
}
}