Browse Source

mobs handle players leaving agroMap

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

23
src/engine/ai/MobileFSM.java

@ -347,7 +347,6 @@ public class MobileFSM {
respawnQue.remove(0); respawnQue.remove(0);
lastRespawn = System.currentTimeMillis(); lastRespawn = System.currentTimeMillis();
} }
if (mob == null) if (mob == null)
return; return;
if (mob.despawned && mob.getMobBase().getLoadID() == 13171) { if (mob.despawned && mob.getMobBase().getLoadID() == 13171) {
@ -390,8 +389,22 @@ public class MobileFSM {
if(mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) { if(mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) {
CheckToSendMobHome(mob); CheckToSendMobHome(mob);
} }
if (mob.combatTarget != null && mob.combatTarget.isAlive() == false) { if (mob.combatTarget != null) {
if(mob.getCombatTarget().isAlive() == false){
mob.setCombatTarget(null);
return;
}
if(mob.getCombatTarget().getObjectTypeMask() == MBServerStatics.MASK_PLAYER){
if(mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false){
mob.setCombatTarget(null);
return;
}
if(mob.canSee((PlayerCharacter)mob.getCombatTarget()) == false) {
mob.setCombatTarget(null); mob.setCombatTarget(null);
return;
}
}
} }
switch (mob.BehaviourType) { switch (mob.BehaviourType) {
case GuardCaptain: case GuardCaptain:
@ -716,10 +729,10 @@ public class MobileFSM {
} }
private static void DefaultLogic(Mob mob) { private static void DefaultLogic(Mob mob) {
if (mob.getObjectUUID() == 40548) {
int thing = 0;
}
//check for players that can be aggroed if mob is agressive and has no target //check for players that can be aggroed if mob is agressive and has no target
if(mob.getCombatTarget() != null && mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false){
mob.setCombatTarget(null);
}
if (mob.BehaviourType.isAgressive) { if (mob.BehaviourType.isAgressive) {
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob); AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
if (newTarget != null) { if (newTarget != null) {

Loading…
Cancel
Save