Browse Source

guards will aggro siege equipment not belonging to the guild

combat-2
FatBoy-DOTC 1 year ago
parent
commit
cae5c36d84
  1. 19
      src/engine/mobileAI/MobAI.java
  2. 5
      src/engine/objects/Building.java

19
src/engine/mobileAI/MobAI.java

@ -1120,13 +1120,30 @@ public class MobAI { @@ -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 {

5
src/engine/objects/Building.java

@ -541,8 +541,11 @@ public class Building extends AbstractWorldObject { @@ -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);
}
}

Loading…
Cancel
Save