daily pastebin goal
56%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local combats = {
  2. [PSYCHICDAMAGE] = {cor = COLOR_PSYCHIC},
  3. [GRASSDAMAGE] = {cor = COLOR_GRASS},
  4. [POISONEDDAMAGE] = {cor = COLOR_GRASS},
  5. [MORTALGASDAMAGE] = {cor = COLOR_POISON},
  6. [FIREDAMAGE] = {cor = COLOR_FIRE2},                                   --COMPLETAMENTE EDITED
  7. [BURNEDDAMAGE] = {cor = COLOR_BURN},
  8. [WATERDAMAGE] = {cor = COLOR_WATER},
  9. [ICEDAMAGE] = {cor = COLOR_ICE},
  10. [NORMALDAMAGE] = {cor = COLOR_NORMAL},
  11. [GUILLOTINEDAMAGE] = {cor = COLOR_NORMAL},
  12. [FLYDAMAGE] = {cor = COLOR_FLYING},
  13. [GHOSTDAMAGE] = {cor = COLOR_GHOST},
  14. [NIGHTMAREDAMAGE] = {cor = COLOR_GHOST},
  15. [GROUNDDAMAGE] = {cor = COLOR_GROUND},
  16. [ELECTRICDAMAGE] = {cor = COLOR_ELECTRIC},
  17. [THUNDERWAVEDAMAGE] = {cor = COLOR_ELECTRIC},
  18. [ROCKDAMAGE] = {cor = COLOR_ROCK},
  19. [BUGDAMAGE] = {cor = COLOR_BUG},
  20. [FIGHTDAMAGE] = {cor = COLOR_FIGHTING},
  21. [SEISMICTOSSDAMAGE] = {cor = COLOR_FIGHTING},
  22. [DRAGONDAMAGE] = {cor = COLOR_DRAGON},
  23. [POISONDAMAGE] = {cor = COLOR_POISON},
  24. [DARKDAMAGE] = {cor = COLOR_DARK},
  25. [STEELDAMAGE] = {cor = COLOR_STEEL},
  26. }
  27. --alterado v2.5  tabelas agora estao em lib/configuration.lua
  28. local function sendPlayerDmgMsg(cid, text)
  29.     if not isCreature(cid) then return true end
  30.     doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, text)
  31. end
  32.  
  33. local spcevo = {
  34. ["Poliwhirl"] = {"Poliwrath", "Politoed"},
  35. ["Gloom"] = {"Bellossom", "Vileplume"},
  36. ["Tyrogue"] = {"Hitmonchan", "Hitmontop", "Hitmonlee"}}
  37.  
  38. local function doEvolveWild(cid)
  39.     if not isCreature(cid) or getCreatureHealth(cid) <= 0 then return true end
  40.     local name = getCreatureName(cid)
  41.     local evolution = "none"
  42.         if spcevo[name] then
  43.             evolution = spcevo[name][math.random(1, #spcevo[name])]
  44.         elseif poevo[name] then
  45.             evolution = poevo[name].evolution
  46.         end
  47.     local a = getPokemonStatus(name)
  48.         if not a or evolution == "none" then return true end
  49.     local pk = {}
  50.     local players = getSpectators(getThingPos(cid), 7, 7)
  51.     if players then
  52.         for pp = 1, #players do
  53.             local this = players[pp]
  54.             if isCreature(this) and isPlayer(this) and (getCreatureTarget(this) == cid or getDamageMapPercent(this, cid) > 0) then
  55.                 doSendMagicEffect(getThingPos(this), 173)
  56.                 local expstring = cid.."expEx"
  57.                 pk[this] = getItemAttribute(getPlayerSlotItem(this, 8).uid, expstring)
  58.                 doItemSetAttribute(getPlayerSlotItem(this, 8).uid, expstring, 0)
  59.             end
  60.         end
  61.     end
  62.     local level = getPokemonLevel(cid)
  63.     local pos = getThingPos(cid)
  64.     local gender = getCreatureSkull(cid)
  65.     local lifepercentage = 1 - ((getCreatureHealth(cid) * 1.3) / getCreatureMaxHealth(cid))
  66.     local lookdir = getCreatureLookDir(cid)
  67.     local status = {}
  68.         status.offense = getOffense(cid) + a.off * 8
  69.         status.defense = getDefense(cid) + a.def * 8
  70.         status.agi = getSpeed(cid) + a.agi * 8
  71.         status.spatk = getSpecialAttack(cid) + a.spatk * 8
  72.         status.vit = getVitality(cid) + a.vit * 4
  73.     doRemoveCreature(cid)
  74.     local evo = doCreateMonster(evolution, pos)
  75.     setWildPokemonLevel(evo, level, status)
  76.     doCreatureSetLookDir(evo, lookdir)
  77.     doCreatureSetSkullType(evo, gender)
  78.     doCreatureAddHealth(evo, -getCreatureMaxHealth(evo) * lifepercentage)
  79.     doSendMagicEffect(getThingPos(evo), 18)
  80.         for attacker, experience in pairs (pk) do
  81.             doWildAttackPlayer(evo, attacker)
  82.             local expstring = evo.."expEx"
  83.             local exp = experience or 0
  84.             doItemSetAttribute(getPlayerSlotItem(attacker, 8).uid, expstring, exp)
  85.         end
  86.     sendFinishEvolutionEffect(evo, true)
  87.     addEvent(sendFinishEvolutionEffect, 550, evo, true)
  88.     addEvent(sendFinishEvolutionEffect, 1050, evo)
  89. end
  90.  
  91. local races = {
  92. [4] = {cor = COLOR_FIRE2},
  93. [6] = {cor = COLOR_WATER},
  94. [7] = {cor = COLOR_NORMAL},
  95. [8] = {cor = COLOR_FIRE2},
  96. [9] = {cor = COLOR_FIGHTING},
  97. [10] = {cor = COLOR_FLYING},
  98. [11] = {cor = COLOR_GRASS},
  99. [12] = {cor = COLOR_POISON},
  100. [13] = {cor = COLOR_ELECTRIC},
  101. [14] = {cor = COLOR_GROUND},
  102. [15] = {cor = COLOR_PSYCHIC},
  103. [16] = {cor = COLOR_ROCK},
  104. [17] = {cor = COLOR_ICE},
  105. [18] = {cor = COLOR_BUG},
  106. [19] = {cor = COLOR_DRAGON},
  107. [20] = {cor = COLOR_GHOST},
  108. [21] = {cor = COLOR_STEEL},
  109. [22] = {cor = COLOR_DARK},
  110. [1] = {cor = 180},
  111. [2] = {cor = 180},
  112. [3] = {cor = 180},
  113. [5] = {cor = 180},
  114. }
  115.  
  116.    
  117. local damages = {MORTALGASDAMAGE, GROUNDDAMAGE, ELECTRICDAMAGE, ROCKDAMAGE, FLYDAMAGE, BUGDAMAGE, FIGHTINGDAMAGE, DRAGONDAMAGE, POISONDAMAGE, DARKDAMAGE, STEELDAMAGE, NIGHTMAREDAMAGE, GUILLOTINEDAMAGE, SEISMICTOSSDAMAGE}
  118. local fixdmgs = {PSYCHICDAMAGE, COMBAT_PHYSICALDAMAGE, GRASSDAMAGE, FIREDAMAGE, WATERDAMAGE, ICEDAMAGE, NORMALDAMAGE, GHOSTDAMAGE}
  119. local ignored = {NIGHTMAREDAMAGE, GUILLOTINEDAMAGE, MORTALGASDAMAGE, SEISMICTOSSDAMAGE, PSYCHOSHIFTDAMAGE, POISONEDDAMAGE, BURNEDDAMAGE}
  120. local ignoremiss = {NIGHTMAREDAMAGE, MORTALGASDAMAGE, BURNEDDAMAGE, POISONEDDAMAGE}
  121. local ignorecritical = {MORTALGASDAMAGE, BURNEDDAMAGE, POISONEDDAMAGE, NIGHTMAREDAMAGE}
  122. local cannotkill = {MORTALGASDAMAGE, BURNEDDAMAGE, POISONEDDAMAGE, NIGHTMAREDAMAGE}
  123.  
  124. function onStatsChange(cid, attacker, type, combat, value)
  125.  
  126. if combat == FLYSYSTEMDAMAGE then return false end
  127. if isPlayer(cid) and getCreatureOutfit(cid).lookType == 814 then return false end -- TV
  128.  
  129. local damageCombat = combat
  130.     if damageCombat == THUNDERWAVEDAMAGE then
  131.         damageCombat = ELECTRICDAMAGE
  132.     elseif damageCombat == PSYCHOSHIFTDAMAGE then
  133.         damageCombat = PSYCHICDAMAGE
  134.     end
  135.  
  136. if not isCreature(attacker) then  --alterado v2.5 cid == attacker
  137.     if not isInArray(fixdamages, combat) and combats[combat] then
  138.         doSendAnimatedText(getThingPos(cid), value, combats[combat].cor)
  139.     end
  140. return true
  141. end
  142.  
  143. --------------------------------------------------
  144. if combat == SLEEP_POWDERDAMAGE then
  145.     if not isSummon(cid) and not isSummon(attacker) and not isPlayer(attacker) then
  146.     return false
  147.     end
  148.     if isPlayer(cid) and canAttackOther(attacker, cid) == "Cant" then
  149.     return false
  150.     end
  151.     if isNpcSummon(cid) and getCreatureTarget(cid) ~= attacker then
  152.     return false
  153.     end
  154.     if isSummon(cid) and isSummon(attacker) and canAttackOther(cid, attacker) == "Cant" then
  155.        return false        
  156.     end
  157.     if getPlayerStorageValue(cid, 21099) >= 1 then return false end
  158.    
  159. local ret = {}
  160. ret.id = cid
  161. ret.cd = value
  162. ret.check = getPlayerStorageValue(cid, conds["Sleep"])
  163. ret.first = true                                         --alterado v2.5
  164. ret.cond = "Sleep"
  165.  
  166. doCondition2(ret)
  167. return false
  168. end
  169. --------------------------------------------------
  170. if combat == POISON_POWDERDAMAGE then
  171.     if not isSummon(cid) and not isSummon(attacker) and not isPlayer(attacker) then
  172.     return false
  173.     end
  174.     if isNpcSummon(cid) and getCreatureTarget(cid) ~= attacker then
  175.     return false
  176.     end
  177.     if isSummon(cid) and isSummon(attacker) then
  178.         if canAttackOther(cid, attacker) == "Cant" then
  179.         return false
  180.         end
  181.     end
  182.  
  183.     local master = attacker
  184.     if isSummon(attacker) then master = getCreatureMaster(attacker) end
  185.    
  186.     if getPlayerStorageValue(attacker, 21099) >= 1 then return false end
  187.  
  188.     local ret = {}
  189.        ret.id = cid                                                   --alterado v1.5
  190.        ret.cd = value
  191.        ret.check = getPlayerStorageValue(cid, conds["Poison"])
  192.        ret.damage = isSummon(attacker) and getMasterLevel(attacker)+getPokemonBoost(attacker) or getPokemonLevel(attacker)
  193.        ret.cond = "Poison"
  194.        
  195.        doCondition2(ret)
  196.  
  197. return false
  198. end
  199. --------------------------------------------------
  200. --------------------------------------------------
  201. if isPlayer(attacker) then
  202.  
  203.     local valor = value
  204.     if valor > getCreatureHealth(cid) then
  205.         valor = getCreatureHealth(cid)
  206.     end
  207.  
  208.     if combat == COMBAT_PHYSICALDAMAGE then
  209.     return false
  210.     end
  211.  
  212.     if combat == PHYSICALDAMAGE then
  213.     doSendMagicEffect(getThingPos(cid), 3)
  214.     doSendAnimatedText(getThingPos(cid), valor, races[getMonsterInfo(getCreatureName(cid)).race].cor)
  215.     end
  216.  
  217.     if combats[damageCombat] and not isInArray(fixdmgs, damageCombat) then
  218.     doSendAnimatedText(getThingPos(cid), valor, combats[damageCombat].cor)
  219.     end
  220.  
  221.     if #getCreatureSummons(attacker) >= 1 and not isInArray({POISONEDDAMAGE, BURNEDDAMAGE}, combat) then
  222.         doPlayerSendTextMessage(attacker, MESSAGE_STATUS_DEFAULT, "Your "..getPokeName(getCreatureSummons(attacker)[1]).." dealt "..valor.." damage to "..getSomeoneDescription(cid)..".")
  223.     end
  224.  
  225. return true
  226. end
  227. --------------------------------------------------
  228. if isPlayer(cid) and #getCreatureSummons(cid) >= 1 and type == STATSCHANGE_HEALTHLOSS then
  229. return false                                                                          
  230. end
  231. --------------------------------------------------
  232. if isPlayer(cid) and #getCreatureSummons(cid) <= 0 and type == STATSCHANGE_HEALTHLOSS then
  233.  
  234. if isSummon(attacker) or isPlayer(attacker) then
  235.    if canAttackOther(cid, attacker) == "Cant" then return false end
  236. end
  237.  
  238.     local valor = 0
  239.         if combat == COMBAT_PHYSICALDAMAGE then
  240.             valor = getOffense(attacker)
  241.         else
  242.             valor = getSpecialAttack(attacker)
  243.         end
  244.  
  245.     valor = valor * playerDamageReduction
  246.     valor = valor * math.random(83, 117) / 100
  247.  
  248.     if valor >= getCreatureHealth(cid) then
  249.         valor = getCreatureHealth(cid)
  250.     end
  251.  
  252.     valor = math.floor(valor)
  253.  
  254.     if valor >= getCreatureHealth(cid) then
  255.        if getPlayerStorageValue(cid, 6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1 then
  256.           setPlayerStorageValue(cid, 6598754, -1)
  257.           setPlayerStorageValue(cid, 6598755, -1)
  258.           doRemoveCondition(cid, CONDITION_OUTFIT)
  259.        end
  260.        if getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 then
  261.           doRemoveCondition(cid, CONDITION_OUTFIT)
  262.           setPlayerStorageValue(cid, 17000, 0)
  263.           setPlayerStorageValue(cid, 17001, 0)
  264.           setPlayerStorageValue(cid, 63215, -1)
  265.           doChangeSpeed(cid, PlayerSpeed)
  266. local item = getPlayerSlotItem(cid, 8)
  267. local btype = getPokeballType(item.itemid)
  268.       if #getCreatureSummons(cid) <= 0 then
  269.         if isInArray(pokeballs[btype].all, item.itemid) then
  270.             doTransformItem(item.uid, pokeballs[btype].off)
  271.             doItemSetAttribute(item.uid, "hp", 0)
  272.         end
  273.       end
  274.       end
  275.       ------------Edited Golden Arena------------------
  276.       if getPlayerStorageValue(cid, 22545) == 1 then
  277.          if getGlobalStorageValue(22550) == 1 then
  278.             doPlayerSendTextMessage(cid, 20, "You are the last survivor of the golden arena! Take your reward!")
  279.             doPlayerAddItem(cid, 2152, 100)  --premio
  280.             setPlayerStorageValue(cid, 22545, -1)
  281.             doTeleportThing(cid, getClosestFreeTile(cid, getClosestFreeTile(cid, posBackGolden)), false)  --alterado v2.4
  282.             setGlobalStorageValue(22550, -1)
  283.             doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  284.             valor = 0          
  285.          else
  286.              setGlobalStorageValue(22550, getGlobalStorageValue(22550)-1)
  287.              setPlayerStorageValue(cid, 22545, -1)
  288.              doTeleportThing(cid, getClosestFreeTile(cid, posBackGolden), false)    --alterado v2.4
  289.              doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  290.              valor = 0
  291.          end
  292.      end
  293.      -------------------------------------------    
  294.     end
  295.     doCreatureAddHealth(cid, -valor, 3, 180)
  296.     if not isPlayer(cid) then
  297.     addEvent(sendPlayerDmgMsg, 5, cid, "You lost "..valor.." hitpoints due to an attack from "..getSomeoneDescription(attacker)..".")
  298.     end
  299. return false
  300. end
  301. --------------------------------------------------
  302. if type == STATSCHANGE_HEALTHGAIN then
  303.     if cid == attacker then
  304.     return true
  305.     end
  306.     if isSummon(cid) and isSummon(attacker) and canAttackOther(cid, attacker) == "Cant" then
  307.     return false
  308.     end
  309. return true
  310. end
  311. --------------------------------------------------
  312. if isMonster(attacker) and getPlayerStorageValue(attacker, 201) ~= -1 then
  313.     if isPlayer(cid) then
  314.     return false
  315.     end
  316.     if getPlayerStorageValue(getCreatureMaster(cid), ginasios[getPlayerStorageValue(attacker, 201)].storage) ~= 1 then
  317.     return false
  318.     end
  319. end
  320. --------------------------------------------------
  321. if isMonster(cid) and getPlayerStorageValue(cid, 201) ~= -1 then
  322.     if getPlayerStorageValue(getCreatureMaster(attacker), ginasios[getPlayerStorageValue(cid, 201)].storage) ~= 1 then
  323.     return false
  324.     end
  325. end
  326. --------------------------------------------------
  327. if ehMonstro(cid) and ehMonstro(attacker) then
  328. return false                                          --edited monstro nao atacar monstro
  329. end
  330. ---------------------------------------------------
  331.  
  332. local multiplier = 1    
  333. --local miss = 10                     ---(getSpeed(cid) - getSpeed(attacker)) * 0.26
  334.  
  335.    poketype1 = pokes[getCreatureName(cid)].type
  336.    poketype2 = pokes[getCreatureName(cid)].type2
  337.  
  338.     if getCreatureCondition(cid, CONDITION_INVISIBLE) then
  339.     return false
  340.     end
  341.  
  342. if damageCombat ~= COMBAT_PHYSICALDAMAGE and not isInArray(ignored, damageCombat) then
  343.     if isInArray(effectiveness[damageCombat].super, poketype1) then
  344.         multiplier = multiplier + 0.5
  345.     end
  346.     if isInArray(effectiveness[damageCombat].super, poketype2) then
  347.         multiplier = multiplier + 0.5
  348.     end
  349.     if isInArray(effectiveness[damageCombat].weak, poketype1) then
  350.         multiplier = multiplier - 0.25          --alterado v2.3  efetividade q nem na pxg...
  351.     end
  352.     if isInArray(effectiveness[damageCombat].weak, poketype2) then
  353.         multiplier = multiplier - 0.25
  354.     end
  355.     if isInArray(effectiveness[damageCombat].non, poketype1) or isInArray(effectiveness[damageCombat].non, poketype2) then
  356.         if isInArray(specialabilities["foresight"], getCreatureName(attacker)) then   --alterado v2.5
  357.            multiplier = 0.5                
  358.         elseif getPlayerStorageValue(attacker, 999457) >= 1 then     --alterado v2.5 dark eye/miracle eye, ainda vo refazer isso...
  359.            multiplier = 0.5
  360.         end
  361.     end
  362. elseif combat == COMBAT_PHYSICALDAMAGE then
  363.     if isGhostPokemon(cid) then     --alterado v2.3
  364.                            
  365.        if not isInArray(specialabilities["foresight"], getCreatureName(attacker)) then  --alterado v2.5
  366.           doSendMagicEffect(getThingPos(cid), 3)    
  367.           return false
  368.        end
  369.     end
  370.    
  371.         local cd = getPlayerStorageValue(attacker, conds["Miss"])
  372.         local cd2 = getPlayerStorageValue(attacker, conds["Confusion"])      --alterado v2.5
  373.         local cd3 = getPlayerStorageValue(attacker, conds["Stun"])            
  374.         if cd >= 0 or cd2 >= 0 or cd3 >= 0 then
  375.            if math.random(1, 100) > 50 then  --50% chance de da miss no atk fisico
  376.               doSendMagicEffect(getThingPos(cid), 211)
  377.               doSendAnimatedText(getThingPos(attacker), "MISS", 215)
  378.               return false
  379.            end
  380.         end
  381. end
  382. --------------------------------------------------
  383. local valor = value
  384.  
  385.     if multiplier == 1.5 then
  386.         multiplier = 1.75      
  387.     elseif multiplier == 1.25 then    --alterado v2.3 efetividade q nem a pxg
  388.         multiplier = 1    
  389.     end
  390.  
  391. --------------------------------------------------
  392.     if isSummon(cid) and isSummon(attacker) then
  393.         if getCreatureMaster(cid) == getCreatureMaster(attacker) then
  394.            return false
  395.         end
  396.         if canAttackOther(cid, attacker) == "Cant" then
  397.            return false
  398.         end
  399.     end
  400.  
  401.     local randomRange = math.random(83, 117) / 100
  402.     local block = 1
  403.  
  404.     if not isPlayer(cid) then
  405.    
  406.     if combat == COMBAT_PHYSICALDAMAGE then
  407.         block = 1 - (getDefense(cid) / (getOffense(attacker) + getDefense(cid)))
  408.         if getPokemonGender(attacker) == SEX_MALE then
  409.             block = block + 0.2
  410.         end
  411.         if getPokemonGender(cid) == SEX_FEMALE then
  412.             block = block - 0.2
  413.         end
  414.         valor = getOffense(attacker) * block
  415.        
  416.         if isInArray(specialabilities["counter"], getCreatureName(cid)) then
  417.           if math.random(1, 100) <= 10 then
  418.              doCreatureAddHealth(attacker, -valor, 3, 180)    --alterado v2.5
  419.              valor = 0
  420.              doSendAnimatedText(getThingPosWithDebug(cid), "COUNTER", 215)
  421.           end
  422.         end
  423.     else
  424.         block = 1 - (getDefense(cid) / (getSpecialAttack(attacker) + getDefense(cid)))
  425.         valor = valor * block * generalSpecialAttackReduction
  426.             if isSummon(cid) then
  427.                 valor = valor * summonSpecialDamageReduction - getPokemonLevel(cid) / 2
  428.             end  
  429.     end
  430.     end
  431.  
  432.     valor = valor * multiplier
  433.     valor = valor * randomRange
  434.  
  435.     if isSummon(attacker) then
  436.         valor = valor * getHappinessRate(attacker)
  437.     else
  438.         valor = valor * summonReduction
  439.     end
  440.  
  441.     valor = math.floor(valor)
  442.        
  443.     if combat == BURNEDDAMAGE then
  444.         valor = value * getResistance(cid, FIREDAMAGE)
  445.     elseif combat == POISONEDDAMAGE then
  446.         valor = value * getResistance(cid, POISONDAMAGE)
  447.     end
  448.  
  449.     if math.random(1, 100) == 4 and not isInArray(ignorecritical, combat) then
  450.         doSendAnimatedText(getThingPos(attacker), "CRITICAL", 215)
  451.         valor = valor * 2
  452.     end
  453.  
  454.     -------------------------Edited CLAN SYSTEM-----------------------------------
  455.     if isSummon(attacker) and getPlayerStorageValue(getCreatureMaster(attacker), 86228) >= 1 then
  456.        valor = valor*getClanPorcent(getCreatureMaster(attacker), combat, "atk")
  457.     elseif isSummon(cid) and getPlayerStorageValue(getCreatureMaster(cid), 86228) >= 1 then    --alterado v2.3
  458.        valor = valor - (valor*getClanPorcent(getCreatureMaster(cid), combat, "def", pokes[getCreatureName(cid)].type, pokes[getCreatureName(cid)].type2))
  459.     end
  460.     -----------------------------------------------------------------------
  461.    
  462.     ---------------------- Edited Proteção --------------------------------
  463.     if valor <= 10 then
  464.        valor = math.random(15, 25)
  465.     end
  466.     -----------------------------------------------------------------------
  467.     ---------------------- FEAR / ROAR ------------------------------------
  468.     if getPlayerStorageValue(attacker, conds["Fear"]) >= 1 then         --alterado v2.5!!
  469.     return true
  470.     end
  471. ---------------------------------------------------------------------------
  472. if damageCombat ~= COMBAT_PHYSICALDAMAGE and not isInArray(ignored, damageCombat) then
  473.    if isInArray(effectiveness[damageCombat].non, poketype1) or isInArray(effectiveness[damageCombat].non, poketype2) then
  474.       if not isInArray(specialabilities["foresight"], getCreatureName(attacker)) and getPlayerStorageValue(attacker, 999457) <= 0 then
  475.          valor = valor * 0                      --alterado v2.5
  476.       end
  477.    end
  478. end
  479.  
  480. if damageCombat == GROUNDDAMAGE then
  481.    if isInArray(specialabilities["levitate"], getCreatureName(cid)) then
  482.       valor = 0                      --alterado v2.5
  483.    end
  484. end
  485. -----------------------------------------------------------------------------
  486. local p = getThingPos(cid)                     --poke na pos backup
  487. if p.x == 1 and p.y == 1 and p.z == 10 then
  488. return false                                     --alterado v2.2
  489. end
  490.  
  491. if getPlayerStorageValue(cid, 9658783) == 1 then
  492. return false      --alterado v2.4 -- skill camuflage/future sight/acid armor e afins
  493. end
  494. -----------------------------------------------------------------------------
  495.    
  496.     if valor >= getCreatureHealth(cid) then
  497.         if isInArray(cannotKill, combat) and isPlayer(cid) then
  498.             valor = getCreatureHealth(cid) - 1
  499.         else
  500.             valor = getCreatureHealth(cid)
  501.         end
  502.     end
  503.     valor = math.floor(valor)  --alterado v2.5
  504. --------------------------------------------
  505. --------------Passiva Lifesteal Clobat------------
  506. if combat == COMBAT_PHYSICALDAMAGE then
  507.    if getCreatureName(attacker) == "Crobat" then                    --alterado v2.4
  508.       doCreatureAddHealth(attacker, math.floor(valor))
  509.       doSendAnimatedText(getThingPos(attacker), "+ "..math.floor(valor), 30)
  510.    end
  511. end
  512. --------------------------------------------
  513.  
  514.     if isSummon(attacker) and not isSummon(cid) and not isPlayer(cid) then
  515.  
  516.         local expstring = cid.."expEx"
  517.  
  518.         if getItemAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, expstring) == null then
  519.             doItemSetAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, expstring, 0)
  520.         end
  521.  
  522.         local exp = valor / getCreatureMaxHealth(cid)
  523.         local ball = getPlayerSlotItem(getCreatureMaster(attacker), 8).uid
  524.  
  525.         doItemSetAttribute(ball, expstring, getItemAttribute(ball, expstring) + exp)
  526.             if getItemAttribute(ball, expstring) > 1 then
  527.                 doItemSetAttribute(ball, expstring, 1)
  528.             end
  529.     end
  530.  
  531.     if isSummon(attacker) then
  532.         if combat == COMBAT_PHYSICALDAMAGE then
  533.             doTargetCombatHealth(getCreatureMaster(attacker), cid, PHYSICALDAMAGE, -valor, -valor, 255)
  534.         else
  535.             doTargetCombatHealth(getCreatureMaster(attacker), cid, damageCombat, -valor, -valor, 255)
  536.         end
  537.  
  538.             if not isSummon(cid) and not isPlayer(cid) and math.random(1, wildEvolveChance) == math.random(1, wildEvolveChance) then
  539.                 addEvent(doEvolveWild, math.random(1, 2500), cid)
  540.             end
  541.     else
  542.         if combat ~= COMBAT_PHYSICALDAMAGE then
  543.             doCreatureAddHealth(cid, -math.abs(valor), 3, combats[damageCombat].cor)
  544.         else
  545.             doCreatureAddHealth(cid, -math.abs(valor), 3, races[getMonsterInfo(getCreatureName(cid)).race].cor)
  546.         end
  547.  
  548.         if isSummon(cid) then
  549.             addEvent(sendPlayerDmgMsg, 5, getCreatureMaster(cid), "Your "..getCreatureName(cid).." lost "..valor.." hitpoints due to an attack from "..getSomeoneDescription(attacker)..".")
  550.         end
  551.  
  552.     end
  553.  
  554.     if damageCombat == FIREDAMAGE and not isBurning(cid) then
  555.        local ret = {}
  556.        ret.id = cid
  557.        ret.cd = math.random(5, 12)                             --alterado v2.5
  558.        ret.check = getPlayerStorageValue(cid, conds["Burn"])
  559.        ret.damage = isSummon(attacker) and getMasterLevel(attacker)+getPokemonBoost(attacker) or getPokemonLevel(attacker)
  560.        ret.cond = "Burn"
  561.        
  562.        doCondition2(ret)
  563.     elseif damageCombat == POISONDAMAGE and not isPoisoned(cid) then
  564.        local ret = {}
  565.        ret.id = cid
  566.        ret.cd = math.random(6, 15)                              --alterado v2.5
  567.        ret.check = getPlayerStorageValue(cid, conds["Poison"])
  568.        local lvl = isSummon(attacker) and getMasterLevel(attacker) or getPokemonLevel(attacker)
  569.        ret.damage = math.floor((getPokemonLevel(attacker)+lvl)/2)
  570.        ret.cond = "Poison"
  571.        
  572.        doCondition2(ret)
  573.     end
  574. ------------------------------------POTIONS-------------------------------------------
  575. if isSummon(cid) and type == STATSCHANGE_HEALTHLOSS then
  576.    if getPlayerStorageValue(cid, 173) >= 1 then
  577.       if damageCombat ~= BURNEDDAMAGE and damageCombat ~= POISONEDDAMAGE then
  578.          setPlayerStorageValue(cid, 174, 1)
  579.          doSendAnimatedText(getThingPos(cid), "Lost Heal", 144)
  580.       end
  581.    end
  582. end
  583. ----------------------------------------PASSIVAS-----------------------------------------
  584. ------------------------------"Counter Helix" - "Giro Ball"------------------------------  alterado v2.5 \/ formula de dano de quase todas as passivas!!
  585. -- [nome] = {out = outfit girando, efeitos}
  586. local OutFit = {
  587. ["Scyther"] = {out = 496, cima = 128, direita = 129, esquerda = 130, baixo = 131},  --scyther
  588. ["Scizor"] = {out = 918, cima = 236, direita = 232, esquerda = 224, baixo = 233},  --Scizor
  589. ["Shiny Scyther"] = {out = 849, cima = 128, direita = 129, esquerda = 130, baixo = 131}, --Shiny Scyther
  590. ["Hitmontop"] = {out = 1193, cima = 251, direita = 253, esquerda = 254, baixo = 252}, --Hitmontop
  591. ["Shiny Hitmontop"] = {out = 1451, cima = 251, direita = 253, esquerda = 254, baixo = 252}, --Shiny Hitmontop    --alterado v2.4
  592. ["Pineco"] = {out = 1194, cima = 251, direita = 253, esquerda = 254, baixo = 252}, --pineco
  593. ["Forretress"] = {out = 1192, cima = 251, direita = 253, esquerda = 254, baixo = 252}, --Forretress
  594. } --alterado v2.5 tabela agora ta por nomes
  595.  
  596. if OutFit[getCreatureName(cid)] then    --alterado v2.5
  597.    local nome1 = getCreatureName(cid)
  598.    local chance = (nome1 == "Hitmontop" or nome1 == "Shiny Hitmontop") and (16 + getPlayerStorageValue(cid, 465987)) or 15  --alterado v2.4
  599.    if math.random(1, 100) <= chance then    
  600.    
  601.       if getPlayerStorageValue(cid, 32623) == 1 then  --proteçao pra n usar a passiva 2x seguidas...
  602.       return false
  603.       end
  604.      
  605.       local outfitt =  OutFit[nome1] --alterado v2.5
  606.      
  607.       local min = (getSpecialAttack(cid)*25)*0.1
  608.       local max = min + getPokemonLevel(cid)                                    --alterado v2.5
  609.  
  610.       local function damage(cid, min, max)
  611.       if isCreature(cid) then
  612.          if isInArray({"Scyther", "Shiny Scyther"}, nome1) then  --alterado v2.5
  613.             doAreaCombatHealth(cid, BUGDAMAGE, getThingPosWithDebug(cid), scyther5, -min, -max, CONST_ME_NONE)
  614.          elseif isInArray({"Hitmontop", "Shiny Hitmontop"}, nome1) then   --alterado v2.5
  615.             doAreaCombatHealth(cid, FIGHTINGDAMAGE, getThingPosWithDebug(cid), scyther5, -min, -max, CONST_ME_NONE)
  616.          else                                
  617.             doAreaCombatHealth(cid, STEELDAMAGE, getThingPosWithDebug(cid), scyther5, -min, -max, CONST_ME_NONE)
  618.          end
  619.          doAreaCombatHealth(cid, null, getThingPos(cid), scythe1, 0, 0, outfitt.cima) --cima
  620.          doAreaCombatHealth(cid, null, getThingPos(cid), scythe2, 0, 0, outfitt.baixo) --baixo
  621.          doAreaCombatHealth(cid, null, getThingPos(cid), scythe3, 0, 0, outfitt.direita) --direita
  622.          doAreaCombatHealth(cid, null, getThingPos(cid), scythe4, 0, 0, outfitt.esquerda)  --esquerda
  623.       end
  624.       end
  625.  
  626.       setPlayerStorageValue(cid, 32623, 1)        --proteçao
  627.       doSetCreatureOutfit(cid, {lookType = outfitt.out}, -1)
  628.  
  629.  
  630.       local function doChangeO(cid)
  631.       if not isCreature(cid) then return true end
  632.          setPlayerStorageValue(cid, 32623, 0)         --proteçao
  633.          if isSleeping(cid) and getMonsterInfo(getCreatureName(cid)).lookCorpse ~= 0 then
  634.             doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(getCreatureName(cid)).lookCorpse}, -1)
  635.          else
  636.              doRemoveCondition(cid, CONDITION_OUTFIT)
  637.          end
  638.       end
  639.        
  640.     local delay = 200 -- não mexe
  641.     for i = 1, 2 do
  642.         addEvent(damage, delay*i, cid, min, max)
  643.     end
  644.     addEvent(doChangeO, 2 * 300 + 10, cid)
  645. end
  646. end
  647. -------------------------------------------Lava Counter / Electricity-------------------------------------
  648. local Fire_Thunder = {"Magmar", "Shiny Magmar", "Electabuzz", "Shiny Electabuzz", "Magby", "Elekid"}
  649.  
  650. --["Nome"] = {effeito, damage}
  651. local eff = {
  652. ["Magmar"] = {15, FIREDAMAGE, 1461},              --alterado v2.5
  653. ["Magby"] = {15, FIREDAMAGE},
  654. ["Electabuzz"] =  {207, ELECTRICDAMAGE, 1462},
  655. ["Shiny Electabuzz"] =  {207, ELECTRICDAMAGE, 1460},
  656. ["Elekid"] =  {207, ELECTRICDAMAGE},
  657. }
  658.  
  659. if isInArray(Fire_Thunder, getCreatureName(cid)) and math.random(1, 100) <= 15 then
  660.    
  661.       if getPlayerStorageValue(cid, 32623) == 1 then  --proteçao pra n usar a passiva 2x seguidas...
  662.       return false
  663.       end
  664.  
  665.       local min = (getSpecialAttack(cid)*10)*0.1   --alterado v2.5
  666.       local max = min + getPokemonLevel(cid)
  667.      
  668.       local function sendFireEff(cid, dir, eff, damage)
  669.             if not isCreature(cid) then return true end
  670.             doAreaCombatHealth(cid, damage, getPosByDir(getThingPosWithDebug(cid), dir), 0, -min, -max, eff)
  671.       end
  672.  
  673.       local function doSpinFire(cid)
  674.         if not isCreature(cid) then return true end
  675.         local t = {
  676.             [1] = SOUTH,
  677.             [2] = SOUTHEAST,
  678.             [3] = EAST,
  679.             [4] = NORTHEAST,
  680.             [5] = NORTH,
  681.             [6] = NORTHWEST,
  682.             [7] = WEST,
  683.             [8] = SOUTHWEST,
  684.             }                          --alterado v2.5
  685.         for a = 1, 8 do
  686.             addEvent(sendFireEff, a * 140, cid, t[a], eff[getCreatureName(cid)][1], eff[getCreatureName(cid)][2])
  687.         end
  688.         addEvent(setPlayerStorageValue, 8*140, cid, 32623, 0)        --proteçao
  689.       end
  690.  
  691.     local out = eff[getCreatureName(cid)][3]
  692.     if out then                                  --alterado v2.5
  693.        doSetCreatureOutfit(cid, {lookType = out}, 8*140)
  694.     end
  695.     setPlayerStorageValue(cid, 32623, 1)        --proteçao
  696.     doSpinFire(cid)
  697. end
  698. ---------------------------------------------Demon Kicker----------------------------------
  699. --[outfit] = outfit chutando,
  700. local hitmonlees = {
  701. ["Hitmonlee"] =  652,      --hitmonlee                --alterado v2.5, tabela por nome agora
  702. ["Shiny Hitmonlee"] = 878,  --shiny hitmonlee  
  703. }
  704.                                 --alterado v2.5
  705. if isInArray({"Hitmonlee", "Shiny Hitmonlee"}, getCreatureName(cid)) and isCreature(getMasterTarget(cid)) then
  706.    if math.random(1, 100) <= (21 + getPlayerStorageValue(cid, 465987)) then
  707.      
  708.       local nome = getCreatureName(cid)   --alterado v1.5
  709.                                                          
  710.       if getDistanceBetween(getThingPos(cid), getThingPos(getMasterTarget(cid))) > 1 then
  711.       return false
  712.       end
  713.       if getPlayerStorageValue(cid, 32623) == 1 then  --proteçao pra n usar a passiva 2x seguidas...
  714.       return false
  715.       end
  716.      
  717.       local function doChangeHitmon(cid)
  718.       if not isCreature(cid) then return true end
  719.          setPlayerStorageValue(cid, 32623, 0)         --proteçao
  720.          if isSleeping(cid) and getMonsterInfo(getCreatureName(cid)).lookCorpse ~= 0 then
  721.             doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(getCreatureName(cid)).lookCorpse}, -1)
  722.          else
  723.             doRemoveCondition(cid, CONDITION_OUTFIT)
  724.          end
  725.       end
  726.      
  727.          local min = (getOffense(cid)*45)*0.1   --alterado v2.5
  728.          local max = min + getPokemonLevel(cid)  
  729.          
  730.        
  731.          setPlayerStorageValue(cid, 32623, 1)       --proteçao
  732.          
  733.          doSetCreatureOutfit(cid, {lookType = hitmonlees[nome]}, -1)   --alterado v2.5
  734.          doTargetCombatHealth(cid, getMasterTarget(cid), FIGHTINGDAMAGE, -min, -max, 255)
  735.          
  736.          addEvent(doChangeHitmon, 700, cid)    
  737.    end
  738. end
  739. -------------------------------------------Demon Puncher-------------------------------------
  740.                   --alterado v2.5
  741. if isInArray({"Hitmonchan", "Shiny Hitmonchan"}, getCreatureName(cid)) and isCreature(getMasterTarget(cid)) then
  742.    if math.random(1, 100) <= (21 + getPlayerStorageValue(cid, 465987)) then    
  743.                                                        
  744.        if getDistanceBetween(getThingPos(cid), getThingPos(getMasterTarget(cid))) > 1 then
  745.        return false
  746.        end                    
  747.      
  748.          local name = getCreatureName(cid)
  749.          local min = (getOffense(cid)*45)*0.1    --alterado v1.5
  750.          local max = min + getPokemonLevel(cid)
  751.          
  752.          if ehMonstro(cid) then
  753.             hands = 0
  754.          else
  755.             hands = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "hands")
  756.          end
  757.          
  758.          doSendDistanceShoot(getThingPos(cid), getThingPos(getMasterTarget(cid)), 39)
  759.          doTargetCombatHealth(cid, getMasterTarget(cid), hitmonchans[name][hands].type, -min, -max, 255)
  760.          
  761.          local target = getThingPos(getMasterTarget(cid))
  762.          target.x = target.x + 1
  763.          
  764.          if hands == 4 then
  765.              doSendMagicEffect(target, hitmonchans[name][hands].eff)
  766.          else
  767.              doSendMagicEffect(getThingPos(getMasterTarget(cid)), hitmonchans[getCreatureName(cid)][hands].eff)
  768.          end
  769.    end
  770. end
  771. ---------------------------------------Stunning Confusion------------------------------------------
  772. local ducks = {"Golduck", "Psyduck"} --alterado v1.5
  773.  
  774. if isInArray(ducks, getCreatureName(cid)) and math.random(1, 100) <= 20 then  
  775.      
  776.       if getPlayerStorageValue(cid, 32623) == 1 then  --proteçao pra n usar a spell 2x seguidas...
  777.       return false
  778.       end
  779.      
  780.       local min = (getSpecialAttack(cid)*10)*0.1   --alterado v2.5
  781.       local max = min + getPokemonLevel(cid)
  782.      
  783.       local function damage(cid)
  784.       if isCreature(cid) then
  785.          doAreaCombatHealth(cid, PSYCHICDAMAGE, getThingPosWithDebug(cid), bombWee3, -min, -max, 136)
  786.       end
  787.       end
  788.          
  789.       setPlayerStorageValue(cid, 32623, 1)        --proteçao
  790.       for i = 1, 7 do
  791.           addEvent(damage, i*500, cid)
  792.       end
  793.       addEvent(setPlayerStorageValue, 3500, cid, 32623, 0)        --proteçao
  794. end
  795. -----------------------------------------Groundshock-----------------------------------
  796.                                     --alterado v2.5
  797. if getCreatureName(cid) == "Kangaskhan" and math.random(1, 100) <= 20 then
  798.      
  799.       local min = (getSpecialAttack(cid)*40)*0.1 --alterado v2.5
  800.       local max = min + getPokemonLevel(cid)
  801.      
  802.       doAreaCombatHealth(cid, NORMALDAMAGE, getThingPos(cid), scyther5, -min, -max, 255)
  803.  
  804.       local sps = getThingPos(cid)
  805.       sps.x = sps.x+1
  806.       sps.y = sps.y+1
  807.       doSendMagicEffect(sps, 127)
  808. end
  809. --------------------------------------Electric Charge---------------------------------------------------
  810. local charge = {"Pikachu", "Raichu", "Shiny Raichu"}    --alterado v2.5
  811.  
  812. if isInArray(charge, getCreatureName(cid)) and math.random(1, 100) <= 15 then
  813.    if getPlayerStorageValue(cid, 253) >= 1 then
  814.    return true
  815.    end
  816.    setPlayerStorageValue(cid, 253, 1)
  817.    doSendMagicEffect(getThingPos(cid), 207)
  818.    doSendAnimatedText(getThingPos(cid), "FOCUS", 144)
  819. end
  820. -------------------------------------Melody------------------------------------
  821. if getCreatureName(cid) == "Wigglytuff" and math.random(1, 100) <= 10 then     --alterado v1.5
  822.    doAreaCombatHealth(cid, SLEEP_POWDERDAMAGE, getThingPos(cid), powders, -6, -10, 33)
  823. end
  824. ------------------------------------- Dragon Fury / Fury ---------------------------------------
  825. local DracoFury = {"Persian", "Gyarados", "Shiny Gyarados", "Dratini", "Shiny Dratini", "Dragonair", "Shiny Dragonair", "Dragonite", "Shiny Dragonite"}
  826.                                                                                                --alterado v2.5
  827. if isInArray(DracoFury, getCreatureName(cid)) and math.random(1, 100) <= 10 then
  828.    if getPlayerStorageValue(cid, 32623) == 1 then
  829.    return false
  830.    end
  831.  
  832.    setPlayerStorageValue(cid, 32623, 1)
  833.  
  834.    if getCreatureName(cid) == "Persian" then
  835.       doRaiseStatus(cid, 2, 0, 0, 10)
  836.    else                                               --alterado v2.5
  837.       doRaiseStatus(cid, 2, 2, 0, 10)
  838.    end
  839.            
  840.    for t = 1, 7 do   --alterado v2.5
  841.        addEvent(sendMoveEffect, t*1500, cid, 12)
  842.    end
  843.    addEvent(setPlayerStorageValue, 10000, cid, 32623, 0)--alterado v2.5
  844. end
  845. ------------------------------------- Mega Drain ---------------------------------------
  846. local mega = {"Oddish", "Gloom", "Vileplume", "Kabuto", "Kabutops", "Parasect", "Tangela", "Shiny Vileplume", "Shiny Tangela"}
  847.                                                                                     --alterado v2.5      
  848. if isInArray(mega, getCreatureName(cid)) and math.random(1, 100) <= 10 then
  849.  
  850. local min = (getSpecialAttack(cid)*20)*0.1  --alterado v2.5
  851. local max = min + getPokemonLevel(cid)
  852.          
  853.    local uid = checkAreaUid(getThingPos(cid), check, 1, 1)
  854.    for _,pid in pairs(uid) do
  855.        if isCreature(cid) and isCreature(pid) and pid ~= cid then
  856.           if isPlayer(pid) and #getCreatureSummons(pid) >= 1 then return false end
  857.        
  858.           local life = getCreatureHealth(pid)
  859.  
  860.           doAreaCombatHealth(cid, GRASSDAMAGE, getThingPos(pid), 0, -min, -max, 14)
  861.  
  862.           local newlife = life - getCreatureHealth(pid)
  863.  
  864.           doSendMagicEffect(getThingPos(cid), 14)
  865.           if newlife >= 1 then
  866.              doCreatureAddHealth(cid, newlife)
  867.              doSendAnimatedText(getThingPos(cid), "+"..newlife.."", 32)
  868.           end  
  869.        end
  870.    end
  871. end
  872. ------------------------------------- Spores Reaction ---------------------------------------
  873. local spores = {"Oddish", "Gloom", "Vileplume", "Shiny Vileplume"}   --alterado v2.5
  874.  
  875. if isInArray(spores, getCreatureName(cid)) and math.random(1, 100) <= 10 then
  876.    local random = math.random(1, 3)
  877.  
  878.    if random == 1 then
  879.       doAreaCombatHealth(cid, SLEEP_POWDERDAMAGE, getThingPos(cid), powders, -2, -3, 27)
  880.    elseif random == 2 then
  881.       local ret = {}
  882.       ret.id = 0
  883.       ret.cd = 9
  884.       ret.eff = 0
  885.       ret.check = 0               --alterado v2.5
  886.       ret.spell = "none"
  887.       ret.cond = "Stun"
  888.    
  889.       doMoveInArea2(cid, 85, confusion, GRASSDAMAGE, 0, 0, spell, ret)    
  890.    else
  891.       doAreaCombatHealth(cid, POISON_POWDERDAMAGE, getThingPos(cid), powders, 6, 12, 84)
  892.    end
  893. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top