Browse Source

mobs aggro to pets

master
FatBoy-DOTC 1 year ago
parent
commit
1c7c0ee13e
  1. 18
      src/engine/ai/MobileFSM.java
  2. 2
      src/engine/powers/poweractions/CreateMobPowerAction.java

18
src/engine/ai/MobileFSM.java

@ -172,6 +172,9 @@ public class MobileFSM {
attackDelay = 11000; attackDelay = 11000;
CombatUtilities.combatCycle(mob, target, false, mob.getWeaponItemBase(false)); CombatUtilities.combatCycle(mob, target, false, mob.getWeaponItemBase(false));
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay); mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
if(target.combatTarget == null){
target.combatTarget = mob;
}
} }
} }
@ -429,6 +432,18 @@ public class MobileFSM {
return; return;
} }
} }
//look for pets to aggro;;;
HashSet<AbstractWorldObject> 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())
aiAgent.setCombatTarget(aggroMob);
return;
}
} }
private static void CheckMobMovement(Mob mob) { private static void CheckMobMovement(Mob mob) {
@ -669,6 +684,9 @@ public class MobileFSM {
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None))* 0.01f); float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None))* 0.01f);
mob.setHealth(mob.getHealth() + recoveredHealth); mob.setHealth(mob.getHealth() + recoveredHealth);
mob.getTimestamps().put("HEALTHRECOVERED",System.currentTimeMillis()); mob.getTimestamps().put("HEALTHRECOVERED",System.currentTimeMillis());
if(mob.getHealth() > mob.getHealthMax()){
mob.setHealth(mob.getHealthMax());
}
} }
} }
} }

2
src/engine/powers/poweractions/CreateMobPowerAction.java

@ -159,9 +159,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
MovementManager.translocate(pet, owner.getLoc(), owner.region); MovementManager.translocate(pet, owner.getLoc(), owner.region);
} }
pet.recalculateStats(); pet.recalculateStats();
if(pet.isPet()){
pet.healthMax = pet.level * 0.5f * 120; pet.healthMax = pet.level * 0.5f * 120;
}
pet.setHealth(pet.healthMax); pet.setHealth(pet.healthMax);
PetMsg pm = new PetMsg(5, pet); PetMsg pm = new PetMsg(5, pet);
Dispatch dispatch = Dispatch.borrow(owner, pm); Dispatch dispatch = Dispatch.borrow(owner, pm);

Loading…
Cancel
Save