diff --git a/src/engine/Enum.java b/src/engine/Enum.java index ccd2db53..d6d5b414 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -2823,8 +2823,8 @@ public class Enum { Simple(null, false, false, true, false, false), Helpee(null, false, true, true, false, true), HelpeeWimpy(null, true, false, true, false, false), - GuardCaptain(null, false, true, true, true, false), - GuardMinion(GuardCaptain, false, true, true, false, true), + GuardCaptain(null, false, true, true, false, false), + GuardMinion(GuardCaptain, false, true, true, false, false), GuardWallArcher(null, false, true, false, false, false), Wanderer(null, false, true, true, false, false), HamletGuard(null, false, true, false, false, false), diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index d090ed22..667db7b0 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -550,9 +550,10 @@ public class MobileFSM { CheckForPlayerGuardAggro(mob); return; } - if(mob.npcOwner.getCombatTarget() != null){ + if(mob.npcOwner.getCombatTarget() != null) mob.setCombatTarget(mob.npcOwner.getCombatTarget()); - } + else + mob.setCombatTarget(null); CheckMobMovement(mob); if (mob.getCombatTarget() != null) CheckForAttack(mob); @@ -622,14 +623,11 @@ public class MobileFSM { continue; if (MovementUtilities.inRangeToAggro(mob, loadedPlayer)) { mob.setCombatTarget(loadedPlayer); - if (mob.contract != null) - for (Entry minion : mob.siegeMinionMap.entrySet()) - minion.getKey().setCombatTarget(loadedPlayer); return; } } } - private static Boolean GuardCanAggro(Mob mob, PlayerCharacter target) { + public static Boolean GuardCanAggro(Mob mob, PlayerCharacter target) { if (mob.getGuild().getNation().equals(target.getGuild().getNation())) return false; //first check condemn list for aggro allowed (allies button is checked) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 97221070..88fdc5df 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -9,6 +9,7 @@ package engine.gameManager; import engine.Enum.*; +import engine.ai.MobileFSM; import engine.exception.MsgSendException; import engine.job.JobContainer; import engine.job.JobScheduler; @@ -27,6 +28,7 @@ import engine.server.MBServerStatics; import org.pmw.tinylog.Logger; import java.util.HashSet; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ThreadLocalRandom; @@ -134,6 +136,14 @@ public enum CombatManager { CombatManager.createTimer(pc, MBServerStatics.SLOT_OFFHAND, 1, true); // attack in 0.1 of a second } } + City playerCity = ZoneManager.getCityAtLocation(pc.getLoc()); + if( playerCity != null) + for(Building barracks : playerCity.cityBarracks) + for(Map.Entry entry : barracks.getHirelings().entrySet()) + if(entry.getKey().getCombatTarget() == null){ + if(MobileFSM.GuardCanAggro((Mob) entry.getKey(),pc)) + entry.getKey().setCombatTarget(pc); + } } public static void setAttackTarget(PetAttackMsg msg, ClientConnection origin) throws MsgSendException {