From 84446eb7262870be7f3a17e11df0b3502c1ebf58 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 9 Jan 2025 08:41:36 -0600 Subject: [PATCH] AI tweaking --- src/engine/mobileAI/BehaviourFiles/PlayerPet.java | 4 ++-- src/engine/mobileAI/BehaviourFiles/StandardMob.java | 12 +++--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/engine/mobileAI/BehaviourFiles/PlayerPet.java b/src/engine/mobileAI/BehaviourFiles/PlayerPet.java index adb78528..e69bcc3f 100644 --- a/src/engine/mobileAI/BehaviourFiles/PlayerPet.java +++ b/src/engine/mobileAI/BehaviourFiles/PlayerPet.java @@ -57,7 +57,7 @@ public class PlayerPet { return; } - mob.stopMovement(mob.getMovementLoc()); + mob.updateLocation(); ItemBase weapon = mob.getWeaponItemBase(true); boolean mainHand = true; @@ -73,7 +73,7 @@ public class PlayerPet { } public static void aggro(Mob mob){ - for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(mob.loc,30, MBServerStatics.MASK_PET)) { + for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(mob.loc,30, MBServerStatics.MASK_MOB)) { Mob potentialTarget = (Mob) awo; if (!potentialTarget.isAlive()) continue; diff --git a/src/engine/mobileAI/BehaviourFiles/StandardMob.java b/src/engine/mobileAI/BehaviourFiles/StandardMob.java index 437f18fd..f795f877 100644 --- a/src/engine/mobileAI/BehaviourFiles/StandardMob.java +++ b/src/engine/mobileAI/BehaviourFiles/StandardMob.java @@ -76,7 +76,7 @@ public class StandardMob { if(enumMobState.Agressive(mob)){ for(int id : mob.playerAgroMap.keySet()){ PlayerCharacter potentialTarget = PlayerCharacter.getFromCache(id); - if(!potentialTarget.isAlive() || mob.canSee(potentialTarget)) + if(!potentialTarget.isAlive() || !mob.canSee(potentialTarget)) continue; if (MovementUtilities.inRangeToAggro(mob, potentialTarget)) { mob.setCombatTarget(potentialTarget); @@ -131,20 +131,14 @@ public class StandardMob { return; } - if(MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget())){ - mob.setCombatTarget(null); - MovementUtilities.aiMove(mob,mob.bindLoc,true); - return; - } - - if(!CombatUtilities.inRangeToAttack(mob,mob.combatTarget)){ + if(!mob.isMoving() && !CombatUtilities.inRangeToAttack(mob,mob.combatTarget)){ if (!MovementUtilities.canMove(mob)) return; MovementUtilities.aiMove(mob,mob.combatTarget.loc,false); return; } - mob.stopMovement(mob.getMovementLoc()); + mob.updateLocation(); ItemBase weapon = mob.getWeaponItemBase(true); boolean mainHand = true;