Advertisement
Guest User

bloodsuck.lua

a guest
Nov 24th, 2013
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. local function suck(cid, target)
  2. if isCreature(cid) then
  3. if isCreature(target) then
  4. local formula = math.random(getPlayerLevel(cid), getPlayerLevel(cid) * 1.5)
  5.  
  6. doCreatureAddHealth(cid, formula)
  7. doCreatureAddHealth(target, -formula)
  8. doSendAnimatedText(getThingPos(cid), "+"..formula, COLOR_GREEN)
  9. doSendAnimatedText(getThingPos(target), "-"..formula, COLOR_RED)
  10. doSendMagicEffect(getThingPos(cid), 12)
  11. doSendMagicEffect(getThingPos(target), 3)
  12. return true
  13. end
  14. end
  15. return true
  16. end
  17.  
  18. function onCastSpell(cid)
  19. local config = {
  20. arrounds = 3, -- Vezes que a magia vai atacar
  21. exaust = 25, -- tempo de exaust -> 1 = 1s
  22. level = 50,
  23. mana = 200, -- Mana que vai gastar
  24. time = 1000, -- tempo para executar a magia novamente (arrounds) -> 1 = 1s
  25. t = getCreatureTarget(cid), --- Não mexa.
  26. }
  27.  
  28. if config.t <= 0 then
  29.  
  30. doPlayerSendCancel(cid, "You need a target.")
  31. return false
  32. end
  33.  
  34. if getCreatureMana(cid) < config.mana then
  35.  
  36. doPlayerSendCancel(cid, "You need "..config.mana.." of mana to cast this spell.")
  37. return false
  38. end
  39.  
  40. if getPlayerLevel(cid) < config.level then
  41.  
  42. doPlayerSendCancel(cid, "You need level "..config.level.." to cast this spell.")
  43. return false
  44. end
  45.  
  46. if exhaustion.get(cid, 21511) then
  47.  
  48. doPlayerSendCancel(cid, "You need wait "..exhaustion.get(cid, 21511).." seconds.")
  49. return false
  50. end
  51.  
  52. exhaustion.set(cid, 21511, config.exaust)
  53. doCreatureAddMana(cid, - config.mana)
  54. doCreatureSay(cid, "BLOOD SUCK", TALKTYPE_MONSTER)
  55.  
  56. for a = 1, config.arrounds do
  57.  
  58. addEvent(suck, config.time * a, cid, config.t)
  59. end
  60. return false
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement