9
3

RearShot.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --[[
  2. Script Name : Spells/Scout/Predator/Ranger/RearShot.lua
  3. Script Author : Jabantiz
  4. Script Date : 2014.03.09 08:03:08
  5. Script Purpose :
  6. :
  7. --]]
  8. function precast(Caster, Target)
  9. -- Must be flanking or behind
  10. if not IsFlanking(Caster, Target) then
  11. SendMessage(Caster, "Must be flanking or behind.", "yellow")
  12. return false
  13. end
  14. -- Requires bow
  15. local item = GetEquippedItemBySlot(Caster, 16)
  16. if not item or GetItemType(item) ~= 2 then
  17. -- no item or item is not a ranged item (no way to determine different range items currently)
  18. return false, 68
  19. end
  20. return true
  21. end
  22. function cast(Caster, Target, Snare, MinVal, MaxVal)
  23. -- Inflicts 22 - 38 ranged damage on target
  24. if MaxVal ~= nil and MinVal < MaxVal then
  25. SpellDamage(Target, 0, math.random(MinVal, MaxVal))
  26. else
  27. SpellDamage(Target, 0, MinVal)
  28. end
  29. -- Applies Snare on termination. Lasts for 24.0 seconds.
  30. -- Slows target by 27.4%
  31. -- 5% chance to dispel when target receives hostile action
  32. -- 5% chance to dispel when target takes damage
  33. local slow = 100.0 - snare
  34. SetSpeedMultiplier(Target, slow)
  35. AddSpellTimer(24000, "RemoveSnare")
  36. end
  37. function RemoveSnare(Caster, Target)
  38. SetSpeedMultiplier(Target, 1)
  39. end