Advertisement
Guest User

exp2.0.lua

a guest
Jul 20th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.48 KB | None | 0 0
  1. local combats = { --alterado v1.6 \/
  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}
  26. }
  27.  
  28. --alterado v1.5 tabelas agora estao em lib/configuration.lua
  29. local function sendPlayerDmgMsg(cid, text)
  30. if not isCreature(cid) then return true end
  31. doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, text)
  32. end
  33.  
  34. local races = {
  35. [4] = {cor = COLOR_FIRE2},
  36. [6] = {cor = COLOR_WATER},
  37. [7] = {cor = COLOR_NORMAL},
  38. [8] = {cor = COLOR_FIRE2},
  39. [9] = {cor = COLOR_FIGHTING},
  40. [10] = {cor = COLOR_FLYING},
  41. [11] = {cor = COLOR_GRASS},
  42. [12] = {cor = COLOR_POISON},
  43. [13] = {cor = COLOR_ELECTRIC},
  44. [14] = {cor = COLOR_GROUND},
  45. [15] = {cor = COLOR_PSYCHIC},
  46. [16] = {cor = COLOR_ROCK},
  47. [17] = {cor = COLOR_ICE},
  48. [18] = {cor = COLOR_BUG},
  49. [19] = {cor = COLOR_DRAGON},
  50. [20] = {cor = COLOR_GHOST},
  51. [21] = {cor = COLOR_STEEL},
  52. [22] = {cor = COLOR_DARK},
  53. [1] = {cor = 180},
  54. [2] = {cor = 180},
  55. [3] = {cor = 180},
  56. [5] = {cor = 180},
  57. }
  58.  
  59. local damages = {GROUNDDAMAGE, ELECTRICDAMAGE, ROCKDAMAGE, FLYDAMAGE, BUGDAMAGE, FIGHTINGDAMAGE, DRAGONDAMAGE, POISONDAMAGE, DARKDAMAGE, STEELDAMAGE}
  60. local fixdmgs = {PSYCHICDAMAGE, COMBAT_PHYSICALDAMAGE, GRASSDAMAGE, FIREDAMAGE, WATERDAMAGE, ICEDAMAGE, NORMALDAMAGE, GHOSTDAMAGE}
  61. local ignored = {POISONEDDAMAGE, BURNEDDAMAGE} --alterado v1.6
  62. local cannotkill = {BURNEDDAMAGE, POISONEDDAMAGE}
  63.  
  64. function onStatsChange(cid, attacker, type, combat, value)
  65.  
  66. if combat == FLYSYSTEMDAMAGE then return false end
  67. if isPlayer(cid) and getCreatureOutfit(cid).lookType == 814 then return false end -- TV
  68.  
  69. if not isCreature(attacker) then --alterado v1.5 cid == attacker
  70. if not isInArray(fixdamages, combat) and combats[combat] then
  71. doSendAnimatedText(getThingPos(cid), value, combats[combat].cor)
  72. end
  73. return true
  74. end
  75.  
  76. local damageCombat = combat
  77. --------------------------------------------------
  78. --alterado v1.6 retirado os combats sleep_powder e poison_powder daki!
  79. --------------------------------------------------
  80. if type == STATSCHANGE_HEALTHGAIN then
  81. if cid == attacker then
  82. return true
  83. end
  84. if isSummon(cid) and isSummon(attacker) and canAttackOther(cid, attacker) == "Cant" then
  85. return false
  86. end
  87. return true
  88. end
  89. --------------------------------------------------
  90. if isMonster(cid) then
  91. local valor = value
  92. if not pokes[getCreatureName(cid)] and damageCombat == COMBAT_PHYSICALDAMAGE then
  93. valor = getOffense(attacker) * playerDamageReduction
  94. doCreatureAddHealth(cid, -math.abs(valor), 3, races[7].cor) --alterado v1.6 dano nos npcs
  95. return false
  96. elseif not pokes[getCreatureName(cid)] and damageCombat ~= COMBAT_PHYSICALDAMAGE then
  97. doCreatureAddHealth(cid, -math.abs(valor), 3, combats[damageCombat].cor)
  98. return false
  99. end
  100. end
  101. --------------------------------------------------
  102. if isPlayer(attacker) then
  103.  
  104. local valor = value
  105. if valor > getCreatureHealth(cid) then
  106. valor = getCreatureHealth(cid)
  107. end
  108.  
  109. if combat == COMBAT_PHYSICALDAMAGE then
  110. return false
  111. end
  112.  
  113. if combat == PHYSICALDAMAGE then
  114. doSendMagicEffect(getThingPos(cid), 3)
  115. doSendAnimatedText(getThingPos(cid), valor, races[getMonsterInfo(getCreatureName(cid)).race].cor)
  116. end
  117.  
  118. if combats[damageCombat] and not isInArray(fixdmgs, damageCombat) then
  119. doSendAnimatedText(getThingPos(cid), valor, combats[damageCombat].cor)
  120. end
  121.  
  122. if #getCreatureSummons(attacker) >= 1 and not isInArray({POISONEDDAMAGE, BURNEDDAMAGE}, combat) then
  123. --doPlayerSendTextMessage(attacker, cid, 20, "Seu "..getPokeName(getCreatureSummons(attacker)[1]).." causou "..valor.." de dano no "..getSomeoneDescription(cid)..".")
  124. end
  125.  
  126. return true
  127. end
  128. --------------------------------------------------
  129. if isPlayer(cid) and #getCreatureSummons(cid) >= 1 and type == STATSCHANGE_HEALTHLOSS then
  130. --if ehMonstro(attacker) and getClosestFreeTile(getCreatureSummons(cid)[1]) >= 1 then
  131. --doSendAnimatedText(getThingPosWithDebug(attacker), "Hmpfg!", 215)
  132. --doMonsterSetTarget(attacker, getCreatureSummons(cid)[1])
  133. --end
  134. return false
  135. end
  136. --if isPlayer(cid) and #getCreatureSummons(cid) >= 1 and type == STATSCHANGE_HEALTHLOSS then
  137. --if ehMonstro(attacker) and getClosestFreeTile(getCreatureSummons(cid)[1]) <= 0 then
  138. --doSendAnimatedText(getThingPosWithDebug(attacker), "Grrr!", 215)
  139. --doMonsterSetTarget(attacker, cid)
  140. --end
  141. --return true
  142. --end
  143. --------------------------------------------------
  144. if isPlayer(cid) and #getCreatureSummons(cid) <= 0 and type == STATSCHANGE_HEALTHLOSS then
  145.  
  146. if isSummon(attacker) or isPlayer(attacker) then
  147. if canAttackOther(cid, attacker) == "Cant" then return false end
  148. end
  149.  
  150. local valor = 0
  151. if combat == COMBAT_PHYSICALDAMAGE then
  152. valor = getOffense(attacker)
  153. else
  154. valor = getSpecialAttack(attacker)
  155. end
  156.  
  157. valor = valor * playerDamageReduction
  158. valor = valor * math.random(83, 117) / 100
  159.  
  160. if valor >= getCreatureHealth(cid) then
  161. valor = getCreatureHealth(cid)
  162. end
  163.  
  164. valor = math.floor(valor)
  165.  
  166. if valor >= getCreatureHealth(cid) then
  167. if getPlayerStorageValue(cid, 6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1 then
  168. setPlayerStorageValue(cid, 6598754, -1)
  169. setPlayerStorageValue(cid, 6598755, -1)
  170. doRemoveCondition(cid, CONDITION_OUTFIT)
  171. doTeleportThing(cid, {x = 1001, y = 1026, z = 14}, false)
  172. doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  173. return false --alterado v1.8
  174. elseif getPlayerStorageValue(cid, 577869) >= 1 then
  175. setPlayerStorageValue(cid, 577869, 0)
  176. doTeleportThing(cid, {x = 1009, y = 1084, z = 14}, false)
  177. doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  178. return false
  179. elseif getPlayerStorageValue(cid, 20000) >= 1 then
  180. setPlayerStorageValue(cid, 20000, 0)
  181. setPlayerStorageValue(cid,30,0)
  182. doTeleportThing(cid, {x = 1172, y = 1366, z = 7}, false)
  183. doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  184. doPlayerSendTextMessage(cid, 20, "Você morreu no Saffari por Favor volte mais tarde!")
  185. return false
  186. elseif getPlayerStorageValue(cid, 20001) >= 1 then
  187. setPlayerStorageValue(cid,20001,0)
  188. doTeleportThing(cid, {x = 1371, y = 1240, z = 7}, false)
  189. doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  190. doRemoveCondition(cid, CONDITION_OUTFIT)
  191. doPlayerSendTextMessage(cid, 20, "You are died in demon room, please come back!")
  192. return false
  193. end
  194. ------------------------------------------- ---
  195. if getPlayerStorageValue(cid, 18) >= 1 then
  196. setPlayerStorageValue(cid,18,0)
  197. doRemoveCondition(cid, CONDITION_OUTFIT)
  198. end
  199. ------------Saffari----------------------------------
  200. if getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 then
  201. doRemoveCondition(cid, CONDITION_OUTFIT)
  202. setPlayerStorageValue(cid, 17000, 0)
  203. setPlayerStorageValue(cid, 17001, 0)
  204. setPlayerStorageValue(cid, 63215, -1)
  205. doChangeSpeed(cid, PlayerSpeed)
  206. local item = getPlayerSlotItem(cid, 8)
  207. local btype = getPokeballType(item.itemid)
  208. if #getCreatureSummons(cid) <= 0 then
  209. if isInArray(pokeballs[btype].all, item.itemid) then
  210. doTransformItem(item.uid, pokeballs[btype].off)
  211. doItemSetAttribute(item.uid, "hp", 0)
  212. end
  213. end
  214. end
  215. ------------Edited Golden Arena------------------
  216. if getPlayerStorageValue(cid, 22545) == 1 then
  217. if getGlobalStorageValue(22550) == 1 then
  218. doPlayerSendTextMessage(cid, 20, "Você foi o último sobrevivente da Golden Arena! Tome sua recompensa!")
  219. doPlayerAddItem(cid, 2160, getPlayerStorageValue(cid, 22551)*30/4)
  220. doPlayerAddExperience(cid, 1000, getPlayerStorageValue(cid, 22551)*30)
  221. setPlayerStorageValue(cid, 22545, -1)
  222. doTeleportThing(cid, getClosestFreeTile(cid, getClosestFreeTile(cid, posBackGolden)), false)
  223. doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid))
  224. --setPlayerRecordWaves(cid)
  225. endGoldenArena()
  226. return false --alterado v1.8
  227. else
  228. setGlobalStorageValue(22550, getGlobalStorageValue(22550)-1)
  229. setPlayerStorageValue(cid, 22545, -1)
  230. doTeleportThing(cid, getClosestFreeTile(cid, posBackGolden), false)
  231. doPlayerAddItem(cid, 2152, getPlayerStorageValue(cid, 22551)*5)
  232. doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid))
  233. --setPlayerRecordWaves(cid)
  234. return true
  235. end
  236. end
  237. ----------------------------------
  238. if getPlayerSex(cid) == 1 then
  239. local corpse = doCreateItem(3058, 1, getThingPos(cid))
  240. doDecayItem(corpse)
  241. doItemSetAttribute(corpse, "name", "dead human (Vol:8). You recognize ".. getCreatureName(cid) ..". He was killed by a ".. getCreatureName(attacker) .."")
  242. elseif getPlayerSex(cid) == 0 then
  243. local corpse = doCreateItem(3065, 1, getThingPos(cid))
  244. doDecayItem(corpse)
  245. doItemSetAttribute(corpse, "name", "dead human (Vol:8). You recognize ".. getCreatureName(cid) ..". She was killed by a ".. getCreatureName(attacker) .."")
  246. end
  247. end
  248. doCreatureAddHealth(cid, -valor, 3, 180)
  249. if not isPlayer(cid) then
  250. addEvent(sendPlayerDmgMsg, 5, cid, "Você perdeu "..valor.." em pontos de vida por um attack de "..getSomeoneDescription(attacker)..".")
  251. end
  252. return false
  253. end
  254. --------------------------------------------------
  255. --if isMonster(attacker) and getPlayerStorageValue(attacker, 201) ~= -1 then
  256. -- if isPlayer(cid) then
  257. -- return false
  258. -- end
  259. -- if getPlayerStorageValue(getCreatureMaster(cid), ginasios[getPlayerStorageValue(attacker, 201)].storage) ~= 1 then
  260. -- return false
  261. -- end
  262. --end
  263. ---------------------------------------------------
  264. --if isMonster(cid) and getPlayerStorageValue(cid, 201) ~= -1 then
  265. -- if getPlayerStorageValue(getCreatureMaster(attacker), ginasios[getPlayerStorageValue(cid, 201)].storage) ~= 1 then
  266. -- return false
  267. -- end
  268. --end
  269. --------------------------------------------------
  270. if ehMonstro(cid) and ehMonstro(attacker) then
  271. return false --edited monstro nao atacar monstro
  272. end
  273. --------------------------------------------------
  274. --------------------REFLECT-----------------------
  275. if getPlayerStorageValue(cid, 21099) >= 1 and combat ~= COMBAT_PHYSICALDAMAGE then
  276. if not isInArray({"Team Claw", "Team Slice"}, getPlayerStorageValue(attacker, 21102)) then
  277. doSendMagicEffect(getThingPosWithDebug(cid), 135)
  278. doSendAnimatedText(getThingPosWithDebug(cid), "REFLECT", COLOR_GRASS)
  279. addEvent(docastspell, 100, cid, getPlayerStorageValue(attacker, 21102))
  280. if getCreatureName(cid) == "Wobbuffet" then
  281. doRemoveCondition(cid, CONDITION_OUTFIT)
  282. end
  283. setPlayerStorageValue(cid, 21099, -1) --alterado v1.6
  284. setPlayerStorageValue(cid, 21100, 1)
  285. setPlayerStorageValue(cid, 21101, attacker)
  286. setPlayerStorageValue(cid, 21103, getTableMove(attacker, getPlayerStorageValue(attacker, 21102)).f)
  287. setPlayerStorageValue(cid, 21104, getCreatureOutfit(attacker).lookType)
  288. return false
  289. end
  290. end
  291. -------------------------------------------------
  292.  
  293. local multiplier = 1
  294.  
  295. if isCreature(cid) then
  296. poketype1 = pokes[getCreatureName(cid)].type --alterado v1.6
  297. poketype2 = pokes[getCreatureName(cid)].type2
  298. end
  299. if not poketype1 or not poketype2 then return false end --alterado v1.6
  300.  
  301. if getCreatureCondition(cid, CONDITION_INVISIBLE) then
  302. return false
  303. end
  304. if damageCombat ~= COMBAT_PHYSICALDAMAGE and not isInArray(ignored, damageCombat) then
  305. if isInArray(effectiveness[damageCombat].super, poketype1) then
  306. multiplier = multiplier + 0.5
  307. end
  308. if isInArray(effectiveness[damageCombat].super, poketype2) then
  309. multiplier = multiplier + 0.5
  310. end
  311. if isInArray(effectiveness[damageCombat].weak, poketype1) then --Edited effetivenes = pxg... ;p
  312. multiplier = multiplier - 0.25
  313. end
  314. if isInArray(effectiveness[damageCombat].weak, poketype2) then
  315. multiplier = multiplier - 0.25
  316. end
  317. if isInArray(effectiveness[damageCombat].non, poketype1) or isInArray(effectiveness[damageCombat].non, poketype2) then
  318. if isInArray(specialabilities["foresight"], getCreatureName(attacker)) then --alterado v1.5
  319. multiplier = 0.5
  320. end --alterado v1.6
  321. end
  322. -- X-Attack --
  323. if isSummon(attacker) and isPlayer(getCreatureMaster(attacker)) then
  324. local TierArray = {8, 9, 10, 11, 12, 13, 14}
  325. local Tiers = {
  326. [8] = {bonus = AtkBonus1},
  327. [9] = {bonus = AtkBonus2},
  328. [10] = {bonus = AtkBonus3},
  329. [11] = {bonus = AtkBonus4},
  330. [12] = {bonus = AtkBonus5},
  331. [13] = {bonus = AtkBonus6},
  332. [14] = {bonus = AtkBonus7},
  333. }
  334. local ball = getPlayerSlotItem(getCreatureMaster(attacker), 8)
  335. local Tier = getItemAttribute(ball.uid, "heldx")
  336. local bonusatk = {}
  337. if isInArray(TierArray, getItemAttribute(ball.uid, "heldx")) then
  338. bonusatk = Tiers[Tier].bonus
  339. else
  340. bonusatk = 1
  341. end
  342. multiplier = multiplier * bonusatk
  343. end
  344.  
  345.  
  346. if isSummon(cid) and isPlayer(getCreatureMaster(cid))then
  347. local TierEle = {
  348. [78] = {chance = Elemen1},
  349. [79] = {chance = Elemen2},
  350. [80] = {chance = Elemen3},
  351. [81] = {chance = Elemen4},
  352. [82] = {chance = Elemen5},
  353. [83] = {chance = Elemen6},
  354. [84] = {chance = Elemen7},
  355. }
  356. local Tier = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "heldx")
  357. if Tier and Tier > 77 and Tier < 85 and getPlayerStorageValue(cid, 22666) ~= 5 then
  358. if math.random(1,100) <= TierEle[Tier].chance then
  359. docastspell(cid, "Elemental", -1000, -5000)
  360. setPlayerStorageValue(cid, 22666, 5)
  361. addEvent(function() setPlayerStorageValue(cid, 22666, 0) end, 1 * 1800)
  362. end
  363. end
  364. end
  365.  
  366.  
  367.  
  368. -- X-Attack --
  369. elseif combat == COMBAT_PHYSICALDAMAGE then
  370. if isGhostPokemon(cid) then --alterado v1.3
  371. if not isInArray(specialabilities["foresight"], getCreatureName(attacker)) then --passiva Foresight!!
  372. doSendMagicEffect(getThingPos(cid), 3)
  373. return false
  374. end
  375. end
  376. local cd = getPlayerStorageValue(attacker, conds["Miss"])
  377. local cd2 = getPlayerStorageValue(attacker, conds["Confusion"])
  378. local cd3 = getPlayerStorageValue(attacker, conds["Stun"])
  379. if cd >= 0 or cd2 >= 0 or cd3 >= 0 then
  380. if math.random(1, 100) > 50 then --Edited miss system -- 50% chance de da miss no atk fisico
  381. doSendMagicEffect(getThingPos(cid), 211)
  382. doSendAnimatedText(getThingPos(attacker), "MISS", 215) --alterado v1.5
  383. return false
  384. end
  385. end
  386. end
  387. --------------------------------------------------
  388. local valor = value
  389.  
  390. if multiplier == 1.5 and poketype2 == "no type" then
  391. multiplier = 2 --alterado v1.6
  392. elseif multiplier == 1.5 and poketype2 ~= "no type" then
  393. multiplier = 1.75
  394. elseif multiplier == 1.25 then --edited effetivines = pxg
  395. multiplier = 1
  396. end
  397.  
  398. --------------------------------------------------
  399. if isSummon(cid) and isSummon(attacker) then
  400. if getCreatureMaster(cid) == getCreatureMaster(attacker) then
  401. return false
  402. end
  403. if canAttackOther(cid, attacker) == "Cant" then
  404. return false
  405. end
  406. end
  407.  
  408. valor = valor * multiplier
  409.  
  410. if isSummon(attacker) then
  411. valor = valor * getHappinessRate(attacker)
  412. else
  413. valor = valor * summonReduction
  414. end
  415.  
  416. valor = math.floor(valor)
  417.  
  418. if combat == COMBAT_PHYSICALDAMAGE then
  419. block = 1 - (getDefense(cid) / (getOffense(attacker) + getDefense(cid)))
  420. valor = getOffense(attacker) * block
  421.  
  422. if isInArray(specialabilities["counter"], getCreatureName(cid)) then
  423. if math.random(1, 100) <= 10 then
  424. doCreatureAddHealth(attacker, -valor, 3, 180)
  425. valor = 0
  426. doSendAnimatedText(getThingPosWithDebug(cid), "COUNTER", 215)
  427. end
  428. end
  429. -- Return --
  430. if isSummon(cid) and isPlayer(getCreatureMaster(cid)) then
  431. local returnbonus = {}
  432. local ball = getPlayerSlotItem(getCreatureMaster(cid), 8)
  433. local Tiers = {
  434. [15] = {bonus = DmgReturn1},
  435. [16] = {bonus = DmgReturn2},
  436. [17] = {bonus = DmgReturn3},
  437. [18] = {bonus = DmgReturn4},
  438. [19] = {bonus = DmgReturn5},
  439. [20] = {bonus = DmgReturn6},
  440. [21] = {bonus = DmgReturn7},
  441. }
  442. local Tier = getItemAttribute(ball.uid, "heldx")
  443. if Tier and Tier > 14 and Tier < 22 then
  444. returnbonus = math.floor((valor * Tiers[Tier].bonus))
  445. elseif not isInArray(Tiers, Tier) then
  446. returnbonus = 0
  447. end
  448. doCreatureAddHealth(attacker, -returnbonus)
  449. end
  450. -- Return --
  451. else
  452. -- Return --
  453. if isSummon(cid) and isPlayer(getCreatureMaster(cid)) then
  454. local returnbonus = {}
  455. local ball = getPlayerSlotItem(getCreatureMaster(cid), 8)
  456. local Tiers = {
  457. [15] = {bonus = DmgReturn1},
  458. [16] = {bonus = DmgReturn2},
  459. [17] = {bonus = DmgReturn3},
  460. [18] = {bonus = DmgReturn4},
  461. [19] = {bonus = DmgReturn5},
  462. [20] = {bonus = DmgReturn6},
  463. [21] = {bonus = DmgReturn7},
  464. }
  465. local Tier = getItemAttribute(ball.uid, "heldx")
  466. if Tier and Tier > 14 and Tier < 22 then
  467. returnbonus = math.floor((valor * Tiers[Tier].bonus))
  468. elseif not isInArray(Tiers, Tier) then
  469. returnbonus = 0
  470. end
  471. doCreatureAddHealth(attacker, -returnbonus)
  472. end
  473. -- Return --
  474. -- Critical --
  475. if isSummon(attacker) and isPlayer(getCreatureMaster(attacker)) then
  476. local Tiers = {
  477. [85] = {chance = Critical1},
  478. [86] = {chance = Critical2},
  479. [87] = {chance = Critical3},
  480. [88] = {chance = Critical4},
  481. [89] = {chance = Critical5},
  482. [90] = {chance = Critical6},
  483. [91] = {chance = Critical7},
  484. }
  485. local ball = getPlayerSlotItem(getCreatureMaster(attacker), 8)
  486. local Tier = getItemAttribute(ball.uid, "heldx")
  487. if Tier and Tier > 84 and Tier < 92 then
  488. if math.random(1,100) <= Tiers[Tier].chance then
  489. valor = valor * 2
  490. doSendAnimatedText(getThingPos(cid), "STK "..(valor * 0.25), 115)
  491. end
  492. end
  493. end
  494. -- Critical --
  495. valor = valor / getDefense(cid)
  496. end
  497.  
  498. -------------------------Edited CLAN SYSTEM-----------------------------------
  499. if isSummon(attacker) and getPlayerStorageValue(getCreatureMaster(attacker), 86228) >= 1 then
  500. valor = valor*getClanPorcent(getCreatureMaster(attacker), combat, "atk") --alterado v1.3
  501. elseif isSummon(cid) and getPlayerStorageValue(getCreatureMaster(cid), 86228) >= 1 then
  502. valor = valor - (valor*getClanPorcent(getCreatureMaster(cid), combat, "def", pokes[getCreatureName(cid)].type, pokes[getCreatureName(cid)].type2))
  503. end
  504. -----------------------------------------------------------------------
  505. ---------------------- FEAR / ROAR ------------------------------------
  506. if getPlayerStorageValue(attacker, conds["Fear"]) >= 1 then --alterado!!
  507. return true
  508. end
  509. --------------------------------------------------------------------------
  510. if damageCombat ~= COMBAT_PHYSICALDAMAGE and not isInArray(ignored, damageCombat) then
  511. if isInArray(effectiveness[damageCombat].non, poketype1) or isInArray(effectiveness[damageCombat].non, poketype2) then
  512. if not isInArray(specialabilities["foresight"], getCreatureName(attacker)) then --alterado v1.6
  513. valor = valor * 0 --alterado v1.5
  514. end
  515. end
  516. end
  517.  
  518. if damageCombat == GROUNDDAMAGE then
  519. if isInArray(specialabilities["levitate"], getCreatureName(cid)) then
  520. valor = 0 --alterado v1.5
  521. end
  522. end
  523. -----------------------------------------------------------------------------
  524. local p = getThingPos(cid)
  525. if p.x == 1 and p.y == 1 and p.z == 10 then
  526. return false
  527. end
  528.  
  529. if getPlayerStorageValue(cid, 9658783) == 1 then
  530. return false --imune
  531. end
  532. -----------------------------------------------------------------------------
  533. local config = {
  534. sturdy = { --Pokémons que possuem a habilidade Sturdy. Configuração: ["nome_do_pokemon"] = lookType,
  535. ["Aggron"] = 1685,
  536. ["Mega Aggron"] = 1798,
  537. },
  538. cd = 30, --Cooldown da habilidade.
  539. duration = 8, --Duração, em segundos, do Sturdy.
  540. storage = 8402,
  541. }
  542.  
  543. if getPlayerStorageValue(cid, config.storage) > -1 then
  544. return false
  545. end
  546. local hp = getCreatureHealth(cid) - valor
  547. if not isPlayer(cid) and hp <= 1 and config.sturdy[getCreatureName(cid)] then
  548. local b = true
  549. if isSummon(cid) then
  550. local ball = getPlayerSlotItem(getCreatureMaster(cid), 8)
  551. if ball and getCD(ball.uid, "sturdy") > 0 then
  552. b = false
  553. end
  554. end
  555. if b then
  556. if hp < 1 then
  557. doCreatureAddHealth(cid, hp < 0 and (hp * -1) + 1 or 1)
  558. end
  559. setPlayerStorageValue(cid, config.storage, 1)
  560. if isSummon(cid) then
  561. local ball = getPlayerSlotItem(getCreatureMaster(cid), 8)
  562. if ball then
  563. setCD(ball.uid, "sturdy", config.duration + config.cd)
  564. end
  565. end
  566. doSetCreatureOutfit(cid, {lookType = config.sturdy[getCreatureName(cid)]}, config.duration * 1000)
  567. addEvent(function()
  568. if isCreature(cid) and getPlayerStorageValue(cid, config.storage) > -1 then
  569. setPlayerStorageValue(cid, config.storage, -1)
  570. doCreatureAddHealth(cid, -getCreatureHealth(cid))
  571. end
  572. end, config.duration * 1000)
  573. end
  574. end
  575. if valor >= getCreatureHealth(cid) then
  576. if isInArray(cannotKill, combat) and isPlayer(cid) then
  577. valor = getCreatureHealth(cid) - 1
  578. else
  579. valor = getCreatureHealth(cid)
  580. end
  581. end
  582.  
  583. ------------------ SKILLs Q CURAM O ATTACKER ---------------------------------
  584. local function doHeal(cid, amount)
  585. if (getCreatureHealth(cid) + amount) >= getCreatureMaxHealth(cid) then
  586. amount = math.abs(getCreatureHealth(cid)-getCreatureMaxHealth(cid))
  587. end
  588. if getCreatureHealth(cid) ~= getCreatureMaxHealth(cid) then --alterado v1.6
  589. doCreatureAddHealth(cid, amount)
  590. doSendAnimatedText(getThingPosWithDebug(cid), "+"..amount.."", 65)
  591. end
  592. end
  593.  
  594. if damageCombat == PSYCHICDAMAGE or damageCombat == MIRACLEDAMAGE then
  595. if getPlayerStorageValue(attacker, 95487) >= 1 then
  596. doHeal(attacker, valor)
  597. setPlayerStorageValue(attacker, 95487, -1) --alterado v1.6
  598. end
  599. elseif damageCombat == SEED_BOMBDAMAGE then
  600. doHeal(attacker, valor)
  601. end
  602. --------------------------------------------
  603. ----------SACRED FIRE-----------------------
  604. if combat == SACREDDAMAGE and not ehNPC(cid) then --alterado v1.6
  605. local ret = {}
  606. ret.id = cid
  607. ret.cd = 9
  608. ret.check = getPlayerStorageValue(cid, conds["Silence"])
  609. ret.eff = 39
  610. ret.cond = "Silence"
  611.  
  612. doCondition2(ret)
  613. end
  614. ---------------------------------------------
  615.  
  616. --------------Passiva Lifesteal Clobat------------
  617. if combat == COMBAT_PHYSICALDAMAGE then
  618. if getCreatureName(attacker) == "Crobat" then --alterado v1.4
  619. doCreatureAddHealth(attacker, math.floor(valor))
  620. doSendAnimatedText(getThingPos(attacker), "+ "..math.floor(valor), 30)
  621. end
  622. end
  623. --------------------------------------------
  624. --- X-Agility/X-Strafe/X-Rage/X-Harden ---
  625. if combat == COMBAT_PHYSICALDAMAGE then
  626. local TierAgi = {
  627. [43] = {chance = Agility1},
  628. [44] = {chance = Agility2},
  629. [45] = {chance = Agility3},
  630. [46] = {chance = Agility4},
  631. [47] = {chance = Agility5},
  632. [48] = {chance = Agility6},
  633. [49] = {chance = Agility7},
  634. }
  635. local TierStra = {
  636. [50] = {chance = Strafe1},
  637. [51] = {chance = Strafe2},
  638. [52] = {chance = Strafe3},
  639. [53] = {chance = Strafe4},
  640. [54] = {chance = Strafe5},
  641. [55] = {chance = Strafe6},
  642. [56] = {chance = Strafe7},
  643. }
  644. local TierRage = {
  645. [57] = {chance = Rage1},
  646. [58] = {chance = Rage2},
  647. [59] = {chance = Rage3},
  648. [60] = {chance = Rage4},
  649. [61] = {chance = Rage5},
  650. [62] = {chance = Rage6},
  651. [63] = {chance = Rage7},
  652. }
  653. if isPlayer(getCreatureMaster(attacker)) and isSummon(attacker) then
  654. local Tier = getItemAttribute(getPlayerSlotItem(getCreatureMaster(attacker), 8).uid, "heldx")
  655. if Tier and Tier > 42 and Tier < 50 and getPlayerStorageValue(attacker, 22666) ~= 1 then
  656. if math.random(1,100) <= TierAgi[Tier].chance then
  657. docastspell(attacker, "Agility")
  658. setPlayerStorageValue(attacker, 22666, 1)
  659. addEvent(function() setPlayerStorageValue(attacker, 22666, 0) end, 15 * 1000)
  660. end
  661. elseif Tier and Tier > 49 and Tier < 57 and getPlayerStorageValue(attacker, 22666) ~= 2 then
  662. if math.random(1,100) <= TierStra[Tier].chance then
  663. docastspell(attacker, "Strafe")
  664. setPlayerStorageValue(attacker, 22666, 2)
  665. addEvent(function() setPlayerStorageValue(attacker, 22666, 0) end, 15 * 1000)
  666. end
  667. elseif Tier and Tier > 56 and Tier < 64 and getPlayerStorageValue(attacker, 22666) ~= 3 then
  668. if math.random(1,100) <= TierRage[Tier].chance then
  669. docastspell(attacker, "Rage")
  670. setPlayerStorageValue(attacker, 22666, 3)
  671. addEvent(function() setPlayerStorageValue(attacker, 22666, 0) end, 15 * 1000)
  672. end
  673. end
  674. end
  675. if isPlayer(getCreatureMaster(cid)) and isSummon(cid) then
  676. local TierHarden = {
  677. [64] = {chance = Harden1},
  678. [65] = {chance = Harden2},
  679. [66] = {chance = Harden3},
  680. [67] = {chance = Harden4},
  681. [68] = {chance = Harden5},
  682. [69] = {chance = Harden6},
  683. [70] = {chance = Harden7},
  684. }
  685. local TierEle = {
  686. [78] = {chance = Elemen1},
  687. [79] = {chance = Elemen2},
  688. [80] = {chance = Elemen3},
  689. [81] = {chance = Elemen4},
  690. [82] = {chance = Elemen5},
  691. [83] = {chance = Elemen6},
  692. [84] = {chance = Elemen7},
  693. }
  694. local Tier = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "heldx")
  695. if Tier and Tier > 63 and Tier < 71 and getPlayerStorageValue(cid, 22666) ~= 4 then
  696. if math.random(1,100) <= TierHarden[Tier].chance then
  697. docastspell(cid, "Harden")
  698. setPlayerStorageValue(cid, 22666, 4)
  699. addEvent(function() setPlayerStorageValue(cid, 22666, 0) end, 8 * 1000)
  700. end
  701. end
  702. end
  703. end
  704. --- X-Agility/Strafe/Rage/Harden ---
  705. if Tier and Tier > 77 and Tier < 85 and getPlayerStorageValue(cid, 22666) ~= 5 then
  706. if math.random(1,100) <= TierEle[Tier].chance then
  707. docastspell(cid, "Elemental", -1000, -5000)
  708. setPlayerStorageValue(cid, 22666, 5)
  709. addEvent(function() setPlayerStorageValue(cid, 22666, 0) end, 1 * 1800)
  710. end
  711. end
  712.  
  713.  
  714. --------------Passiva Lifesteal Clobat------------
  715. if combat == COMBAT_PHYSICALDAMAGE then
  716. if getCreatureName(attacker) == "Golbat" then --alterado v1.4
  717. doCreatureAddHealth(attacker, math.floor(valor))
  718. doSendAnimatedText(getThingPos(attacker), "+ "..math.floor(valor), 30)
  719. end
  720. end
  721. --------------------------------------------
  722.  
  723. --------------Passiva Lifesteal Clobat------------
  724. if combat == COMBAT_PHYSICALDAMAGE then
  725. if getCreatureName(attacker) == "Zubat" then --alterado v1.4
  726. doCreatureAddHealth(attacker, math.floor(valor))
  727. doSendAnimatedText(getThingPos(attacker), "+ "..math.floor(valor), 30)
  728. end
  729. end
  730. --------------------------------------------
  731.  
  732. --------------Passiva Lifesteal Clobat------------
  733. if combat == COMBAT_PHYSICALDAMAGE then
  734. if getCreatureName(attacker) == "Shiny Crobat" then --alterado v1.4
  735. doCreatureAddHealth(attacker, math.floor(valor))
  736. doSendAnimatedText(getThingPos(attacker), "+ "..math.floor(valor), 30)
  737. end
  738. end
  739. --------------------------------------------
  740.  
  741. --------------Passiva Lifesteal Clobat------------
  742. if combat == COMBAT_PHYSICALDAMAGE then
  743. if getCreatureName(attacker) == "Shiny Golbat" then --alterado v1.4
  744. doCreatureAddHealth(attacker, math.floor(valor))
  745. doSendAnimatedText(getThingPos(attacker), "+ "..math.floor(valor), 30)
  746. end
  747. end
  748. --------------------------------------------
  749.  
  750. --------------Passiva Lifesteal Clobat------------
  751. if combat == COMBAT_PHYSICALDAMAGE then
  752. if getCreatureName(attacker) == "Shiny Zubat" then --alterado v1.4
  753. doCreatureAddHealth(attacker, math.floor(valor))
  754. doSendAnimatedText(getThingPos(attacker), "+ "..math.floor(valor), 30)
  755. end
  756. end
  757. --------------------------------------------
  758. valor = math.abs(valor) --alterado v1.9
  759. if isSummon(cid) and valor >= getCreatureHealth(cid) then
  760. onPokeHealthChange(getCreatureMaster(cid), true)
  761. elseif isSummon(cid) then
  762. onPokeHealthChange(getCreatureMaster(cid))
  763. end
  764. if isSummon(attacker) then
  765. if combat == COMBAT_PHYSICALDAMAGE then
  766. doTargetCombatHealth(getCreatureMaster(attacker), cid, PHYSICALDAMAGE, -valor, -valor, 255)
  767. addEvent(doDoubleHit, 1000, attacker, cid, valor, races) --alterado v1.6
  768. else
  769. doTargetCombatHealth(getCreatureMaster(attacker), cid, damageCombat, -valor, -valor, 255)
  770. end
  771. else
  772. if combat ~= COMBAT_PHYSICALDAMAGE then
  773. doCreatureAddHealth(cid, -math.abs(valor), 3, combats[damageCombat].cor)
  774. else
  775. doCreatureAddHealth(cid, -math.abs(valor), 3, races[getMonsterInfo(getCreatureName(cid)).race].cor)
  776. addEvent(doDoubleHit, 1000, attacker, cid, valor, races) --alterado v1.6
  777. end
  778.  
  779. if isSummon(cid) and valor ~= 0 then
  780. --addEvent(sendPlayerDmgMsg, 5, getCreatureMaster(cid), "Seu "..getCreatureName(cid).." perdeu "..valor.." de vida pelo attack do "..getSomeoneDescription(attacker)..".")
  781. end
  782.  
  783. end
  784.  
  785. if damageCombat == FIREDAMAGE and not isBurning(cid) then
  786. -- Helfire --
  787. local hellfire = {}
  788. if isSummon(attacker) and isPlayer(getCreatureMaster(attacker)) then
  789. local ball = getPlayerSlotItem(getCreatureMaster(attacker), 8)
  790. local TierArray = {22, 23, 24, 25, 26, 27, 28}
  791. local Tiers = {
  792. [22] = {bonus = HellBonus1},
  793. [23] = {bonus = HellBonus2},
  794. [24] = {bonus = HellBonus3},
  795. [25] = {bonus = HellBonus4},
  796. [26] = {bonus = HellBonus5},
  797. [27] = {bonus = HellBonus6},
  798. [28] = {bonus = HellBonus7},
  799. }
  800. local Tier = getItemAttribute(ball.uid, "heldx")
  801. if Tier and Tier > 21 and Tier < 29 then
  802. hellfire = Tiers[Tier].bonus
  803. else
  804. hellfire = 1
  805. end
  806. end
  807. -- Hellfire --
  808. local ret = {}
  809. ret.id = cid
  810. ret.cd = math.random(5, 12)
  811. ret.check = getPlayerStorageValue(cid, conds["Burn"])
  812. ret.damage = isSummon(attacker) and (getMasterLevel(attacker)+getPokemonBoost(attacker)) * hellfire or getPokemonLevel(attacker)
  813. ret.cond = "Burn"
  814.  
  815. doCondition2(ret)
  816. elseif damageCombat == POISONDAMAGE and not isPoisoned(cid) then
  817. -- Poison --
  818. local xpoison = {}
  819. if isSummon(attacker) and isPlayer(getCreatureMaster(attacker)) then
  820. local ball = getPlayerSlotItem(getCreatureMaster(attacker), 8)
  821. local TierArray = {29, 30, 31, 32, 33, 34, 35}
  822. local Tiers = {
  823. [29] = {bonus = PoisonBonus1},
  824. [30] = {bonus = PoisonBonus2},
  825. [31] = {bonus = PoisonBonus3},
  826. [32] = {bonus = PoisonBonus4},
  827. [33] = {bonus = PoisonBonus5},
  828. [34] = {bonus = PoisonBonus6},
  829. [35] = {bonus = PoisonBonus7},
  830. }
  831. local Tier = getItemAttribute(ball.uid, "heldx")
  832. if Tier and Tier > 28 and Tier < 36 then
  833. xpoison = Tiers[Tier].bonus
  834. elseif not isInArray(TierArray, getItemAttribute(ball.uid, "heldx")) then
  835. xpoison = 1
  836. end
  837. end
  838. -- Poison --
  839. local ret = {}
  840. ret.id = cid
  841. ret.cd = math.random(6, 15)
  842. ret.check = getPlayerStorageValue(cid, conds["Poison"])
  843. local lvl = isSummon(attacker) and (getMasterLevel(attacker)) * xpoison or getPokemonLevel(attacker)
  844. ret.damage = math.floor((getPokemonLevel(attacker)+lvl)/2)
  845. ret.cond = "Poison"
  846.  
  847. doCondition2(ret)
  848. end
  849. --[[---------------CD BAR-----------------------
  850. if isSummon(cid) then
  851. doCreatureExecuteTalkAction(getCreatureMaster(cid), "/pokeread")
  852. end ]]
  853. ------------------------------------POTIONS-------------------------------------------
  854. if isSummon(cid) and type == STATSCHANGE_HEALTHLOSS then
  855. if getPlayerStorageValue(cid, 173) >= 1 then
  856. if damageCombat ~= BURNEDDAMAGE and damageCombat ~= POISONEDDAMAGE then
  857. setPlayerStorageValue(cid, 173, -1) --alterado v1.6
  858. doSendAnimatedText(getThingPos(cid), "LOST HEAL", 144)
  859. end
  860. end
  861. end
  862. ----------------------------------------PASSIVAS------------------------------------- --alterado v1.6 \/ todas as passivas agora estao em lib/pokemon moves.lua
  863. -------------------------------------------Counter Helix------------------------------------
  864. if passivesChances["Helix"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Helix"][getCreatureName(cid)] then
  865. docastspell(cid, "Counter Helix")
  866. end
  867. -------------------------------------------Lava-Counter----------------------------
  868. if passivesChances["Lava"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Lava"][getCreatureName(cid)] then
  869. docastspell(cid, "Lava-Counter")
  870. end
  871. -------------------------------------------Shock-Counter----------------------------
  872. if passivesChances["Shock"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Shock"][getCreatureName(cid)] then
  873. docastspell(cid, "Shock-Counter")
  874. end
  875. -------------------------------------------Bone Spin----------------------------
  876. if passivesChances["Bone"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Bone"][getCreatureName(cid)] then
  877. docastspell(cid, "Bone-Spin")
  878. end
  879. ---------------------------------------Stunning Confusion-----------------------------------------
  880. if passivesChances["Stunning"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Stunning"][getCreatureName(cid)] then
  881. docastspell(cid, "Stunning Confusion")
  882. end
  883. --------------------------------------Electric Charge---------------------------------------------
  884. if passivesChances["Electric Charge"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Electric Charge"][getCreatureName(cid)] then
  885. docastspell(cid, "Electric Charge", 0, 0)
  886. end
  887. -------------------------------------Melody------------------------------------
  888. if passivesChances["Melody"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Melody"][getCreatureName(cid)] then
  889. docastspell(cid, "Melody")
  890. end
  891. ------------------------------------- Dragon Fury / Fury ---------------------------------------
  892. if passivesChances["Dragon Fury"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Dragon Fury"][getCreatureName(cid)] then
  893. docastspell(cid, "Dragon Fury", 0, 0)
  894. end
  895. ------------------------------------- Mega Drain ---------------------------------------
  896. if passivesChances["Mega Drain"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Mega Drain"][getCreatureName(cid)] then
  897. docastspell(cid, "Mega Drain")
  898. end
  899. ------------------------------------- Spores Reaction ---------------------------------------
  900. if passivesChances["Spores Reaction"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Spores Reaction"][getCreatureName(cid)] then
  901. docastspell(cid, "Spores Reaction")
  902. end
  903. ------------------------------------ Amnesia ----------------------------------------
  904. if passivesChances["Amnesia"][getCreatureName(cid)] and math.random(1, 100) <= passivesChances["Amnesia"][getCreatureName(cid)] then
  905. docastspell(cid, "Amnesia", 0, 0)
  906. end
  907. ----------------------------------- Zen Mind -----------------------------------------
  908. if passivesChances["Zen Mind"][getCreatureName(cid)] and isWithCondition(cid) and math.random(1, 100) <= passivesChances["Zen Mind"][getCreatureName(cid)] then
  909. docastspell(cid, "Zen Mind", 0, 0)
  910. end
  911. ---------------------------------- Mirror Coat ---------------------------------------
  912. if passivesChances["Mirror Coat"][getCreatureName(cid)] and math.random(1, 80) <= passivesChances["Mirror Coat"][getCreatureName(cid)] then
  913. docastspell(cid, "Mirror Coat", 0, 0)
  914. end
  915. --------------------------------- Illusion -----------------------------------------
  916. return false
  917. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement