Backstab.lua 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --[[
  2. Script Name : Spells/Scout/Rogue/Backstab.lua
  3. Script Author : LordPazuzu
  4. Script Date : 1/3/2023
  5. Script Purpose :
  6. :
  7. --]]
  8. -- Inflicts 46 - 78 melee damage on target
  9. -- Decreases AGI of target by 7.2
  10. -- Must be flanking or behind
  11. function precast(Caster,Target)
  12. if not IsFlanking(Caster, Target) and not IsBehind(Caster, Target) then
  13. SendMessage(Caster, "Must be flanking or behind", "yellow")
  14. return false
  15. end
  16. return true
  17. end
  18. function cast(Caster, Target, DmgType, MinVal, MaxVal, Agi)
  19. Level = GetLevel(Caster)
  20. SpellLevel = 10
  21. Mastery = SpellLevel + 10
  22. StatBonus = GetStr(Caster) / 10
  23. if Level < Mastery then
  24. LvlBonus = Level - SpellLevel
  25. else LvlBonus = Mastery - SpellLevel
  26. end
  27. DmgBonus = LvlBonus + StatBonus
  28. MaxDmg = math.floor(DmgBonus) * 2 + MaxVal
  29. MinDmg = math.floor(DmgBonus) * 2 + MinVal
  30. SpellDamage(Target, DmgType, MinDmg, MaxDmg)
  31. AddSpellBonus(Target, 2, Agi)
  32. end
  33. function remove(Caster, Target)
  34. RemoveSpellBonus(Target)
  35. end