Browse Source

simplified mob aI

lakebane
FatBoy-DOTC 1 month ago
parent
commit
bfc0c57dd8
  1. 7
      src/engine/mobileAI/Behaviours/StandardMob.java
  2. 4
      src/engine/mobileAI/MobAI.java

7
src/engine/mobileAI/Behaviours/StandardMob.java

@ -20,13 +20,17 @@ public class StandardMob {
return; return;
} }
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(mob.loc, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
if(inRange.isEmpty())
return;
if (mob.isMoving()) { if (mob.isMoving()) {
mob.setLoc(mob.getMovementLoc()); mob.setLoc(mob.getMovementLoc());
mob.updateLocation(); mob.updateLocation();
} }
if(mob.combatTarget == null) { if(mob.combatTarget == null) {
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(mob.loc, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
if (!inRange.isEmpty()) { if (!inRange.isEmpty()) {
CheckForAggro(mob); CheckForAggro(mob);
return; return;
@ -34,7 +38,6 @@ public class StandardMob {
}else{ }else{
CheckToDropCombatTarget(mob); CheckToDropCombatTarget(mob);
if(mob.combatTarget == null){ if(mob.combatTarget == null){
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(mob.loc, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
CheckForAggro(mob); CheckForAggro(mob);
return; return;
} }

4
src/engine/mobileAI/MobAI.java

@ -633,8 +633,10 @@ public class MobAI {
break; break;
} }
if(override){ if(override){
if(!mob.isSiege()) if(!mob.isSiege()) {
StandardMob.run(mob); StandardMob.run(mob);
return;
}
} }
//always check the respawn que, respawn 1 mob max per second to not flood the client //always check the respawn que, respawn 1 mob max per second to not flood the client

Loading…
Cancel
Save