This commit is contained in:
2023-05-27 20:53:52 -05:00
parent 2e219916a0
commit 11e373db6f
3 changed files with 28 additions and 18 deletions
+9 -8
View File
@@ -69,7 +69,7 @@ public class MobileFSM {
mob.setCombatTarget(null);
return;
}
if (CombatUtilities.inRange2D(mob, target, mob.getRange())) {
if (CombatUtilities.inRangeToAttack(mob,mob.getCombatTarget())) {
//no weapons, default mob attack speed 3 seconds.
if (System.currentTimeMillis() < mob.getLastAttackTime())
return;
@@ -171,6 +171,10 @@ public class MobileFSM {
if(mob.stopPatrolTime == 0) {
mob.stopPatrolTime = System.currentTimeMillis();
}
if(mob.isMoving() == true){
mob.stopPatrolTime = System.currentTimeMillis();
return;
}
if (mob.isCombat() && mob.getCombatTarget() == null) {
mob.setCombat(false);
UpdateStateMsg rwss = new UpdateStateMsg();
@@ -299,16 +303,17 @@ public class MobileFSM {
public static void DetermineAction(Mob mob) {
if (mob == null)
return;
if(mob.despawned || !mob.isAlive()) {
if(mob.despawned == true || mob.isAlive() == false) {
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
if (mob.npcOwner.isAlive() == false || ((Mob) mob.npcOwner).despawned == true) {
//minions don't respawn while guard captain is dead
mob.deathTime = System.currentTimeMillis();
return;
}
CheckForRespawn(mob);
return;
}
CheckForRespawn(mob);
return;
}
if (mob.playerAgroMap.isEmpty() && mob.isPlayerGuard == false)
//no players loaded, no need to proceed
@@ -402,11 +407,7 @@ public class MobileFSM {
break;
default:
if (mob.getCombatTarget() == null) {
if(!mob.isMoving()) {
Patrol(mob);
} else{
mob.stopPatrolTime = System.currentTimeMillis();
}
}else {
chaseTarget(mob);
}