HiddenShot.lua 996 B

1234567891011121314151617181920212223242526272829303132333435
  1. --[[
  2. Script Name : Spells/Scout/Predator/Ranger/HiddenShot.lua
  3. Script Author : neatz09
  4. Script Date : 2019.10.06 10:10:03
  5. Script Purpose :
  6. :
  7. --]]
  8. function precast(Caster, Target)
  9. -- You must be sneaking to use this ability.
  10. if IsStealthed(Caster) then
  11. return true
  12. else
  13. SendMessage(Caster, "You must be sneaking to use this ability.", "yellow")
  14. return false
  15. end
  16. -- Requires bow
  17. local item = GetEquippedItemBySlot(Caster, 16)
  18. if not item or GetItemType(item) ~= 2 then
  19. -- no item or item is not a ranged item (no way to determine different range items currently)
  20. return false, 68
  21. end
  22. return true
  23. end
  24. -- Inflicts 480 - 800 ranged damage on target
  25. function cast(Caster, Target, DmgType, MinVal, MaxVal)
  26. if MaxVal ~= nil and MinVal < MaxVal then
  27. SpellDamage(Target, DmgType, math.random(MinVal, MaxVal))
  28. else
  29. SpellDamage(Target, DmgType, MinVal)
  30. end
  31. end