From 3e659d981a97cde301aceba4a8d6b0b471180143 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 24 May 2023 19:14:23 -0500 Subject: [PATCH] Patrol wait determined by MBServerStatics.AI_PATROL_DIVISOR mob cast chance now determined by MBStatics.AI_POWER_CHANCE mob cast cooldown now determined by MBServerStatics.AI_POWER_DIVISOR guards use normal mob damage calculations --- src/engine/ai/MobileFSM.java | 14 +++++--------- src/engine/ai/utilities/CombatUtilities.java | 3 ++- src/engine/objects/Mob.java | 6 +++++- src/engine/server/MBServerStatics.java | 1 + 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index 7b9ad4e9..c3929675 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -180,9 +180,7 @@ public class MobileFSM { mob.stopPatrolTime = System.currentTimeMillis(); return; } - //wait between 10 and 15 seconds after reaching patrol point before moving - int patrolDelay = ThreadLocalRandom.current().nextInt(10000) + 5000; - if (mob.stopPatrolTime + patrolDelay > System.currentTimeMillis()) + if (mob.stopPatrolTime + (MBServerStatics.AI_PATROL_DIVISOR * 1000) > System.currentTimeMillis()) //early exit while waiting to patrol again return; //guard captains inherit barracks patrol points dynamically @@ -226,6 +224,9 @@ public class MobileFSM { // mobile in the proper state to cast. if (mob == null) return false; + if(ThreadLocalRandom.current().nextInt(100) > MBServerStatics.AI_POWER_CHANCE){ + return false; + } if (mob.mobPowers.isEmpty()) return false; if (mob.nextCastTime == 0) @@ -272,12 +273,7 @@ public class MobileFSM { msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target); msg.setUnknown04(2); PowersManager.finishUseMobPower(msg, mob, 0, 0); - // Default minimum seconds between cast = 10 - long coolDown = mobPower.getCooldown(); - if (coolDown < 10000) - mob.nextCastTime = System.currentTimeMillis() + 10000 + coolDown; - else - mob.nextCastTime = System.currentTimeMillis() + coolDown; + mob.nextCastTime = System.currentTimeMillis() + (MBServerStatics.AI_POWER_DIVISOR * 1000); return true; } return false; diff --git a/src/engine/ai/utilities/CombatUtilities.java b/src/engine/ai/utilities/CombatUtilities.java index 716f0707..55cbb098 100644 --- a/src/engine/ai/utilities/CombatUtilities.java +++ b/src/engine/ai/utilities/CombatUtilities.java @@ -335,7 +335,8 @@ public class CombatUtilities { if(agent.isSummonedPet() == true || agent.isPet() == true || agent.isNecroPet() == true) { damage = calculatePetDamage(agent); }else if(agent.isPlayerGuard() == true){ - damage = calculateGuardDamage(agent); + //damage = calculateGuardDamage(agent); + damage = calculateMobDamage(agent); }else if (agent.getLevel() > 80) { damage = calculateEpicDamage(agent); } else{ diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 2106344b..79769d1f 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1392,7 +1392,11 @@ public class Mob extends AbstractIntelligenceAgent { NPCManager.applyRuneSetEffects(this); this.recalculateStats(); this.setHealth(this.healthMax); - this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z); + if(this.building == null && ((Mob)this.npcOwner).BehaviourType.ordinal() == MobBehaviourType.GuardCaptain.ordinal()){ + this.building = ((Mob)this.npcOwner).building; + } else { + this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z); + } MovementManager.translocate(this,this.bindLoc, this.region); if (!this.isSiege && !this.isPlayerGuard && contract == null) loadInventory(); diff --git a/src/engine/server/MBServerStatics.java b/src/engine/server/MBServerStatics.java index d46038e7..9da46d95 100644 --- a/src/engine/server/MBServerStatics.java +++ b/src/engine/server/MBServerStatics.java @@ -655,6 +655,7 @@ public class MBServerStatics { public static int AI_POWER_DIVISOR = 20; public static int AI_PET_HEEL_DISTANCE = 10; public static int AI_PATROL_RADIUS = 60; + public static int AI_POWER_CHANCE = 30; // set 1 -100 to determine mobs chance to cast a spell public static float AI_MAX_ANGLE = 10f;