From 0486fa52e4b158a357df5d1fea24c3c46e363af0 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 28 Mar 2024 22:17:08 -0500 Subject: [PATCH] mob attack delay --- src/engine/mobileAI/MobAI.java | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 210aefa3..9eac8c5c 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -50,16 +50,6 @@ public class MobAI { return; } - int delay = 3000; - if(mob.charItemManager.getEquipped().get(Enum.EquipSlotType.RHELD) != null){ - delay = (int)(mob.charItemManager.getEquipped().get(Enum.EquipSlotType.RHELD).template.item_weapon_wepspeed * 100); - } - if(mob.charItemManager.getEquipped().get(Enum.EquipSlotType.LHELD) != null && mob.charItemManager.getEquipped().get(Enum.EquipSlotType.LHELD).template.item_type.equals(Enum.ItemType.WEAPON)){ - delay += (int)(mob.charItemManager.getEquipped().get(Enum.EquipSlotType.LHELD).template.item_weapon_wepspeed * 100); - } - - - mob.nextAttackTime = System.currentTimeMillis() + delay; if (target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && !mob.canSee((AbstractCharacter) target)) { mob.setCombatTarget(null); @@ -778,9 +768,19 @@ public class MobAI { mob.setCombatTarget(null); return; } - if (System.currentTimeMillis() > mob.getNextAttackTime()) - AttackTarget(mob, mob.getCombatTarget()); + if (System.currentTimeMillis() > mob.getNextAttackTime()) { + int delay = 3000; + if (mob.charItemManager.getEquipped().get(Enum.EquipSlotType.RHELD) != null) { + delay = (int) (mob.charItemManager.getEquipped().get(Enum.EquipSlotType.RHELD).template.item_weapon_wepspeed * 100); + } + if (mob.charItemManager.getEquipped().get(Enum.EquipSlotType.LHELD) != null && mob.charItemManager.getEquipped().get(Enum.EquipSlotType.LHELD).template.item_type.equals(Enum.ItemType.WEAPON)) { + delay += (int) (mob.charItemManager.getEquipped().get(Enum.EquipSlotType.LHELD).template.item_weapon_wepspeed * 100); + } + + mob.nextAttackTime = System.currentTimeMillis() + delay; + AttackTarget(mob, mob.getCombatTarget()); + } } catch (Exception e) { Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckForAttack" + " " + e.getMessage()); }