diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 6f5a79c3..86899365 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -52,18 +52,18 @@ public class MobAI { } //mob casting disabled - //if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter && canCast(mob)) { + if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter && canCast(mob)) { - //if (mob.isPlayerGuard() == false && MobCast(mob)) { - // mob.updateLocation(); - // return; - //} + if (mob.isPlayerGuard() == false && MobCast(mob)) { + mob.updateLocation(); + return; + } - //if (mob.isPlayerGuard() == true && GuardCast(mob)) { - // mob.updateLocation(); - // return; - //} - //} + if (mob.isPlayerGuard() == true && GuardCast(mob)) { + mob.updateLocation(); + return; + } + } if (!CombatUtilities.inRangeToAttack(mob, target)) return; @@ -339,12 +339,14 @@ public class MobAI { if (mob == null) return false; - if (mob.nextCastTime == 0) - mob.nextCastTime = System.currentTimeMillis() - 1000L; + if (mob.mobPowers == null || mob.mobPowers.isEmpty()) + return false; if(mob.nextCastTime > System.currentTimeMillis()) return false; + mob.nextCastTime = System.currentTimeMillis() + 30000L; + if(mob.isPlayerGuard){ int contractID = 0; @@ -358,15 +360,12 @@ public class MobAI { return false; } - if (mob.mobPowers == null || mob.mobPowers.isEmpty()) - return false; - if (!mob.canSee((PlayerCharacter) mob.getCombatTarget())) { mob.setCombatTarget(null); return false; } - return mob.nextCastTime <= System.currentTimeMillis(); + return true; } catch (Exception e) { ////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: canCast" + " " + e.getMessage()); @@ -447,11 +446,11 @@ public class MobAI { } msg.setUnknown04(2); - - PowersManager.finishUseMobPower(msg, mob, 0, 0); - long delay = 20000L; - mob.nextCastTime = System.currentTimeMillis() + delay; - + try { + PowersManager.finishUseMobPower(msg, mob, 0, 0); + }catch(Exception e) { + return false; + } return true; } } catch (Exception e) {