BackShot.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --[[
  2. Script Name : Spells/Scout/Predator/BackShot.lua
  3. Script Author : LordPazuzu
  4. Script Date : 2023.03.30 04:03:29
  5. Script Purpose :
  6. :
  7. --]]
  8. --[[ Info from spell_display_effects (remove from script when done)
  9. *Inflicts 106 - 178 ranged damage on target
  10. *If weapon equipped in Ranged
  11. *Must be flanking or behind
  12. --]]
  13. function precast(Caster, Target)
  14. local item = GetEquippedItemBySlot(Caster, 16)
  15. if not item or GetItemType(item) ~= 2 then
  16. -- no item or item is not a ranged item (no way to determine different range items currently)
  17. SendMessage(Caster, "Must have ranged weapon equipped", "yellow")
  18. return false, 68
  19. end
  20. if not IsFlanking(Caster, Target) and not IsBehind(Caster, Target) then
  21. SendMessage(Caster, "Must be flanking or behind", "yellow")
  22. return false
  23. end
  24. return true
  25. end
  26. function cast(Caster, Target, MinVal, MaxVal)
  27. Level = GetLevel(Caster)
  28. SpellLevel = 15
  29. Mastery = SpellLevel + 10
  30. StatBonus = GetAgi(Caster) / 10
  31. if Level < Mastery then
  32. LvlBonus = Level - SpellLevel
  33. else LvlBonus = Mastery - SpellLevel
  34. end
  35. DmgBonus = LvlBonus + StatBonus
  36. MaxDmg = math.floor(DmgBonus) * 2 + MaxVal
  37. MinDmg = math.floor(DmgBonus) * 2 + MinVal
  38. SpellDamage(Target, 2, MinDmg, MaxDmg)
  39. end