Browse Source

mob attack delay

combat-2
FatBoy-DOTC 8 months ago
parent
commit
0486fa52e4
  1. 24
      src/engine/mobileAI/MobAI.java

24
src/engine/mobileAI/MobAI.java

@ -50,16 +50,6 @@ public class MobAI {
return; 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) && if (target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) &&
!mob.canSee((AbstractCharacter) target)) { !mob.canSee((AbstractCharacter) target)) {
mob.setCombatTarget(null); mob.setCombatTarget(null);
@ -778,9 +768,19 @@ public class MobAI {
mob.setCombatTarget(null); mob.setCombatTarget(null);
return; return;
} }
if (System.currentTimeMillis() > mob.getNextAttackTime()) if (System.currentTimeMillis() > mob.getNextAttackTime()) {
AttackTarget(mob, mob.getCombatTarget()); 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) { } catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckForAttack" + " " + e.getMessage()); Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckForAttack" + " " + e.getMessage());
} }

Loading…
Cancel
Save