forked from MagicBane/Server
guards will aggro siege equipment not belonging to the guild
This commit is contained in:
@@ -1120,13 +1120,30 @@ public class MobAI {
|
||||
mob.setCombatTarget(loadedPlayer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (mob.getCombatTarget() == null) {
|
||||
|
||||
//look for siege equipment to aggro if no players found to aggro
|
||||
|
||||
HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(mob, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_SIEGE);
|
||||
|
||||
for (AbstractWorldObject awoMob : awoList) {
|
||||
|
||||
|
||||
Mob aggroMob = (Mob) awoMob;
|
||||
if(GuardCanAggro(mob,aggroMob)) {
|
||||
mob.setCombatTarget(aggroMob);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckForPlayerGuardAggro" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean GuardCanAggro(Mob mob, PlayerCharacter target) {
|
||||
public static Boolean GuardCanAggro(Mob mob, AbstractCharacter target) {
|
||||
|
||||
try {
|
||||
|
||||
|
||||
@@ -541,8 +541,11 @@ public class Building extends AbstractWorldObject {
|
||||
if(playerCity != null){
|
||||
if(this.getGuild().getNation().equals(playerCity.getTOL().getGuild().getNation())){
|
||||
//friendly building has been attacked, add attacker to city outlaw list
|
||||
if(!playerCity.cityOutlaws.contains(attacker.getObjectUUID()))
|
||||
if(!playerCity.cityOutlaws.contains(attacker.getObjectUUID()) && attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
playerCity.cityOutlaws.add(attacker.getObjectUUID());
|
||||
for(Mob guard : playerCity.getParent().zoneMobSet)
|
||||
if(guard.combatTarget == null)
|
||||
guard.setCombatTarget(attacker);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user