Browse Source

Rework of combat deference to captain.

feature-workorder
MagicBot 1 year ago
parent
commit
2e346ae7fd
  1. 21
      src/engine/mobileAI/MobAI.java

21
src/engine/mobileAI/MobAI.java

@ -998,11 +998,9 @@ public class MobAI {
public static void GuardMinionLogic(Mob mob) { public static void GuardMinionLogic(Mob mob) {
try { try {
if (!mob.guardCaptain.isAlive()) {
if (mob.getCombatTarget() == null) { if (mob.getCombatTarget() == null)
CheckForPlayerGuardAggro(mob); CheckForPlayerGuardAggro(mob);
} else {
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob); AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
@ -1015,13 +1013,7 @@ public class MobAI {
mob.setCombatTarget(newTarget); mob.setCombatTarget(newTarget);
} }
}
}else {
if (mob.guardCaptain.getCombatTarget() != null)
mob.setCombatTarget(mob.guardCaptain.getCombatTarget());
else if (mob.getCombatTarget() != null)
mob.setCombatTarget(null);
}
CheckMobMovement(mob); CheckMobMovement(mob);
CheckForAttack(mob); CheckForAttack(mob);
} catch (Exception e) { } catch (Exception e) {
@ -1140,6 +1132,15 @@ public class MobAI {
if (!mob.isAlive()) if (!mob.isAlive())
return; return;
// Defer to captain if possible for current target
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION) &&
mob.combatTarget == null && mob.guardCaptain.isAlive()
&& mob.guardCaptain.combatTarget != null) {
mob.setCombatTarget(mob.guardCaptain.combatTarget);
return;
}
ConcurrentHashMap<Integer, Float> loadedPlayers = mob.playerAgroMap; ConcurrentHashMap<Integer, Float> loadedPlayers = mob.playerAgroMap;
for (Entry playerEntry : loadedPlayers.entrySet()) { for (Entry playerEntry : loadedPlayers.entrySet()) {

Loading…
Cancel
Save