9
3

BetaDamage.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --[[
  2. Script Name : Spells/Commoner/BetaDamage.lua
  3. Script Purpose : Generic damage + 1 effect script
  4. Script Author : John Adams
  5. Script Date : 2008.12.02
  6. --]]
  7. function cast(Caster, Target, DDType, MinDDVal, MaxDDVal, EffectType, DamageType, MinEffectVal, MaxEffectVal)
  8. -- DD component
  9. if MaxDDVal ~= nil and MinDDVal < MaxDDVal then
  10. dmgAmount = math.random(MinDDVal, MaxDDVal)
  11. SpellDamage(Target, DDType, dmgAmount)
  12. --AddHate(Caster, Target, dmgAmount)
  13. else
  14. SpellDamage(Target, DDType, MinDDVal)
  15. --AddHate(Caster, Target, MinDDVal)
  16. end
  17. -- Effect component - only process this code if there is an EffectType param
  18. if EffectType ~= nil then
  19. -- Determine if there is a range to effect values
  20. if MaxEffectVal ~= nil and MinEffectVal < MaxEffectVal then
  21. EffectValue = math.random(MinEffectVal, MaxEffectVal)
  22. else
  23. EffectValue = MinEffectVal
  24. end
  25. -- Determine EffectType - either a DamageType or a String value passed as param 4
  26. if EffectType == "heal" then
  27. ModifyHP(Caster, EffectValue)
  28. else
  29. SpellDamage(Target, DamageType, EffectValue)
  30. end
  31. end
  32. end
  33. function tick(Caster, Target, DDType, MinDDVal, MaxDDVal, EffectType, DamageType, MinEffectVal, MaxEffectVal)
  34. if MaxEffectVal ~= nil and MinEffectVal < MaxEffectVal then
  35. EffectValue = math.random(MinEffectVal, MaxEffectVal)
  36. else
  37. EffectValue = MinEffectVal
  38. end
  39. if EffectType == "heal" then
  40. ModifyHP(Caster, EffectValue)
  41. else
  42. SpellDamage(Target, DamageType, EffectValue)
  43. end
  44. end