simplified mob aI
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package engine.mobileAI.Behaviours;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.utilities.CombatUtilities;
|
||||
@@ -86,14 +87,14 @@ public class StandardMob {
|
||||
}
|
||||
//No items in inventory.
|
||||
} else if (mob.isHasLoot()) {
|
||||
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
|
||||
if (System.currentTimeMillis() > mob.deathTime + 1000L) {
|
||||
mob.despawn();
|
||||
mob.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
//Mob never had Loot.
|
||||
} else {
|
||||
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
|
||||
if (System.currentTimeMillis() > mob.deathTime + 1000L){//MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
|
||||
mob.despawn();
|
||||
mob.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
@@ -104,8 +105,11 @@ public class StandardMob {
|
||||
|
||||
if(Mob.discDroppers.contains(mob))
|
||||
return;
|
||||
|
||||
if (System.currentTimeMillis() > (mob.deathTime + (mob.spawnTime * 1000L))) {
|
||||
float baseRespawnTimer = mob.spawnTime;
|
||||
float reduction = ((100-mob.level) * 0.01f);
|
||||
float reducedRespawnTime = baseRespawnTimer * reduction;
|
||||
float respawnTimer = reducedRespawnTime * 1000f;
|
||||
if (System.currentTimeMillis() > (mob.deathTime + respawnTimer)) {
|
||||
Zone.respawnQue.add(mob);
|
||||
}
|
||||
}
|
||||
@@ -196,10 +200,14 @@ public class StandardMob {
|
||||
|
||||
}else{
|
||||
//patrol
|
||||
if (mob.isMoving())
|
||||
return;
|
||||
Vector3fImmutable patrolPoint = Vector3fImmutable.getRandomPointOnCircle(mob.bindLoc, 40f);
|
||||
MovementUtilities.aiMove(mob, patrolPoint, true);
|
||||
if (mob.isMoving()) {
|
||||
mob.stopPatrolTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
if(mob.stopPatrolTime + 5000L < System.currentTimeMillis()) {
|
||||
Vector3fImmutable patrolPoint = Vector3fImmutable.getRandomPointOnCircle(mob.bindLoc, 40f);
|
||||
MovementUtilities.aiMove(mob, patrolPoint, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,6 +219,8 @@ public class StandardMob {
|
||||
if(mob.getLastAttackTime() > System.currentTimeMillis())
|
||||
return;
|
||||
|
||||
mob.updateLocation();
|
||||
InterestManager.forceLoad(mob);
|
||||
|
||||
if (mob.BehaviourType.callsForHelp)
|
||||
MobCallForHelp(mob);
|
||||
@@ -235,6 +245,7 @@ public class StandardMob {
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
}
|
||||
}
|
||||
|
||||
public static void MobCallForHelp(Mob mob){
|
||||
HashSet<AbstractWorldObject> mobs = WorldGrid.getObjectsInRangePartial(mob.loc,60f, MBServerStatics.MASK_MOB);
|
||||
for(AbstractWorldObject awo : mobs){
|
||||
@@ -244,4 +255,4 @@ public class StandardMob {
|
||||
MovementUtilities.aiMove(responder,mob.loc,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user