diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index d7aaea16..ae509afa 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -105,6 +105,11 @@ public class MobileFSM { mob.setLastAttackTime(System.currentTimeMillis() + attackDelay); } } + if(target.getPet() != null){ + if(target.getPet().getCombatTarget() == null && target.getPet().assist() == true){ + target.getPet().setCombatTarget(mob); + } + } } public static void AttackBuilding(Mob mob, Building target) { @@ -432,17 +437,17 @@ public class MobileFSM { return; } } - //look for pets to aggro;;; - HashSet awoList = WorldGrid.getObjectsInRangePartial(aiAgent, MobileFSMManager.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_PET); - for (AbstractWorldObject awoMob : awoList) { - //dont scan self. - if (aiAgent.equals(awoMob)) - continue; - Mob aggroMob = (Mob) awoMob; - //dont attack other guards - if (aggroMob.isPet()) + if(aiAgent.combatTarget == null) { + //look for pets to aggro if no players found to aggro + HashSet awoList = WorldGrid.getObjectsInRangePartial(aiAgent, MobileFSMManager.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_PET); + for (AbstractWorldObject awoMob : awoList) { + //dont scan self. + if (aiAgent.equals(awoMob)) + continue; + Mob aggroMob = (Mob) awoMob; aiAgent.setCombatTarget(aggroMob); return; + } } }