pets defend owner when "assist" toggled
This commit is contained in:
@@ -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,17 +437,17 @@ public class MobileFSM {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//look for pets to aggro;;;
|
if(aiAgent.combatTarget == null) {
|
||||||
HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(aiAgent, MobileFSMManager.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_PET);
|
//look for pets to aggro if no players found to aggro
|
||||||
for (AbstractWorldObject awoMob : awoList) {
|
HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(aiAgent, MobileFSMManager.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_PET);
|
||||||
//dont scan self.
|
for (AbstractWorldObject awoMob : awoList) {
|
||||||
if (aiAgent.equals(awoMob))
|
//dont scan self.
|
||||||
continue;
|
if (aiAgent.equals(awoMob))
|
||||||
Mob aggroMob = (Mob) awoMob;
|
continue;
|
||||||
//dont attack other guards
|
Mob aggroMob = (Mob) awoMob;
|
||||||
if (aggroMob.isPet())
|
|
||||||
aiAgent.setCombatTarget(aggroMob);
|
aiAgent.setCombatTarget(aggroMob);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user