SHARE
TWEET

Untitled

a guest Jun 24th, 2019 69 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. [FIREDAMAGE] = {cor = COLOR_FIRE2},                        
  6. [BURNEDDAMAGE] = {cor = COLOR_BURN},
  7. [WATERDAMAGE] = {cor = COLOR_WATER},
  8. [ICEDAMAGE] = {cor = COLOR_ICE},
  9. [NORMALDAMAGE] = {cor = COLOR_NORMAL},
  10. [FLYDAMAGE] = {cor = COLOR_FLYING},          
  11. [GHOSTDAMAGE] = {cor = COLOR_GHOST},
  12. [GROUNDDAMAGE] = {cor = COLOR_GROUND},
  13. [ELECTRICDAMAGE] = {cor = COLOR_ELECTRIC},
  14. [ROCKDAMAGE] = {cor = COLOR_ROCK},
  15. [BUGDAMAGE] = {cor = COLOR_BUG},
  16. [FIGHTDAMAGE] = {cor = COLOR_FIGHTING},
  17. [DRAGONDAMAGE] = {cor = COLOR_DRAGON},
  18. [POISONDAMAGE] = {cor = COLOR_POISON},
  19. [DARKDAMAGE] = {cor = COLOR_DARK},              
  20. [STEELDAMAGE] = {cor = COLOR_STEEL},
  21. [MIRACLEDAMAGE] = {cor = COLOR_PSYCHIC},  
  22. [DARK_EYEDAMAGE] = {cor = COLOR_GHOST},
  23. [SEED_BOMBDAMAGE] = {cor = COLOR_GRASS},
  24. [SACREDDAMAGE] = {cor = COLOR_FIRE2},
  25. [MUDBOMBDAMAGE] = {cor = COLOR_GROUND}, --alterado v1.9
  26. }
  27.  
  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 races = {
  34. [4] = {cor = COLOR_FIRE2},
  35. [6] = {cor = COLOR_WATER},
  36. [7] = {cor = COLOR_NORMAL},
  37. [8] = {cor = COLOR_FIRE2},
  38. [9] = {cor = COLOR_FIGHTING},
  39. [10] = {cor = COLOR_FLYING},
  40. [11] = {cor = COLOR_GRASS},
  41. [12] = {cor = COLOR_POISON},
  42. [13] = {cor = COLOR_ELECTRIC},
  43. [14] = {cor = COLOR_GROUND},
  44. [15] = {cor = COLOR_PSYCHIC},
  45. [16] = {cor = COLOR_ROCK},
  46. [17] = {cor = COLOR_ICE},
  47. [18] = {cor = COLOR_BUG},
  48. [19] = {cor = COLOR_DRAGON},
  49. [20] = {cor = COLOR_GHOST},
  50. [21] = {cor = COLOR_STEEL},
  51. [22] = {cor = COLOR_DARK},
  52. [1] = {cor = 180},
  53. [2] = {cor = 180},
  54. [3] = {cor = 180},
  55. [5] = {cor = 180},
  56. }
  57.  
  58. local damages = {GROUNDDAMAGE, ELECTRICDAMAGE, ROCKDAMAGE, FLYDAMAGE, BUGDAMAGE, FIGHTINGDAMAGE, DRAGONDAMAGE, POISONDAMAGE, DARKDAMAGE, STEELDAMAGE}
  59. local fixdmgs = {PSYCHICDAMAGE, COMBAT_PHYSICALDAMAGE, GRASSDAMAGE, FIREDAMAGE, WATERDAMAGE, ICEDAMAGE, NORMALDAMAGE, GHOSTDAMAGE}
  60. local ignored = {POISONEDDAMAGE, BURNEDDAMAGE}                
  61. local cannotkill = {BURNEDDAMAGE, POISONEDDAMAGE}
  62.  
  63. function onStatsChange(cid, attacker, type, item, combat, value)
  64.  
  65. if combat == FLYSYSTEMDAMAGE then
  66.     return false
  67. end
  68. if isPlayer(cid) and getCreatureOutfit(cid).lookType == 814
  69.     then
  70.         return false
  71.     end -- TV
  72.  
  73. if not isCreature(attacker) then  
  74.     if not isInArray(fixdamages, combat) and combats[combat] then
  75.         doSendAnimatedText(getThingPos(cid), value, combats[combat].cor)
  76.     end
  77. return true
  78. end
  79.  
  80. local damageCombat = combat
  81. --------------------------------------------------
  82. if type == STATSCHANGE_HEALTHGAIN then
  83.     if cid == attacker then
  84.     return true
  85.     end
  86.     if isSummon(cid) and isSummon(attacker) and canAttackOther(cid, attacker) == "Cant" then
  87.     return false
  88.     end
  89. return true
  90. end
  91. --------------------------------------------------
  92. if isMonster(cid) then
  93. local valor = value
  94.    if not pokes[getCreatureName(cid)] and damageCombat == COMBAT_PHYSICALDAMAGE then
  95.       valor = getOffense(attacker) * playerDamageReduction
  96.       doCreatureAddHealth(cid, -math.abs(valor), 3, races[7].cor)                      
  97.       return false
  98.    elseif not pokes[getCreatureName(cid)] and damageCombat ~= COMBAT_PHYSICALDAMAGE then
  99.       doCreatureAddHealth(cid, -math.abs(valor), 3, combats[damageCombat].cor)
  100.       return false
  101.    end
  102. end
  103. --------------------------------------------------
  104. if isPlayer(attacker) then
  105.  
  106.     local valor = value
  107.     if valor > getCreatureHealth(cid) then
  108.         valor = getCreatureHealth(cid)
  109.     end
  110.  
  111.     if combat == COMBAT_PHYSICALDAMAGE then
  112.     return false
  113.     end
  114.  
  115.     if combat == PHYSICALDAMAGE then
  116.            if isSummon(cid) and isPlayer(getCreatureMaster(cid))then
  117.        local TierEle = {
  118. [78] = {chance = Elemen1},
  119. [79] = {chance = Elemen2},
  120. [80] = {chance = Elemen3},
  121. [81] = {chance = Elemen4},
  122. [82] = {chance = Elemen5},
  123. [83] = {chance = Elemen6},
  124. [84] = {chance = Elemen7},
  125. }
  126. local Tier = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "heldx")
  127. if Tier and Tier > 77 and Tier < 85 and getPlayerStorageValue(cid, 22666) ~= 5 then
  128. if math.random(1,100) <= TierEle[Tier].chance then
  129. docastspell(cid, "Elemental", -1000, -5000)
  130. setPlayerStorageValue(cid, 22666, 5)
  131. addEvent(function() setPlayerStorageValue(cid, 22666, 0) end, 1 * 1800)
  132. end
  133. end  
  134. end
  135.     if isSummon(cid) and isPlayer(getCreatureMaster(cid)) and getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "heldy") and getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "heldy") == 22 then
  136. return true
  137. else  
  138.    doSendMagicEffect(getThingPos(cid), 3)  
  139. end    
  140.     doSendAnimatedText(getThingPos(cid), valor, races[getMonsterInfo(getCreatureName(cid)).race].cor)
  141.     end
  142.  
  143.     if combats[damageCombat] and not isInArray(fixdmgs, damageCombat) then
  144.     doSendAnimatedText(getThingPos(cid), valor, combats[damageCombat].cor)
  145.     end
  146.  
  147.     if #getCreatureSummons(attacker) >= 1 and not isInArray({POISONEDDAMAGE, BURNEDDAMAGE}, combat) then
  148.         doPlayerSendTextMessage(attacker, MESSAGE_STATUS_DEFAULT, "Your "..getPokeName(getCreatureSummons(attacker)[1]).." dealt "..valor.." damage to "..getSomeoneDescription(cid)..".")
  149.     end
  150.  
  151. return true
  152. end
  153. --------------------------------------------------
  154. if isPlayer(cid) and #getCreatureSummons(cid) >= 1 and type == STATSCHANGE_HEALTHLOSS then
  155. return false                                                                          
  156. end
  157. --------------------------------------------------
  158. if isPlayer(cid) and #getCreatureSummons(cid) <= 0 and type == STATSCHANGE_HEALTHLOSS then
  159.  
  160. if isSummon(attacker) or isPlayer(attacker) then
  161.    if canAttackOther(cid, attacker) == "Cant" then return false end
  162. end
  163.  
  164.     local valor = 0
  165.         if combat == COMBAT_PHYSICALDAMAGE then
  166.             valor = getOffense(attacker)
  167.         else
  168.             valor = getSpecialAttack(attacker)
  169.         end
  170.  
  171.     valor = valor * playerDamageReduction
  172.     valor = valor * math.random(83, 117) / 100
  173.  
  174.     if valor >= getCreatureHealth(cid) then
  175.         valor = getCreatureHealth(cid)
  176.     end
  177.  
  178.     valor = math.floor(valor)
  179.  
  180.     if valor >= getCreatureHealth(cid) then
  181.        if getPlayerStorageValue(cid, 6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1 then
  182.           setPlayerStorageValue(cid, 6598754, -1)
  183.           setPlayerStorageValue(cid, 6598755, -1)
  184.           doRemoveCondition(cid, CONDITION_OUTFIT)            
  185.           doTeleportThing(cid, posBackPVP, false)
  186.           doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  187.           return false --alterado v1.8
  188.        end
  189.        
  190.        if getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 then
  191.           doRemoveCondition(cid, CONDITION_OUTFIT)
  192.           setPlayerStorageValue(cid, 17000, 0)
  193.           setPlayerStorageValue(cid, 17001, 0)
  194.           setPlayerStorageValue(cid, 63215, -1)
  195.           doChangeSpeed(cid, PlayerSpeed)
  196.           local item = getPlayerSlotItem(cid, 8)
  197.           local btype = getPokeballType(item.itemid)
  198.           if #getCreatureSummons(cid) <= 0 then
  199.              if isInArray(pokeballs[btype].all, item.itemid) then
  200.                 doTransformItem(item.uid, pokeballs[btype].off)
  201.                 doItemSetAttribute(item.uid, "hp", 0)
  202.              end
  203.           end
  204.        end
  205.  
  206.        if getPlayerStorageValue(cid, 22545) == 1 then
  207.           if getGlobalStorageValue(22550) == 1 then
  208.              doPlayerSendTextMessage(cid, 20, "You are the last survivor of the golden arena! Take your reward!")
  209.              doPlayerAddItem(cid, 2152, getPlayerStorageValue(cid, 22551)*2)  
  210.              setPlayerStorageValue(cid, 22545, -1)
  211.              doTeleportThing(cid, getClosestFreeTile(cid, getClosestFreeTile(cid, posBackGolden)), false)  
  212.              doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid))
  213.              setPlayerRecordWaves(cid)    
  214.              endGoldenArena()
  215.              return false --alterado v1.8          
  216.           else
  217.              setGlobalStorageValue(22550, getGlobalStorageValue(22550)-1)
  218.              setPlayerStorageValue(cid, 22545, -1)
  219.              doTeleportThing(cid, getClosestFreeTile(cid, posBackGolden), false)    
  220.              doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid))
  221.              setPlayerRecordWaves(cid)    
  222.              return true
  223.           end
  224.        end
  225.  
  226.        if getPlayerStorageValue(cid, 98796) >= 1 then
  227.           setPlayerStorageValue(cid, 98796, -1)
  228.           setPlayerStorageValue(cid, 98797, -1)                      --alterado v1.8
  229.           doTeleportThing(cid, SafariOut, false)
  230.           doSendMagicEffect(getThingPos(cid), 21)
  231.           doPlayerSendTextMessage(cid, 27, "You die in the saffari... Best luck in the next time!")
  232.           return false --alterado v1.8
  233.        end
  234.  
  235.        local corpse = doCreateItem(3058, 1, getThingPos(cid))
  236.        doDecayItem(corpse)
  237.        doItemSetAttribute(corpse, "pName", getCreatureName(cid))          --alterado v1.7 coloca corpse quando o player morre!
  238.        doItemSetAttribute(corpse, "attacker", getCreatureName(attacker))
  239.        doItemSetAttribute(corpse, "article", getPlayerSex(cid) == 0 and "She" or "He")
  240.        
  241.        if getPlayerStorageValue(cid, Agatha.stoIni) >= 1 and getPlayerStorageValue(cid, Agatha.stoIni) <= 10 then
  242.           setPlayerStorageValue(cid, Agatha.stoIni, -1)
  243.           setPlayerStorageValue(cid, Agatha.stoRec, -1)
  244.           setPlayerStorageValue(cid, Agatha.stoPer, -1)
  245.           setPlayerStorageValue(cid, Agatha.stoEni, -1)        --alterado v1.9  agatha quest
  246.           setPlayerStorageValue(cid, Agatha.stoRes, -1)
  247.        end
  248.     end
  249.     doCreatureAddHealth(cid, -valor, 3, 180)
  250.     if not isPlayer(cid) then
  251.        addEvent(sendPlayerDmgMsg, 5, cid, "You lost "..valor.." hitpoints due to an attack from "..getSomeoneDescription(attacker)..".")
  252.     end
  253. return false
  254. end
  255. --------------------------------------------------
  256. if isMonster(attacker) and getPlayerStorageValue(attacker, 201) ~= -1 then
  257.     if isPlayer(cid) then
  258.     return false
  259.     end
  260.     if getPlayerStorageValue(getCreatureMaster(cid), ginasios[getPlayerStorageValue(attacker, 201)].storage) ~= 1 then
  261.     return false
  262.     end
  263. end
  264. --------------------------------------------------
  265. if isMonster(cid) and getPlayerStorageValue(cid, 201) ~= -1 then
  266.     if getPlayerStorageValue(getCreatureMaster(attacker), ginasios[getPlayerStorageValue(cid, 201)].storage) ~= 1 then
  267.     return false
  268.     end
  269. end
  270. --------------------------------------------------
  271. if ehMonstro(cid) and ehMonstro(attacker) and not isSummon(cid) and not isSummon(attacker) then
  272. return false                                          --alterado v1.9 /\
  273. end
  274. --------------------------------------------------
  275. --------------------REFLECT-----------------------
  276. if getPlayerStorageValue(cid, 21099) >= 1 and combat ~= COMBAT_PHYSICALDAMAGE then
  277.    if not isInArray({"Team Claw", "Team Slice"}, getPlayerStorageValue(attacker, 21102)) then
  278.       doSendMagicEffect(getThingPosWithDebug(cid), 135)
  279.       doSendAnimatedText(getThingPosWithDebug(cid), "REFLECT", COLOR_GRASS)
  280.       addEvent(docastspell, 100, cid, getPlayerStorageValue(attacker, 21102))
  281.       if getCreatureName(cid) == "Wobbuffet" then
  282.          doRemoveCondition(cid, CONDITION_OUTFIT)    
  283.       end
  284.       setPlayerStorageValue(cid, 21099, -1)                    
  285.       setPlayerStorageValue(cid, 21100, 1)
  286.       setPlayerStorageValue(cid, 21101, attacker)
  287.       setPlayerStorageValue(cid, 21103, getTableMove(attacker, getPlayerStorageValue(attacker, 21102)).f)
  288.       setPlayerStorageValue(cid, 21104, getCreatureOutfit(attacker).lookType)
  289.       return false
  290.    end
  291. end
  292. -------------------------------------------------
  293.  
  294. local multiplier = 1
  295.  
  296.    if isCreature(cid) then
  297.       poketype1 = pokes[getCreatureName(cid)].type        
  298.       poketype2 = pokes[getCreatureName(cid)].type2
  299.    end
  300.    if not poketype1 or not poketype2 then return false end  
  301.    
  302.     if getCreatureCondition(cid, CONDITION_INVISIBLE) then
  303.     return false
  304.     end
  305. if damageCombat ~= COMBAT_PHYSICALDAMAGE and not isInArray(ignored, damageCombat) then
  306.     if isInArray(effectiveness[damageCombat].super, poketype1) then
  307.         multiplier = multiplier + 0.5
  308.     end
  309.     if isInArray(effectiveness[damageCombat].super, poketype2) then
  310.         multiplier = multiplier + 0.5
  311.     end
  312.     if isInArray(effectiveness[damageCombat].weak, poketype1) then    
  313.         multiplier = multiplier - 0.25
  314.     end
  315.     if isInArray(effectiveness[damageCombat].weak, poketype2) then
  316.         multiplier = multiplier - 0.25
  317.     end
  318.     if isInArray(effectiveness[damageCombat].non, poketype1) or isInArray(effectiveness[damageCombat].non, poketype2) then
  319.       if isInArray(specialabilities["foresight"], getCreatureName(attacker)) then  
  320.          multiplier = 0.5                
  321.       end                         --alterado v1.6
  322.     end
  323.     -- X-Attack --
  324.     if isSummon(attacker) and isPlayer(getCreatureMaster(attacker)) then
  325.     local TierArray = {8, 9, 10, 11, 12, 13, 14}
  326.     local Tiers = {
  327. [8] = {bonus = AtkBonus1},
  328. [9] = {bonus = AtkBonus2},
  329. [10] = {bonus = AtkBonus3},
  330. [11] = {bonus = AtkBonus4},
  331. [12] = {bonus = AtkBonus5},
  332. [13] = {bonus = AtkBonus6},
  333. [14] = {bonus = AtkBonus7},
  334. }
  335.  local ball = getPlayerSlotItem(getCreatureMaster(attacker), 8)
  336. local Tier = getItemAttribute(ball.uid, "heldx")
  337.     local bonusatk = {}
  338.     if isInArray(TierArray, getItemAttribute(ball.uid, "heldx")) then
  339.     bonusatk = Tiers[Tier].bonus
  340.     else
  341.     bonusatk = 1
  342.     end
  343.         multiplier = multiplier * bonusatk
  344.     end
  345.     -- X-Attack --
  346. elseif combat == COMBAT_PHYSICALDAMAGE then
  347.     if isGhostPokemon(cid) then              
  348.        if not isInArray(specialabilities["foresight"], getCreatureName(attacker)) then  --passiva Foresight!!
  349.           doSendMagicEffect(getThingPos(cid), 3)    
  350.           return false
  351.        end
  352.     end
  353.         local cd = getPlayerStorageValue(attacker, conds["Miss"])
  354.         local cd2 = getPlayerStorageValue(attacker, conds["Confusion"])
  355.         local cd3 = getPlayerStorageValue(attacker, conds["Stun"])
  356.         if cd >= 0 or cd2 >= 0 or cd3 >= 0 then
  357.            if math.random(1, 100) > 50 then  
  358.               doSendMagicEffect(getThingPos(cid), 211)
  359.               doSendAnimatedText(getThingPos(attacker), "MISS", 215)        
  360.               return false
  361.            end
  362.         end
  363. end
  364. --------------------------------------------------
  365. local valor = value
  366.  
  367.     if multiplier == 1.5 and poketype2 == "no type" then
  368.         multiplier = 2                                        
  369.     elseif multiplier == 1.5 and poketype2 ~= "no type" then   
  370.         multiplier = 1.75      
  371.     elseif multiplier == 1.25 then    
  372.         multiplier = 1    
  373.     end
  374.  
  375. --------------------------------------------------
  376.     if isSummon(cid) and isSummon(attacker) then
  377.         if getCreatureMaster(cid) == getCreatureMaster(attacker) then
  378.            return false
  379.         end
  380.         if canAttackOther(cid, attacker) == "Cant" then
  381.            return false
  382.         end
  383.     end
  384.  
  385.     valor = valor * multiplier
  386.  
  387.     if isSummon(attacker) then
  388.         valor = valor * getHappinessRate(attacker)
  389.     else
  390.         valor = valor * summonReduction
  391.     end
  392.                                                              
  393.     valor = math.floor(valor)                                
  394.    
  395.     if combat == COMBAT_PHYSICALDAMAGE then
  396.        
  397.        local value = getOffense(attacker) > 1000 and 3 or 2
  398.        block = 1 - (getDefense(cid) / (getOffense(attacker) + getDefense(cid))) --alterado v1.9 testem essa nova formula plzzz '--'
  399.         valor = (getOffense(attacker)/value) * block
  400.        
  401.         if valor <= 0 then
  402.           valor = math.random(5, 10) --alterado v1.9
  403.        end
  404.        
  405.        if isInArray(specialabilities["counter"], getCreatureName(cid)) then
  406.           if math.random(1, 100) <= 10 then
  407.              doCreatureAddHealth(attacker, -valor, 3, 180)    
  408.              valor = 0
  409.              doSendAnimatedText(getThingPosWithDebug(cid), "COUNTER", 215)
  410.           end
  411.        end  
  412. -- Return --        
  413. if isSummon(cid) and isPlayer(getCreatureMaster(cid)) then
  414. local returnbonus = {}
  415. local ball = getPlayerSlotItem(getCreatureMaster(cid), 8)
  416. local Tiers = {
  417. [15] = {bonus = DmgReturn1},
  418. [16] = {bonus = DmgReturn2},
  419. [17] = {bonus = DmgReturn3},
  420. [18] = {bonus = DmgReturn4},
  421. [19] = {bonus = DmgReturn5},
  422. [20] = {bonus = DmgReturn6},
  423. [21] = {bonus = DmgReturn7},
  424. }
  425. local Tier = getItemAttribute(ball.uid, "heldx")
  426. if Tier and Tier > 14 and Tier < 22 then
  427. returnbonus = math.floor((valor * Tiers[Tier].bonus))
  428. elseif not isInArray(Tiers, Tier) then
  429. returnbonus = 0
  430. end
  431. doCreatureAddHealth(attacker, -returnbonus)
  432. end
  433. -- Return --
  434. else
  435. -- Return --        
  436. if isSummon(cid) and isPlayer(getCreatureMaster(cid)) then
  437. local returnbonus = {}
  438. local ball = getPlayerSlotItem(getCreatureMaster(cid), 8)
  439. local Tiers = {
  440. [15] = {bonus = DmgReturn1},
  441. [16] = {bonus = DmgReturn2},
  442. [17] = {bonus = DmgReturn3},
  443. [18] = {bonus = DmgReturn4},
  444. [19] = {bonus = DmgReturn5},
  445. [20] = {bonus = DmgReturn6},
  446. [21] = {bonus = DmgReturn7},
  447. }
  448. local Tier = getItemAttribute(ball.uid, "heldx")
  449. if Tier and Tier > 14 and Tier < 22 then
  450. returnbonus = math.floor((valor * Tiers[Tier].bonus))
  451. elseif not isInArray(Tiers, Tier) then
  452. returnbonus = 0
  453. end
  454. doCreatureAddHealth(attacker, -returnbonus)
  455. end
  456.  
  457. -- Critical --
  458. if isSummon (attack) and isPlayer(getCreatureMasterAttack) then
  459. local Tiers = {
  460. [85] = {chance = Critical1},
  461. [86] = {chance = Critical2},
  462. [87] = {chance = Critical3},
  463. [88] = {chance = Critical4},
  464. [89] = {chance = Critical5},
  465. [90] = {chance = Critical6},
  466. [91] = {chance = Critical7}
  467. }
  468. local ball = getPlayerSlotItem(getCreatureMasterAttack, 8)
  469. local Tier = getItemAttribute(ball.uid, "heldx")
  470. if Tier and Tier > 84 and Tier < 92 then
  471. if math.random(1,100) <= Tiers[Tier].chance then
  472. valor = valor * 2
  473. doSendAnimatedText(getThingPos(cid), "STK "..(valor * 0.25), 115)
  474. end
  475. end
  476. end
  477. -- Critical --
  478. -- Critical --
  479. -- Return --
  480. valor = valor / getDefense(cid)
  481. end
  482.    
  483.     -------------------------Edited CLAN SYSTEM-----------------------------------
  484.     if isSummon(attacker) and getPlayerStorageValue(getCreatureMaster(attacker), 86228) >= 1 then
  485.        valor = valor*getClanPorcent(getCreatureMaster(attacker), combat, "atk")                          
  486.     elseif isSummon(cid) and getPlayerStorageValue(getCreatureMaster(cid), 86228) >= 1 then
  487.        valor = valor - (valor*getClanPorcent(getCreatureMaster(cid), combat, "def", pokes[getCreatureName(cid)].type, pokes[getCreatureName(cid)].type2))
  488.     end
  489.     -----------------------------------------------------------------------
  490.     ---------------------- FEAR / ROAR ------------------------------------
  491.     if getPlayerStorageValue(attacker, conds["Fear"]) >= 1 then        
  492.     return true
  493.     end
  494. --------------------------------------------------------------------------
  495. if damageCombat ~= COMBAT_PHYSICALDAMAGE and not isInArray(ignored, damageCombat) then
  496.    if isInArray(effectiveness[damageCombat].non, poketype1) or isInArray(effectiveness[damageCombat].non, poketype2) then
  497.       if not isInArray(specialabilities["foresight"], getCreatureName(attacker)) then    
  498.          valor = valor * 0                      
  499.       end
  500.    end
  501. end
  502.  
  503. if damageCombat == GROUNDDAMAGE then
  504.    if isInArray(specialabilities["levitate"], getCreatureName(cid)) then
  505.       valor = 0                      
  506.    end
  507. end
  508. -----------------------------------------------------------------------------
  509. local p = getThingPos(cid)                    
  510. if p.x == 1 and p.y == 1 and p.z == 10 then
  511. return false                                    
  512. end
  513.  
  514. if getPlayerStorageValue(cid, 9658783) == 1 then
  515. return false     --imune
  516. end
  517. -----------------------------------------------------------------------------
  518.  
  519. --------------- FIGHT MODE -----------------------
  520. if useOTClient then
  521. if isSummon(cid) then                                  
  522.    local master = getCreatureMaster(cid)
  523.    if getPlayerStorageValue(master, 248759) == 1 then
  524.       valor = valor * 1.1
  525.    elseif getPlayerStorageValue(master, 248759) == 3 then
  526.       valor = valor * 0.9
  527.    end
  528. end
  529. if isSummon(attacker) then
  530.    local master = getCreatureMaster(attacker)
  531.    if getPlayerStorageValue(master, 248759) == 1 then
  532.       valor = valor * 1.1
  533.    elseif getPlayerStorageValue(master, 248759) == 3 then
  534.       valor = valor * 0.9
  535.    end
  536. end
  537. end  
  538. -----------------------------------------------------------------------------
  539.     if valor >= getCreatureHealth(cid) then
  540.         if isInArray(cannotKill, combat) and isPlayer(cid) then
  541.             valor = getCreatureHealth(cid) - 1
  542.         else
  543.             valor = getCreatureHealth(cid)
  544.         end
  545.     end
  546.     valor = math.floor(valor)            
  547.    
  548. ------------------ SKILLs Q CURAM O ATTACKER ---------------------------------
  549. local function doHeal(cid, amount)
  550. if (getCreatureHealth(cid) + amount) >= getCreatureMaxHealth(cid) then
  551.    amount = math.abs(getCreatureHealth(cid)-getCreatureMaxHealth(cid))
  552. end
  553. if getCreatureHealth(cid) ~= getCreatureMaxHealth(cid) then          
  554.    doCreatureAddHealth(cid, amount)
  555.    doSendAnimatedText(getThingPosWithDebug(cid), "+"..amount.."", 65)
  556. end
  557. end
  558.          
  559. if damageCombat == PSYCHICDAMAGE or damageCombat == MIRACLEDAMAGE then
  560.    if getPlayerStorageValue(attacker, 95487) >= 1 then
  561.       doHeal(attacker, valor)
  562.       setPlayerStorageValue(attacker, 95487, -1)                  
  563.    end
  564. elseif damageCombat == SEED_BOMBDAMAGE then
  565.    doHeal(attacker, valor)
  566. end
  567. --------------------------------------------
  568. ----------SACRED FIRE-----------------------
  569. if combat == SACREDDAMAGE and not ehNPC(cid) then    
  570.    local ret = {}
  571.    ret.id = cid
  572.    ret.cd = 9
  573.    ret.check = getPlayerStorageValue(cid, conds["Silence"])
  574.    ret.eff = 39
  575.    ret.cond = "Silence"
  576.  
  577.    doCondition2(ret)
  578. elseif combat == MUDBOMBDAMAGE and not ehNPC(cid) then
  579.    local ret = {}                                        
  580.    ret.id = cid
  581.    ret.cd = 9
  582.    ret.eff = 34
  583.    ret.check = getPlayerStorageValue(cid, conds["Miss"])
  584.    ret.spell = "Mud Bomb"       --alterado v1.9
  585.    ret.cond = "Miss"
  586.    
  587.    doCondition2(ret)
  588. end
  589. ---------------------------------------------
  590. --------------Passiva Lifesteal Clobat------------
  591. if combat == COMBAT_PHYSICALDAMAGE then
  592.    if getCreatureName(attacker) == "Crobat" then                    
  593.       doCreatureAddHealth(attacker, math.floor(valor))
  594.       doSendAnimatedText(getThingPos(attacker), "+ "..math.floor(valor), 30)
  595.    end
  596. end
  597. --- X-Agility/X-Strafe/X-Rage/X-Harden ---
  598. if combat == COMBAT_PHYSICALDAMAGE then
  599. local TierAgi = {
  600. [43] = {chance = Agility1},
  601. [44] = {chance = Agility2},
  602. [45] = {chance = Agility3},
  603. [46] = {chance = Agility4},
  604. [47] = {chance = Agility5},
  605. [48] = {chance = Agility6},
  606. [49] = {chance = Agility7},
  607. }
  608. local TierStra = {
  609. [50] = {chance = Strafe1},
  610. [51] = {chance = Strafe2},
  611. [52] = {chance = Strafe3},
  612. [53] = {chance = Strafe4},
  613. [54] = {chance = Strafe5},
  614. [55] = {chance = Strafe6},
  615. [56] = {chance = Strafe7},
  616. }
  617. local TierRage = {
  618. [57] = {chance = Rage1},
  619. [58] = {chance = Rage2},
  620. [59] = {chance = Rage3},
  621. [60] = {chance = Rage4},
  622. [61] = {chance = Rage5},
  623. [62] = {chance = Rage6},
  624. [63] = {chance = Rage7},
  625. }
  626. if isPlayer(getCreatureMaster(attacker)) and isSummon(attacker) then
  627. local Tier = getItemAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, "heldx")
  628. if Tier and Tier > 42 and Tier < 50 and getPlayerStorageValue(attacker, 22666) ~= 1 then
  629. if math.random(1,100) <= TierAgi[Tier].chance then
  630. docastspell(attacker, "Agility")
  631. setPlayerStorageValue(attacker, 22666, 1)
  632. addEvent(function() setPlayerStorageValue(attacker, 22666, 0) end, 15 * 1000)
  633. end
  634. elseif Tier and Tier > 49 and Tier < 57 and getPlayerStorageValue(attacker, 22666) ~= 2 then
  635. if math.random(1,100) <= TierStra[Tier].chance then
  636. docastspell(attacker, "Strafe")
  637. setPlayerStorageValue(attacker, 22666, 2)
  638. addEvent(function() setPlayerStorageValue(attacker, 22666, 0) end, 15 * 1000)
  639. end
  640. elseif Tier and Tier > 56 and Tier < 64 and getPlayerStorageValue(attacker, 22666) ~= 3 then
  641. if math.random(1,100) <= TierRage[Tier].chance then
  642. docastspell(attacker, "Rage")
  643. setPlayerStorageValue(attacker, 22666, 3)
  644. addEvent(function() setPlayerStorageValue(attacker, 22666, 0) end, 15 * 1000)
  645. end
  646. end
  647. end
  648. if isPlayer(getCreatureMaster(cid)) and isSummon(cid) then
  649. local TierHarden = {
  650. [64] = {chance = Harden1},
  651. [65] = {chance = Harden2},
  652. [66] = {chance = Harden3},
  653. [67] = {chance = Harden4},
  654. [68] = {chance = Harden5},
  655. [69] = {chance = Harden6},
  656. [70] = {chance = Harden7},
  657. }
  658. local TierEle = {
  659. [78] = {chance = Elemen1},
  660. [79] = {chance = Elemen2},
  661. [80] = {chance = Elemen3},
  662. [81] = {chance = Elemen4},
  663. [82] = {chance = Elemen5},
  664. [83] = {chance = Elemen6},
  665. [84] = {chance = Elemen7},
  666. }
  667. local Tier = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "heldx")
  668. if Tier and Tier > 63 and Tier < 71 and getPlayerStorageValue(cid, 22666) ~= 4 then
  669. if math.random(1,100) <= TierHarden[Tier].chance then
  670. docastspell(cid, "Harden")
  671. setPlayerStorageValue(cid, 22666, 4)
  672. addEvent(function() setPlayerStorageValue(cid, 22666, 0) end, 8 * 1000)
  673. end
  674. end
  675. if Tier and Tier > 77 and Tier < 85 and getPlayerStorageValue(cid, 22666) ~= 5 then
  676. if math.random(1,100) <= TierEle[Tier].chance then
  677. docastspell(cid, "Elemental", -1000, -5000)
  678. setPlayerStorageValue(cid, 22666, 5)
  679. addEvent(function() setPlayerStorageValue(cid, 22666, 0) end, 1 * 1800)
  680. end
  681. end
  682. end
  683. end
  684. --- X-Agility/Strafe/Rage/Harden ---
  685. --------------------------------------------
  686.     valor = math.abs(valor)    --alterado v1.9
  687.     if isSummon(attacker) then
  688.         if combat == COMBAT_PHYSICALDAMAGE then
  689.             doTargetCombatHealth(getCreatureMaster(attacker), cid, PHYSICALDAMAGE, -valor, -valor, 255)
  690.             addEvent(doDoubleHit, 1000, attacker, cid, valor, races)      
  691.         else
  692.             doTargetCombatHealth(getCreatureMaster(attacker), cid, damageCombat, -valor, -valor, 255)
  693.         end
  694.     else
  695.         if combat ~= COMBAT_PHYSICALDAMAGE then
  696.             doCreatureAddHealth(cid, -valor, 3, combats[damageCombat].cor)  
  697.         else
  698.             doCreatureAddHealth(cid, -valor, 3, races[getMonsterInfo(getCreatureName(cid)).race].cor)
  699.             addEvent(doDoubleHit, 1000, attacker, cid, valor, races)  
  700.         end
  701.  
  702.         if isSummon(cid) and valor ~= 0 then
  703.             addEvent(sendPlayerDmgMsg, 5, getCreatureMaster(cid), "Your "..getCreatureName(cid).." lost "..valor.." hitpoints due to an attack from "..getSomeoneDescription(attacker)..".")
  704.         end
  705.  
  706.     end
  707.    
  708.     if damageCombat == FIREDAMAGE and not isBurning(cid) then
  709.        local ret = {}
  710.        ret.id = cid
  711.        ret.cd = math.random(5, 12)
  712.        ret.check = getPlayerStorageValue(cid, conds["Burn"])
  713.        ret.damage = isSummon(attacker) and getMasterLevel(attacker)+getPokemonBoost(attacker) or getPokemonLevel(attacker)
  714.        ret.cond = "Burn"
  715.        
  716.        doCondition2(ret)
  717.     elseif damageCombat == POISONDAMAGE and not isPoisoned(cid) then
  718.        local ret = {}
  719.        ret.id = cid
  720.        ret.cd = math.random(6, 15)
  721.        ret.check = getPlayerStorageValue(cid, conds["Poison"])
  722.        local lvl = isSummon(attacker) and getMasterLevel(attacker) or getPokemonLevel(attacker)
  723.        ret.damage = math.floor((getPokemonLevel(attacker)+lvl)/2)
  724.        ret.cond = "Poison"
  725.        
  726.        doCondition2(ret)
  727.     end
  728. --[[---------------CD BAR-----------------------
  729. if isSummon(cid) then
  730.    doCreatureExecuteTalkAction(getCreatureMaster(cid), "/pokeread")
  731. end  ]]
  732. ------------------------------------POTIONS-------------------------------------------
  733. if isSummon(cid) and type == STATSCHANGE_HEALTHLOSS then
  734.    if getPlayerStorageValue(cid, 173) >= 1 then
  735.       if damageCombat ~= BURNEDDAMAGE and damageCombat ~= POISONEDDAMAGE then
  736.          setPlayerStorageValue(cid, 173, -1)  
  737.          doSendAnimatedText(getThingPos(cid), "Lost Heal", 144)
  738.       end
  739.    end
  740. end
  741. ----------------------------------------PASSIVAS-------------------------------------  
  742. -------------------------------------------Counter Helix------------------------------------
  743. if passivesChances["Helix"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Helix"][getCreatureName(cid)] then
  744.    docastspell(cid, "Counter Helix")
  745. end
  746. -------------------------------------------Lava Counter/Electricity----------------------------
  747. if passivesChances["Fire_Thunder"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Fire_Thunder"][getCreatureName(cid)] then
  748.    docastspell(cid, "Lava-Electricity")
  749. end
  750. ---------------------------------------Stunning Confusion-----------------------------------------
  751. if passivesChances["Stunning"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Stunning"][getCreatureName(cid)] then  
  752.    docastspell(cid, "Stunning Confusion")
  753. end
  754. -----------------------------------------Groundshock-----------------------------------
  755. if passivesChances["Groundshock"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Groundshock"][getCreatureName(cid)] then
  756.    docastspell(cid, "Groundshock")
  757. end
  758. --------------------------------------Electric Charge---------------------------------------------
  759. if passivesChances["Electric Charge"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Electric Charge"][getCreatureName(cid)] then
  760.    docastspell(cid, "Electric Charge", 0, 0)
  761. end
  762. -------------------------------------Melody------------------------------------
  763. if passivesChances["Melody"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Melody"][getCreatureName(cid)] then
  764.    docastspell(cid, "Melody")
  765. end
  766. ------------------------------------- Dragon Fury / Fury ---------------------------------------
  767. if passivesChances["Dragon Fury"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Dragon Fury"][getCreatureName(cid)] then
  768.    docastspell(cid, "Dragon Fury", 0, 0)
  769. end
  770. ------------------------------------- Mega Drain ---------------------------------------
  771. if passivesChances["Mega Drain"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Mega Drain"][getCreatureName(cid)] then
  772.    docastspell(cid, "Mega Drain")
  773. end
  774. ------------------------------------- Spores Reaction ---------------------------------------
  775. if passivesChances["Spores Reaction"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Spores Reaction"][getCreatureName(cid)] then
  776.    docastspell(cid, "Spores Reaction")
  777. end
  778. ------------------------------------ Amnesia ----------------------------------------  
  779. if passivesChances["Amnesia"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Amnesia"][getCreatureName(cid)] then
  780.    docastspell(cid, "Amnesia", 0, 0)
  781. end
  782. ----------------------------------- Zen Mind -----------------------------------------
  783. if passivesChances["Zen Mind"][getCreatureName(cid)] and isWithCondition(cid) and math.random(1, 100) <= passivesChances["Zen Mind"][getCreatureName(cid)] then
  784.    docastspell(cid, "Zen Mind", 0, 0)
  785. end
  786. ---------------------------------- Mirror Coat ---------------------------------------
  787. if passivesChances["Mirror Coat"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Mirror Coat"][getCreatureName(cid)] then  
  788.    docastspell(cid, "Mirror Coat", 0, 0)
  789. end
  790. --------------------------------- Illusion -----------------------------------------
  791. return false
  792. 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