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