Browse Source

hamlet guards + mobs aggro before going home

master
FatBoy-DOTC 1 year ago
parent
commit
d673c329b6
  1. 3
      src/engine/ai/MobileFSM.java
  2. 2
      src/engine/ai/utilities/MovementUtilities.java

3
src/engine/ai/MobileFSM.java

@ -466,7 +466,7 @@ public class MobileFSM {
//checks if mob can attack based on attack timer and range //checks if mob can attack based on attack timer and range
if (mob.isAlive() == false) if (mob.isAlive() == false)
return; return;
if (MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false) { if (MovementUtilities.inRangeDropAggro(mob, (AbstractCharacter)mob.getCombatTarget()) == false) {
mob.setCombatTarget(null); mob.setCombatTarget(null);
if (mob.isCombat()) { if (mob.isCombat()) {
mob.setCombat(false); mob.setCombat(false);
@ -486,6 +486,7 @@ public class MobileFSM {
AttackTarget(mob, mob.getCombatTarget()); AttackTarget(mob, mob.getCombatTarget());
} }
private static void CheckToSendMobHome(Mob mob) { private static void CheckToSendMobHome(Mob mob) {
CheckForAggro(mob);
if(mob.getCombatTarget() != null && CombatUtilities.inRange2D(mob,mob.getCombatTarget(),MBServerStatics.AI_BASE_AGGRO_RANGE * 0.5f)){ if(mob.getCombatTarget() != null && CombatUtilities.inRange2D(mob,mob.getCombatTarget(),MBServerStatics.AI_BASE_AGGRO_RANGE * 0.5f)){
return; return;
} }

2
src/engine/ai/utilities/MovementUtilities.java

@ -98,7 +98,7 @@ public class MovementUtilities {
} }
public static boolean inRangeDropAggro(Mob agent, PlayerCharacter target) { public static boolean inRangeDropAggro(Mob agent, AbstractCharacter target) {
Vector3fImmutable sl = agent.getLoc(); Vector3fImmutable sl = agent.getLoc();
Vector3fImmutable tl = target.getLoc(); Vector3fImmutable tl = target.getLoc();

Loading…
Cancel
Save