Guest User

Untitled

a guest
Apr 13th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.99 KB | None | 0 0
  1. function onStatsChange(cid, attacker, type, combat, value)
  2.  
  3. local attackername = getPokemonName(attacker)
  4. local hit = 1
  5.  
  6. --// Edited pvp system
  7. if not canAttackOther(attacker, cid) and (isSummon(cid) or isPlayer(cid)) then -- parte do duel e qualquer outra coisa q tenha pvp
  8. return true -- aqui acho q vou ter q rever
  9. end
  10. --// Edited pvp system
  11.  
  12. if isCreature(cid) then
  13. if (isSummon(cid) and isPlayer(getCreatureMaster(cid)) and isWild(attacker)) or (isSummon(attacker) and isPlayer(getCreatureMaster(attacker)) and isWild(cid)) or (isPlayer(cid) and isWild(attacker)) then
  14. if(getPlayerStorageValue(attacker, storages.GRRRRSto) <= 0) and isPlayer(cid) then return false end
  15.  
  16. --// Edited pvp system
  17. if not canAttackOther(attacker, cid) and isSummon(attacker) and (isSummon(cid) or isPlayer(cid)) then -- parte do duel e qualquer outra coisa q tenha pvp
  18. return true
  19. end
  20. --// Edited pvp system
  21.  
  22. if combat == STATUS_SLEEP then
  23. setPokemonStatus(cid, "sleep", value, 0, true, attacker)
  24. return true
  25. elseif combat == STATUS_STUN then
  26. setPokemonStatus(cid, "stun", value, 0, true, attacker)
  27. return true
  28. elseif combat == STATUS_STRING then
  29. setPokemonStatus(cid, "string", value, 0, true, attacker)
  30. return true
  31. elseif combat == STATUS_BLIND then
  32. setPokemonStatus(cid, "blind", value, 0, true, attacker)
  33. return true
  34. elseif combat == STATUS_CONFUSION10 or combat == STATUS_CONFUSION7 then
  35. setPokemonStatus(cid, "confusion", (combat == STATUS_CONFUSION10 and 10 or 7), value, true, attacker)
  36. return true
  37. elseif combat == STATUS_POISON20 or combat == STATUS_POISON10 or combat == STATUS_POISON5 then
  38. setPokemonStatus(cid, "poison", (combat == STATUS_POISON5 and 5 or combat == STATUS_POISON10 and 10 or 20), value, true, attacker)
  39. return true
  40. elseif combat == STATUS_BURN5 or combat == STATUS_BURN10 then
  41. setPokemonStatus(cid, "burn", (combat == STATUS_BURN5 and 5 or 10), value, true, attacker)
  42. return true
  43. elseif combat == STATUS_LEECHSEED then
  44. setPokemonStatus(cid, "leechSeed", 20, value, true, attacker)
  45. return true
  46. elseif combat == STATUS_FEAR then
  47. setPokemonStatus(cid, "fear", value, 0, true, attacker)
  48. return true
  49. elseif combat == STATUS_SLOW then
  50. setPokemonStatus(cid, "speedDown", value, 0, true, attacker)
  51. return true
  52. elseif combat == STATUS_SILENCE then
  53. setPokemonStatus(cid, "silence", 8, value, true, attacker)
  54. return true
  55. end
  56. end
  57. if ((isSummon(cid) or isPlayer(cid))) or (isWild(cid) and isWild(attacker)) then
  58. if combat == COMBAT_HEAL then
  59. local heal = value
  60. if getCreatureHealth(cid) + value > getCreatureMaxHealth(cid) then
  61. heal = getCreatureMaxHealth(cid) - getCreatureHealth(cid)
  62. end
  63. if heal > 0 then
  64. doSendAnimatedText(getThingPos(cid), "+"..heal, 35)
  65. doCreatureAddHealth(cid, heal)
  66. end
  67. if isSummon(cid) then
  68. doOTCSendPokemonHealth(getCreatureMaster(cid))
  69. end
  70. return true
  71. end
  72. end
  73. end
  74.  
  75. if isSummon(cid) and isPlayer(getCreatureMaster(cid)) and (isWild(attacker) or isSummon(attacker)) then --- Wild poke ataca
  76.  
  77. local master = getCreatureMaster(cid)
  78. for i = 1, #silenceStatus do
  79. if getPokemonStatus(attacker, silenceStatus[i]) then return true end
  80. end
  81. if getCreatureCondition(cid, CONDITION_INVISIBLE) then return true end
  82. local modifier = 1.2 * getMultiplier(COMBAT_NAMES[combat], cid)
  83. local defPercent = 1 - (getPokemonDefense(getCreatureName(cid))/255)
  84. hit = math.ceil((value * defPercent) * modifier)
  85. if getPokemonStatus(cid, "harden") then
  86. hit = math.ceil(hit * 0.75)
  87. end
  88. if isCreature(cid) and tonumber(getCreatureHealth(cid)) - hit <= 0 then
  89. hit = getCreatureHealth(cid)
  90. end
  91. doSendMagicEffect(getThingPos(cid), COMBAT_EFFECTS[combat])
  92. if combat == ABSORB_GRASS or combat == ABSORB_POISON or combat == ABSORB_NORMAL or combat == ABSORB_BUG then
  93. doSendAnimatedText(getThingPos(cid), "-"..hit, 180)
  94. doSendAnimatedText(getThingPos(attacker), "+"..hit, 35)
  95. doCreatureAddHealth(cid, -hit, 255, 255, attacker)
  96. doCreatureAddHealth(attacker, hit)
  97. else
  98. doCreatureAddHealth(cid, -hit, 2, COMBAT_COLORS[combat], attacker)
  99. end
  100. doPlayerSendCancel(master, "Seu pokemon perdeu "..hit.." pontos de vida devido a um ataque de um "..attackername..".")
  101. if isCreature(cid) and isUsingPotion(cid) then
  102. setPlayerStorageValue(cid, storages.potion, -1)
  103. doSendAnimatedText(getThingPos(cid), "LOST HEAL", COLOR_RED)
  104. end
  105. if isCreature(cid) and tonumber(getCreatureHealth(cid)) - hit > 0 then
  106. doOTCSendPokemonHealth(master)
  107. end
  108. return true
  109.  
  110. elseif isSummon(attacker) and isPlayer(getCreatureMaster(attacker)) and (isWild(cid)) then --- Poke summon ataca
  111. local master = getCreatureMaster(attacker)
  112. for i = 1, #silenceStatus do
  113. if getPokemonStatus(attacker, silenceStatus[i]) then return true end
  114. end
  115. if getCreatureCondition(cid, CONDITION_INVISIBLE) then return true end
  116. local modifier = tableFome[getFeedStatus(attacker)].hitMultiplier * getMultiplier(COMBAT_NAMES[combat], cid) * getPlayerFightModeOffense(master)
  117. local defPercent = 1 - (getPokemonDefense(getCreatureName(cid))/255)
  118. hit = math.ceil((value * defPercent) * modifier)
  119. if getPokemonStatus(cid, "harden") then
  120. hit = math.ceil(hit * 0.75)
  121. end
  122. if isCreature(cid) and tonumber(getCreatureHealth(cid)) - hit <= 0 then
  123. hit = getCreatureHealth(cid)
  124. end
  125. doSendMagicEffect(getThingPos(cid), COMBAT_EFFECTS[combat])
  126. if combat == ABSORB_GRASS or combat == ABSORB_POISON or combat == ABSORB_NORMAL or combat == ABSORB_BUG then
  127. doSendAnimatedText(getThingPos(cid), "-"..hit, 180)
  128. doSendAnimatedText(getThingPos(attacker), "+"..hit, 35)
  129. doCreatureAddHealth(cid, -hit, 255, 255, attacker)
  130. doCreatureAddHealth(attacker, hit)
  131. doOTCSendPokemonHealth(master)
  132. else
  133. doCreatureAddHealth(cid, -hit, 2, COMBAT_COLORS[combat], attacker)
  134. end
  135. return true
  136.  
  137. elseif isPlayer(cid) then
  138. if getPlayerStorageValue(attacker, storages.GRRRRSto) <= 0 then return true end
  139. for i = 1, #silenceStatus do
  140. if getPokemonStatus(attacker, silenceStatus[i]) then return true end
  141. end
  142. if getCreatureCondition(cid, CONDITION_INVISIBLE) then return true end
  143. hit = math.ceil((value/2) * 1.2)
  144. if isCreature(cid) and tonumber(getCreatureHealth(cid)) - hit <= 0 then
  145. hit = getCreatureHealth(cid)
  146. end
  147. doSendMagicEffect(getThingPos(cid), COMBAT_EFFECTS[combat])
  148. if combat == ABSORB_GRASS or combat == ABSORB_POISON or combat == ABSORB_NORMAL or combat == ABSORB_BUG then
  149. doSendAnimatedText(getThingPos(cid), "-"..hit, 180)
  150. doSendAnimatedText(getThingPos(attacker), "+"..hit, 35)
  151. doCreatureAddHealth(cid, -hit, 255, 255, attacker)
  152. doCreatureAddHealth(attacker, hit)
  153. else
  154. doCreatureAddHealth(cid, -hit, 2, COMBAT_COLORS[combat], attacker)
  155. end
  156. doPlayerSendCancel(cid, "VocĂȘ perdeu "..hit.." pontos de vida devido a um ataque de um "..attackername..".")
  157. return true
  158. end
  159.  
  160. return true
  161. end
Advertisement
Add Comment
Please, Sign In to add comment