Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. local storagedodge = 98798644 -- storage do dodge
  2. local cor = 210 -- cor do texto
  3. local effect = 61 -- id do magic effect
  4. local msg = "Block" -- msg
  5.  
  6. local dodge = {
  7. {min = 5, max = 20, chance = 18}, -- se o dodge tiver entre 1 e 2 tem 10% de chance de da dodge.
  8. {min = 21, max = 40, chance = 23}, -- podem ser configurada portanto que não passe do limite
  9. {min = 41, max = 60, chance = 28}, -- vocês pode adicionar mas se quiserem
  10. {min = 61, max = 80, chance = 35},
  11. {min = 81, max = 98, chance = 38},
  12. {min = 99, max = math.huge, chance = 40}
  13. }
  14.  
  15. function onStatsChange(cid, attacker, type, combat, value)
  16. if not isCreature(cid) then
  17. return false
  18. end
  19. for _, tudo in pairs(dodge) do
  20. if getPlayerStorageValue(cid, storagedodge) >= tudo.min and getPlayerStorageValue(cid, storagedodge) <= tudo.max then
  21. local chancex = math.random(1, 100)
  22. if chancex <= tudo.chance then
  23. if combat ~= COMBAT_HEALING then
  24. doSendMagicEffect(getCreaturePosition(cid), effect)
  25. doSendAnimatedText(getCreaturePosition(cid), msg, cor)
  26. return false
  27. end
  28. end
  29. end
  30. end
  31. return true
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement