|
|
|
@ -291,7 +291,7 @@ public class MobAI {
@@ -291,7 +291,7 @@ public class MobAI {
|
|
|
|
|
mob.destination = captain.destination.add(Formation.getOffset(2, mob.guardCaptain.minions.indexOf(mob.getObjectUUID()) + 3)); |
|
|
|
|
mob.lastPatrolPointIndex = captain.lastPatrolPointIndex; |
|
|
|
|
} else { |
|
|
|
|
NavigationManager.pathfind(mob, mob.patrolPoints.get(mob.lastPatrolPointIndex)); |
|
|
|
|
mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex); |
|
|
|
|
mob.lastPatrolPointIndex += 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -749,7 +749,7 @@ public class MobAI {
@@ -749,7 +749,7 @@ public class MobAI {
|
|
|
|
|
if (CombatUtilities.inRange2D(mob, mob.guardCaptain, 6)) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
NavigationManager.pathfind(mob, mob.guardCaptain.getLoc()); |
|
|
|
|
mob.destination = mob.guardCaptain.getLoc(); |
|
|
|
|
aiMove(mob, false,5); |
|
|
|
|
} else |
|
|
|
|
chaseTarget(mob); |
|
|
|
@ -905,7 +905,7 @@ public class MobAI {
@@ -905,7 +905,7 @@ public class MobAI {
|
|
|
|
|
|
|
|
|
|
if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mob.getRange()) == false) { |
|
|
|
|
if (mob.getRange() > 15) { |
|
|
|
|
NavigationManager.pathfind(mob, mob.getCombatTarget().getLoc()); |
|
|
|
|
mob.destination = mob.getCombatTarget().getLoc(); |
|
|
|
|
aiMove(mob, false,0); |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
@ -1241,7 +1241,7 @@ public class MobAI {
@@ -1241,7 +1241,7 @@ public class MobAI {
|
|
|
|
|
float xPoint = ThreadLocalRandom.current().nextInt(400) - 200; |
|
|
|
|
float zPoint = ThreadLocalRandom.current().nextInt(400) - 200; |
|
|
|
|
Vector3fImmutable TreePos = mob.getGuild().getOwnedCity().getLoc(); |
|
|
|
|
NavigationManager.pathfind(mob, new Vector3fImmutable(TreePos.x + xPoint, TreePos.y, TreePos.z + zPoint)); |
|
|
|
|
mob.destination = new Vector3fImmutable(TreePos.x + xPoint, TreePos.y, TreePos.z + zPoint); |
|
|
|
|
|
|
|
|
|
aiMove(mob, true,0); |
|
|
|
|
|
|
|
|
@ -1345,6 +1345,22 @@ public class MobAI {
@@ -1345,6 +1345,22 @@ public class MobAI {
|
|
|
|
|
|
|
|
|
|
public static void aiMove(Mob mob, boolean isWalking, float offset) { |
|
|
|
|
|
|
|
|
|
if(mob.navPath.size() < 1){ |
|
|
|
|
NavigationManager.pathfind(mob,mob.destination); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if(mob.navPath.get(mob.navPath.size() -1).distanceSquared(mob.destination) > 100){ // goal has moved by at least 10 units, recalculate
|
|
|
|
|
NavigationManager.pathfind(mob,mob.destination); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if(mob.isMoving()) |
|
|
|
|
return; |
|
|
|
|
Vector3fImmutable PathPoint = mob.navPath.get(0); |
|
|
|
|
if(mob.loc.distanceSquared(mob.navPath.get(0)) < 25) { |
|
|
|
|
mob.navPath.remove(0); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//update our walk/run state.
|
|
|
|
|
if (isWalking && !mob.isWalk()) { |
|
|
|
|
mob.setWalkMode(true); |
|
|
|
@ -1354,8 +1370,7 @@ public class MobAI {
@@ -1354,8 +1370,7 @@ public class MobAI {
|
|
|
|
|
MovementManager.sendRWSSMsg(mob); |
|
|
|
|
} |
|
|
|
|
if(offset > 0){ |
|
|
|
|
Vector3fImmutable newLoc = Vector3fImmutable.getRandomPointInCircle(mob.destination, offset); |
|
|
|
|
mob.destination = newLoc; |
|
|
|
|
PathPoint= Vector3fImmutable.getRandomPointInCircle(PathPoint, offset); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1364,7 +1379,7 @@ public class MobAI {
@@ -1364,7 +1379,7 @@ public class MobAI {
|
|
|
|
|
msg.setSourceType(Enum.GameObjectType.Mob.ordinal()); |
|
|
|
|
msg.setSourceID(mob.getObjectUUID()); |
|
|
|
|
msg.setStartCoord(mob.loc); |
|
|
|
|
msg.setEndCoord(mob.destination); |
|
|
|
|
msg.setEndCoord(PathPoint); |
|
|
|
|
msg.setInBuildingFloor(-1); |
|
|
|
|
msg.setInBuilding(-1); |
|
|
|
|
msg.setStartLocType(0); |
|
|
|
|