forked from MagicBane/Server
guard aggro rules for hostiles
This commit is contained in:
@@ -2823,8 +2823,8 @@ public class Enum {
|
|||||||
Simple(null, false, false, true, false, false),
|
Simple(null, false, false, true, false, false),
|
||||||
Helpee(null, false, true, true, false, true),
|
Helpee(null, false, true, true, false, true),
|
||||||
HelpeeWimpy(null, true, false, true, false, false),
|
HelpeeWimpy(null, true, false, true, false, false),
|
||||||
GuardCaptain(null, false, true, true, true, false),
|
GuardCaptain(null, false, true, true, false, false),
|
||||||
GuardMinion(GuardCaptain, false, true, true, false, true),
|
GuardMinion(GuardCaptain, false, true, true, false, false),
|
||||||
GuardWallArcher(null, false, true, false, false, false),
|
GuardWallArcher(null, false, true, false, false, false),
|
||||||
Wanderer(null, false, true, true, false, false),
|
Wanderer(null, false, true, true, false, false),
|
||||||
HamletGuard(null, false, true, false, false, false),
|
HamletGuard(null, false, true, false, false, false),
|
||||||
|
|||||||
@@ -550,9 +550,10 @@ public class MobileFSM {
|
|||||||
CheckForPlayerGuardAggro(mob);
|
CheckForPlayerGuardAggro(mob);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(mob.npcOwner.getCombatTarget() != null){
|
if(mob.npcOwner.getCombatTarget() != null)
|
||||||
mob.setCombatTarget(mob.npcOwner.getCombatTarget());
|
mob.setCombatTarget(mob.npcOwner.getCombatTarget());
|
||||||
}
|
else
|
||||||
|
mob.setCombatTarget(null);
|
||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
if (mob.getCombatTarget() != null)
|
if (mob.getCombatTarget() != null)
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
@@ -622,14 +623,11 @@ public class MobileFSM {
|
|||||||
continue;
|
continue;
|
||||||
if (MovementUtilities.inRangeToAggro(mob, loadedPlayer)) {
|
if (MovementUtilities.inRangeToAggro(mob, loadedPlayer)) {
|
||||||
mob.setCombatTarget(loadedPlayer);
|
mob.setCombatTarget(loadedPlayer);
|
||||||
if (mob.contract != null)
|
|
||||||
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet())
|
|
||||||
minion.getKey().setCombatTarget(loadedPlayer);
|
|
||||||
return;
|
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()))
|
if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
|
||||||
return false;
|
return false;
|
||||||
//first check condemn list for aggro allowed (allies button is checked)
|
//first check condemn list for aggro allowed (allies button is checked)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
package engine.gameManager;
|
package engine.gameManager;
|
||||||
|
|
||||||
import engine.Enum.*;
|
import engine.Enum.*;
|
||||||
|
import engine.ai.MobileFSM;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.job.JobContainer;
|
import engine.job.JobContainer;
|
||||||
import engine.job.JobScheduler;
|
import engine.job.JobScheduler;
|
||||||
@@ -27,6 +28,7 @@ import engine.server.MBServerStatics;
|
|||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
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
|
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<AbstractCharacter,Integer> 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 {
|
public static void setAttackTarget(PetAttackMsg msg, ClientConnection origin) throws MsgSendException {
|
||||||
|
|||||||
Reference in New Issue
Block a user