Advertisement
Guest User

Untitled

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