Sprint.lua 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. --[[
  2. Script Name : Spells/Commoner/Sprint.lua
  3. Script Purpose : Sprint
  4. Script Author : theFoof
  5. Script Date : 2014.3.9
  6. Script Note : Modified 4/20/2024 LordPazuzu
  7. --]]
  8. function cast(Caster, Target)
  9. AddSpellBonus(Caster, 616, 40)
  10. AddSpellBonus(Caster, 609, 40)
  11. end
  12. function tick(Caster, Target)
  13. if HasMoved(Caster) then
  14. ModifyPower(Caster, math.floor(GetMaxPower(Caster) * -0.1))
  15. end
  16. if GetPower(Caster) < (GetMaxPower(Caster) * 0.1) then
  17. CancelSpell()
  18. end
  19. end
  20. function remove(Caster, Target)
  21. RemoveSpellBonus()
  22. end
  23. --[[function cast(Caster, Target, Speed, is_tick)
  24. local has_moved = SprinterHasMoved(Caster, is_tick)
  25. if not has_moved and GetTempVariable(Caster, "sprint_bonus_active") == "true" then
  26. return
  27. end
  28. local power_left = GetPower(Caster)
  29. local total_power = GetMaxPower(Caster)
  30. if power_left - (total_power * .1) < 0 then
  31. if GetTempVariable(Caster, "sprint_bonus_active") == "true" then
  32. RemoveSpellBonus()
  33. SetTempVariable(Caster, "sprint_bonus_active", nil)
  34. end
  35. else
  36. if is_tick == true then
  37. local total_power = GetMaxPower(Caster)
  38. ModifyPower(Caster, (-1 *(total_power * .1)))
  39. end
  40. if GetTempVariable(Caster, "sprint_bonus_active") ~= "true" then
  41. AddSpellBonus(Caster, 609, Speed)
  42. end
  43. SetTempVariable(Caster, "sprint_bonus_active", "true")
  44. SetTempVariable(Caster, "sprint_bonus_x", GetX(Caster) .. "")
  45. SetTempVariable(Caster, "sprint_bonus_y", GetY(Caster) .. "")
  46. SetTempVariable(Caster, "sprint_bonus_z", GetZ(Caster) .. "")
  47. end
  48. end
  49. function SprinterHasMoved(Caster, is_tick)
  50. if is_tick ~= true then
  51. return true
  52. end
  53. local ret = false
  54. if GetTempVariable(Caster, "sprint_bonus_x") ~= GetX(Caster) .. "" then
  55. ret = true
  56. elseif GetTempVariable(Caster, "sprint_bonus_y") ~= GetY(Caster) .. "" then
  57. ret = true
  58. elseif GetTempVariable(Caster, "sprint_bonus_z") ~= GetZ(Caster) .. "" then
  59. ret = true
  60. end
  61. return ret
  62. end
  63. function tick(Caster, Target, Speed)
  64. cast(Caster, Target, Speed, true)
  65. end
  66. function remove(Caster)
  67. RemoveSpellBonus()
  68. SetTempVariable(Caster, "sprint_bonus_active", nil)
  69. SetTempVariable(Caster, "sprint_bonus_x", nil)
  70. SetTempVariable(Caster, "sprint_bonus_y", nil)
  71. SetTempVariable(Caster, "sprint_bonus_z", nil)
  72. end--]]