|
|
@ -69,7 +69,7 @@ public class MobileFSM { |
|
|
|
mob.setCombatTarget(null); |
|
|
|
mob.setCombatTarget(null); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (CombatUtilities.inRange2D(mob, target, mob.getRange())) { |
|
|
|
if (CombatUtilities.inRangeToAttack(mob,mob.getCombatTarget())) { |
|
|
|
//no weapons, default mob attack speed 3 seconds.
|
|
|
|
//no weapons, default mob attack speed 3 seconds.
|
|
|
|
if (System.currentTimeMillis() < mob.getLastAttackTime()) |
|
|
|
if (System.currentTimeMillis() < mob.getLastAttackTime()) |
|
|
|
return; |
|
|
|
return; |
|
|
@ -171,6 +171,10 @@ public class MobileFSM { |
|
|
|
if(mob.stopPatrolTime == 0) { |
|
|
|
if(mob.stopPatrolTime == 0) { |
|
|
|
mob.stopPatrolTime = System.currentTimeMillis(); |
|
|
|
mob.stopPatrolTime = System.currentTimeMillis(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(mob.isMoving() == true){ |
|
|
|
|
|
|
|
mob.stopPatrolTime = System.currentTimeMillis(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
if (mob.isCombat() && mob.getCombatTarget() == null) { |
|
|
|
if (mob.isCombat() && mob.getCombatTarget() == null) { |
|
|
|
mob.setCombat(false); |
|
|
|
mob.setCombat(false); |
|
|
|
UpdateStateMsg rwss = new UpdateStateMsg(); |
|
|
|
UpdateStateMsg rwss = new UpdateStateMsg(); |
|
|
@ -299,17 +303,18 @@ public class MobileFSM { |
|
|
|
public static void DetermineAction(Mob mob) { |
|
|
|
public static void DetermineAction(Mob mob) { |
|
|
|
if (mob == null) |
|
|
|
if (mob == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
if(mob.despawned || !mob.isAlive()) { |
|
|
|
if(mob.despawned == true || mob.isAlive() == false) { |
|
|
|
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) { |
|
|
|
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) { |
|
|
|
if (mob.npcOwner.isAlive() == false || ((Mob) mob.npcOwner).despawned == true) { |
|
|
|
if (mob.npcOwner.isAlive() == false || ((Mob) mob.npcOwner).despawned == true) { |
|
|
|
//minions don't respawn while guard captain is dead
|
|
|
|
//minions don't respawn while guard captain is dead
|
|
|
|
mob.deathTime = System.currentTimeMillis(); |
|
|
|
mob.deathTime = System.currentTimeMillis(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
CheckForRespawn(mob); |
|
|
|
CheckForRespawn(mob); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (mob.playerAgroMap.isEmpty() && mob.isPlayerGuard == false) |
|
|
|
if (mob.playerAgroMap.isEmpty() && mob.isPlayerGuard == false) |
|
|
|
//no players loaded, no need to proceed
|
|
|
|
//no players loaded, no need to proceed
|
|
|
|
return; |
|
|
|
return; |
|
|
@ -402,11 +407,7 @@ public class MobileFSM { |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
if (mob.getCombatTarget() == null) { |
|
|
|
if (mob.getCombatTarget() == null) { |
|
|
|
if(!mob.isMoving()) { |
|
|
|
|
|
|
|
Patrol(mob); |
|
|
|
Patrol(mob); |
|
|
|
} else{ |
|
|
|
|
|
|
|
mob.stopPatrolTime = System.currentTimeMillis(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else { |
|
|
|
}else { |
|
|
|
chaseTarget(mob); |
|
|
|
chaseTarget(mob); |
|
|
|
} |
|
|
|
} |
|
|
|