forked from MagicBane/Server
Project reformat.
This commit is contained in:
@@ -323,7 +323,7 @@ public class MobAI {
|
||||
|
||||
if (mob.isPlayerGuard() == true) {
|
||||
|
||||
if(mob.agentType.equals(Enum.AIAgentType.GUARDWALLARCHER))
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDWALLARCHER))
|
||||
return false; //wall archers don't cast
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
||||
contractID = mob.guardCaptain.contract.getContractID();
|
||||
@@ -574,10 +574,10 @@ public class MobAI {
|
||||
|
||||
//no players loaded, no need to proceed unless it's a player guard
|
||||
boolean bypassLoadedPlayerCheck = false;
|
||||
if(mob.isPlayerGuard() || mob.isSiege()) {
|
||||
if (mob.isPlayerGuard() || mob.isSiege()) {
|
||||
bypassLoadedPlayerCheck = true;
|
||||
if(mob.combatTarget != null && mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||
if(mob.combatTarget.loc.distanceSquared(mob.loc) > 10000)
|
||||
if (mob.combatTarget != null && mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||
if (mob.combatTarget.loc.distanceSquared(mob.loc) > 10000)
|
||||
mob.setCombatTarget(null);
|
||||
}
|
||||
|
||||
@@ -845,7 +845,7 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
if (mob.getCombatTarget() != null && mob.getRange() * mob.getRange() >= MobAIThread.AI_BASE_AGGRO_RANGE * 0.5f)
|
||||
if (mob.getCombatTarget() != null && mob.getRange() * mob.getRange() >= MobAIThread.AI_BASE_AGGRO_RANGE * 0.5f)
|
||||
return;
|
||||
|
||||
if (mob.isPlayerGuard() && !mob.despawned) {
|
||||
@@ -888,12 +888,12 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
if(mob.getTimestamps().containsKey("lastChase") == false)
|
||||
mob.getTimestamps().put("lastChase",System.currentTimeMillis());
|
||||
else if(System.currentTimeMillis() < mob.getTimestamps().get("lastChase").longValue() + (750 + ThreadLocalRandom.current().nextInt(0,500)))
|
||||
return;
|
||||
if (mob.getTimestamps().containsKey("lastChase") == false)
|
||||
mob.getTimestamps().put("lastChase", System.currentTimeMillis());
|
||||
else if (System.currentTimeMillis() < mob.getTimestamps().get("lastChase").longValue() + (750 + ThreadLocalRandom.current().nextInt(0, 500)))
|
||||
return;
|
||||
|
||||
mob.getTimestamps().put("lastChase",System.currentTimeMillis());
|
||||
mob.getTimestamps().put("lastChase", System.currentTimeMillis());
|
||||
|
||||
if (mob.getRange() * mob.getRange() <= mob.loc.distanceSquared(mob.combatTarget.loc)) {
|
||||
if (mob.getRange() > 15) {
|
||||
@@ -974,10 +974,10 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
|
||||
if(mob.behaviourType.canRoam)
|
||||
if (mob.behaviourType.canRoam)
|
||||
CheckMobMovement(mob);//all guards that can move check to move
|
||||
|
||||
if(mob.combatTarget != null)
|
||||
if (mob.combatTarget != null)
|
||||
CheckForAttack(mob); //only check to attack if combat target is not null
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -1128,21 +1128,21 @@ public class MobAI {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (mob.getCombatTarget() == null) {
|
||||
if (mob.getCombatTarget() == null) {
|
||||
|
||||
//look for siege equipment to aggro if no players found to aggro
|
||||
//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);
|
||||
HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(mob, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_SIEGE);
|
||||
|
||||
for (AbstractWorldObject awoMob : awoList) {
|
||||
for (AbstractWorldObject awoMob : awoList) {
|
||||
|
||||
|
||||
Mob aggroMob = (Mob) awoMob;
|
||||
if(GuardCanAggro(mob,aggroMob)) {
|
||||
mob.setCombatTarget(aggroMob);
|
||||
return;
|
||||
}
|
||||
Mob aggroMob = (Mob) awoMob;
|
||||
if (GuardCanAggro(mob, aggroMob)) {
|
||||
mob.setCombatTarget(aggroMob);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package engine.mobileAI.Threads;
|
||||
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.mobileAI.MobAI;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.mobileAI.MobAI;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.Zone;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
public class MobAIThread implements Runnable{
|
||||
public class MobAIThread implements Runnable {
|
||||
public static int AI_BASE_AGGRO_RANGE = 60;
|
||||
public static int AI_DROP_AGGRO_RANGE = 60;
|
||||
public static int AI_PULSE_MOB_THRESHOLD = 200;
|
||||
@@ -25,7 +24,7 @@ public class MobAIThread implements Runnable{
|
||||
public void run() {
|
||||
//cache config value for mobile casting delay
|
||||
AI_CAST_FREQUENCY = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue());
|
||||
AI_BASE_AGGRO_RANGE = (int)(60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue()));
|
||||
AI_BASE_AGGRO_RANGE = (int) (60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue()));
|
||||
while (true) {
|
||||
for (Zone zone : ZoneManager.getAllZones()) {
|
||||
|
||||
@@ -42,6 +41,7 @@ public class MobAIThread implements Runnable{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void startAIThread() {
|
||||
Thread aiThread;
|
||||
aiThread = new Thread(new MobAIThread());
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
|
||||
package engine.mobileAI.Threads;
|
||||
|
||||
import engine.objects.Mob;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user