Browse Source

pets defend owner when "assist" toggled

master
FatBoy-DOTC 1 year ago
parent
commit
c9995f3d62
  1. 11
      src/engine/ai/MobileFSM.java

11
src/engine/ai/MobileFSM.java

@ -105,6 +105,11 @@ public class MobileFSM {
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay); 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) { public static void AttackBuilding(Mob mob, Building target) {
@ -432,19 +437,19 @@ public class MobileFSM {
return; return;
} }
} }
//look for pets to aggro;;; if(aiAgent.combatTarget == null) {
//look for pets to aggro if no players found to aggro
HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(aiAgent, MobileFSMManager.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_PET); HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(aiAgent, MobileFSMManager.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_PET);
for (AbstractWorldObject awoMob : awoList) { for (AbstractWorldObject awoMob : awoList) {
//dont scan self. //dont scan self.
if (aiAgent.equals(awoMob)) if (aiAgent.equals(awoMob))
continue; continue;
Mob aggroMob = (Mob) awoMob; Mob aggroMob = (Mob) awoMob;
//dont attack other guards
if (aggroMob.isPet())
aiAgent.setCombatTarget(aggroMob); aiAgent.setCombatTarget(aggroMob);
return; return;
} }
} }
}
private static void CheckMobMovement(Mob mob) { private static void CheckMobMovement(Mob mob) {
if (!MovementUtilities.canMove(mob)) if (!MovementUtilities.canMove(mob))

Loading…
Cancel
Save