mob ai work
This commit is contained in:
@@ -37,6 +37,8 @@ public class MobAi2 {
|
||||
}
|
||||
|
||||
public static void runAI(Mob mob){
|
||||
|
||||
//these will be handled in special conditions later
|
||||
switch(mob.BehaviourType){
|
||||
case GuardCaptain:
|
||||
case GuardMinion:
|
||||
@@ -121,7 +123,7 @@ public class MobAi2 {
|
||||
|
||||
int patrolDelay = ThreadLocalRandom.current().nextInt((int) (MobAIThread.AI_PATROL_DIVISOR * 0.5f), MobAIThread.AI_PATROL_DIVISOR) + MobAIThread.AI_PATROL_DIVISOR;
|
||||
|
||||
if (mob.stopPatrolTime + (patrolDelay * 1000) > System.currentTimeMillis())
|
||||
if (mob.stopPatrolTime + (patrolDelay * 1000L) > System.currentTimeMillis())
|
||||
return;
|
||||
|
||||
if (mob.lastPatrolPointIndex > mob.patrolPoints.size() - 1)
|
||||
@@ -191,7 +193,7 @@ public class MobAi2 {
|
||||
if (System.currentTimeMillis() < mob.getLastAttackTime())
|
||||
return;
|
||||
|
||||
// ranged mobs cant attack while running. skip until they finally stop.
|
||||
// ranged mobs can't attack while running. skip until they finally stop.
|
||||
|
||||
if (mob.isMoving() && mob.getRange() > 20)
|
||||
return;
|
||||
@@ -223,7 +225,7 @@ public class MobAi2 {
|
||||
}
|
||||
|
||||
if (target.getPet() != null)
|
||||
if (target.getPet().getCombatTarget() == null && target.getPet().assist == true)
|
||||
if (target.getPet().getCombatTarget() == null && target.getPet().assist)
|
||||
target.getPet().setCombatTarget(mob);
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -244,10 +246,10 @@ public class MobAi2 {
|
||||
return;
|
||||
}
|
||||
|
||||
City playercity = ZoneManager.getCityAtLocation(mob.getLoc());
|
||||
City playerCity = ZoneManager.getCityAtLocation(mob.getLoc());
|
||||
|
||||
if (playercity != null)
|
||||
for (Mob guard : playercity.getParent().zoneMobSet)
|
||||
if (playerCity != null)
|
||||
for (Mob guard : playerCity.getParent().zoneMobSet)
|
||||
if (guard.BehaviourType != null && guard.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
|
||||
if (guard.getCombatTarget() == null && guard.getGuild() != null && mob.getGuild() != null && !guard.getGuild().equals(mob.getGuild()))
|
||||
guard.setCombatTarget(mob);
|
||||
@@ -278,12 +280,6 @@ public class MobAi2 {
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
}
|
||||
|
||||
//if (mob.isSiege()) {
|
||||
// PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
||||
// ppm.setRange(50);
|
||||
// DispatchMessage.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
//}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackBuilding" + " " + e.getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user