forked from MagicBane/Server
mob cast delay cached
This commit is contained in:
@@ -423,8 +423,8 @@ public class MobAI {
|
||||
msg.setUnknown04(2);
|
||||
|
||||
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||
int randomCooldown = ThreadLocalRandom.current().nextInt(1,10);
|
||||
mob.nextCastTime = System.currentTimeMillis() + (long) ((mobPower.getCooldown() + (MobAIThread.AI_POWER_DIVISOR * 1000))) + (randomCooldown * 1000);
|
||||
long randomCooldown = (long)(ThreadLocalRandom.current().nextInt(10,15) * MobAIThread.AI_CAST_FREQUENCY);
|
||||
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -519,9 +519,8 @@ public class MobAI {
|
||||
msg.setUnknown04(2);
|
||||
|
||||
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||
int randomCooldown = ThreadLocalRandom.current().nextInt(1,10);
|
||||
|
||||
mob.nextCastTime = System.currentTimeMillis() + (long) ((mobPower.getCooldown() + (MobAIThread.AI_POWER_DIVISOR * 1000))) + (randomCooldown * 1000);
|
||||
long randomCooldown = (long)(ThreadLocalRandom.current().nextInt(10,15) * MobAIThread.AI_CAST_FREQUENCY);
|
||||
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package engine.mobileAI.Threads;
|
||||
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.mobileAI.MobAI;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.Zone;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
public class MobAIThread implements Runnable{
|
||||
@@ -11,7 +13,7 @@ public class MobAIThread implements Runnable{
|
||||
public static int AI_DROP_AGGRO_RANGE = 60;
|
||||
public static int AI_PULSE_MOB_THRESHOLD = 200;
|
||||
public static int AI_PATROL_DIVISOR = 15;
|
||||
public static int AI_POWER_DIVISOR = 20;
|
||||
public static float AI_CAST_FREQUENCY;
|
||||
// Thread constructor
|
||||
|
||||
public MobAIThread() {
|
||||
@@ -21,6 +23,8 @@ public class MobAIThread implements Runnable{
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
//cache config value for mobile casting delay
|
||||
AI_CAST_FREQUENCY = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue());
|
||||
while (true) {
|
||||
for (Zone zone : ZoneManager.getAllZones()) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user