HeadShot.lua 957 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --[[
  2. Script Name : Spells/Scout/Predator/Assassin/HeadShot.lua
  3. Script Author : neatz09
  4. Script Date : 2019.09.23 03:09:38
  5. Script Purpose :
  6. :
  7. --]]
  8. -- If weapon equipped in Ranged
  9. -- Must be flanking or behind
  10. function precast(Caster, Target)
  11. -- Must be flanking or behind
  12. if not IsFlanking(Caster, Target) then
  13. SendMessage(Caster, "Must be flanking or behind", "yellow")
  14. return false
  15. end
  16. -- If weapon equipped in Ranged
  17. local item = GetEquippedItemBySlot(Caster, 16)
  18. if item then
  19. if GetItemType(item) == 2 then
  20. return true
  21. end
  22. end
  23. return false, 68
  24. end
  25. -- Inflicts 725 - 1209 ranged damage on target
  26. function cast(Caster, Target, DmgType, MinVal, MaxVal)
  27. if MaxVal ~= nil and MinVal < MaxVal then
  28. SpellDamage(Target, DmgType, math.random(MinVal, MaxVal))
  29. else
  30. SpellDamage(Target, DmgType, MinVal)
  31. end
  32. end