Advertisement
Guest User

newStatus

a guest
Jul 20th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.24 KB | None | 0 0
  1. conds = {
  2. ["Slow"] = 3890,
  3. ["Confusion"] = 3891,
  4. ["Burn"] = 3892,
  5. ["Poison"] = 3893,
  6. ["Fear"] = 3894,
  7. ["Stun"] = 3895,
  8. ["Paralyze"] = 3896, --alterado v1.6 \/ peguem o script todo!
  9. ["Leech"] = 3897,
  10. ["Buff1"] = 3898,
  11. ["Buff2"] = 3899,
  12. ["Buff3"] = 3900,
  13. ["Miss"] = 32659,
  14. ["Silence"] = 32698,
  15. ["Sleep"] = 98271,
  16. }
  17.  
  18. injuries2 = {
  19. [1] = {n = "slow", m = 3890},
  20. [2] = {n = "confuse", m = 3891},
  21. [3] = {n = "burn", m = 3892},
  22. [4] = {n = "poison", m = 3893},
  23. [5] = {n = "fear", m = 3894},
  24. [6] = {n = "stun", m = 3895},
  25. [7] = {n = "paralyze", m = 3896},
  26. [8] = {n = "leech", m = 3897},
  27. [9] = {n = "Buff1", m = 3898},
  28. [10] = {n = "Buff2", m = 3899},
  29. [11] = {n = "Buff3", m = 3900},
  30. [12] = {n = "miss", m = 32659},
  31. [13] = {n = "silence", m = 32698},
  32. [14] = {n = "sleep", m = 98271},
  33. }
  34.  
  35. Buffs = {
  36. [1] = {"Buff1", 3898},
  37. [2] = {"Buff2", 3899},
  38. [3] = {"Buff3", 3900},
  39. }
  40.  
  41. paralizeArea2 = createConditionObject(CONDITION_PARALYZE)
  42. setConditionParam(paralizeArea2, CONDITION_PARAM_TICKS, 50000)
  43. setConditionFormula(paralizeArea2, -0.63, -0.63, -0.63, -0.63)
  44.  
  45. local roardirections = {
  46. [NORTH] = {SOUTH},
  47. [SOUTH] = {NORTH},
  48. [WEST] = {EAST}, --edited sistema de roar
  49. [EAST] = {WEST}}
  50.  
  51. function doSendSleepEffect(cid)
  52. if not isCreature(cid) or not isSleeping(cid) then return true end
  53. doSendMagicEffect(getThingPos(cid), 32)
  54. addEvent(doSendSleepEffect, 1500, cid)
  55. end
  56.  
  57. local outFurys = {
  58. ["Shiny Charizard"] = {outFury = 1073},
  59. ["Elder Charizard"] = {outFury = 1073},
  60. ["Shiny Blastoise"] = {outFury = 1074},
  61. ["Ancient Blastoise"] = {outFury = 1074},
  62. ["Ditto"] = {outFury = null},
  63. }
  64.  
  65. local outImune = {
  66. ["Camouflage"] = 1445,
  67. ["Acid Armor"] = 1453,
  68. ["Iron Defense"] = 1401,
  69. ["Minimize"] = 1455,
  70. ["Future Sight"] = 1446,
  71. ["Psychic Sight"] = 1536,
  72. ["Heal Bell"] = 946,
  73. }
  74.  
  75. local function transBack(cid)
  76. if isCreature(cid) then
  77. if getPlayerStorageValue(cid, 974848) >= 1 then
  78. setPlayerStorageValue(cid, 974848, 0)
  79. doRemoveCondition(cid, CONDITION_OUTFIT)
  80. end
  81. end
  82. end
  83.  
  84. function doCondition2(ret)
  85. --
  86. function doMiss2(cid, cd, eff, check, spell)
  87. local stg = conds["Miss"]
  88. if not isCreature(cid) then return true end --is creature?
  89. if getPlayerStorageValue(cid, 21100) >= 1 and getPlayerStorageValue(cid, stg) <= -1 then return true end --alterado v1.6 reflect
  90. if not canDoMiss(cid, spell) then return true end
  91. if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then
  92. setPlayerStorageValue(cid, stg, cd) --allterado v1.8
  93. return true
  94. end
  95. if not check and getPlayerStorageValue(cid, stg) >= 1 then
  96. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)
  97. else
  98. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)
  99. end
  100.  
  101. local a = getPlayerStorageValue(cid, stg)
  102.  
  103. if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then
  104. local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
  105. doItemSetAttribute(item.uid, "miss", a)
  106. doItemSetAttribute(item.uid, "missEff", eff)
  107. doItemSetAttribute(item.uid, "missSpell", spell)
  108. end
  109.  
  110. if a <= -1 then
  111. setPlayerStorageValue(cid, stg, -1)
  112. return true
  113. end
  114.  
  115. doSendMagicEffect(getThingPos(cid), eff)
  116. addEvent(doMiss2, 1000, cid, -1, eff, a, spell)
  117. end
  118.  
  119. function doSilence2(cid, cd, eff, check)
  120. local stg = conds["Silence"]
  121. if not isCreature(cid) then return true end --is creature?
  122. if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then
  123. setPlayerStorageValue(cid, stg, cd) --allterado v1.8
  124. return true
  125. end
  126. if not check and getPlayerStorageValue(cid, stg) >= 1 then
  127. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)
  128. else
  129. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)
  130. end
  131.  
  132. local a = getPlayerStorageValue(cid, stg)
  133.  
  134. if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then
  135. local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
  136. doItemSetAttribute(item.uid, "silence", a)
  137. doItemSetAttribute(item.uid, "silenceEff", eff)
  138. end
  139.  
  140. if a <= -1 then
  141. setPlayerStorageValue(cid, stg, -1)
  142. return true
  143. end
  144.  
  145. doSendMagicEffect(getThingPos(cid), eff)
  146. addEvent(doSilence2, 1000, cid, -1, eff, a)
  147. end
  148.  
  149. function doSlow2(cid, cd, eff, check, first)
  150. local stg = conds["Slow"]
  151. if not isCreature(cid) then return true end --is creature?
  152. if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then
  153. setPlayerStorageValue(cid, stg, cd) --allterado v1.8
  154. return true
  155. end
  156. if not check and getPlayerStorageValue(cid, stg) >= 1 then
  157. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)
  158. else
  159. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)
  160. end
  161.  
  162. local a = getPlayerStorageValue(cid, stg)
  163.  
  164. if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then
  165. local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
  166. doItemSetAttribute(item.uid, "slow", a)
  167. doItemSetAttribute(item.uid, "slowEff", eff)
  168. end
  169.  
  170. if a <= -1 then
  171. doRemoveCondition(cid, CONDITION_PARALYZE)
  172. if not isSleeping(cid) and not isParalyze(cid) then
  173. addEvent(doRegainSpeed, 50, cid) --alterado
  174. end
  175. setPlayerStorageValue(cid, stg, -1)
  176. return true
  177. end
  178.  
  179. if first then
  180. doAddCondition(cid, paralizeArea2)
  181. end
  182.  
  183. doSendMagicEffect(getThingPos(cid), eff)
  184. addEvent(doSlow2, 1000, cid, -1, eff, a)
  185. end
  186.  
  187. function doConfusion2(cid, cd, check)
  188. local stg = conds["Confusion"]
  189. if not isCreature(cid) then return true end --is creature?
  190. if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then
  191. setPlayerStorageValue(cid, stg, cd) --allterado v1.8
  192. return true
  193. end
  194. if not check and getPlayerStorageValue(cid, stg) >= 1 then
  195. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)
  196. else
  197. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)
  198. end
  199.  
  200. local a = getPlayerStorageValue(cid, stg)
  201.  
  202. if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then
  203. local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
  204. doItemSetAttribute(item.uid, "confuse", a)
  205. end
  206.  
  207. if a <= -1 then
  208. if getCreatureCondition(cid, CONDITION_PARALYZE) == true then
  209. doRemoveCondition(cid, CONDITION_PARALYZE)
  210. addEvent(doAddCondition, 10, cid, paralizeArea2)
  211. end
  212. if not isSleeping(cid) and not isParalyze(cid) then
  213. doRegainSpeed(cid) --alterado
  214. end
  215. setPlayerStorageValue(cid, stg, -1)
  216. return true
  217. end
  218.  
  219. if math.random(1, 6) >= 4 then
  220. doSendMagicEffect(getThingPos(cid), 31)
  221. end
  222.  
  223. local isTarget = isSummon(cid) and getCreatureTarget(getCreatureMaster(cid)) or getCreatureTarget(cid)
  224. if isCreature(isTarget) and not isSleeping(cid) and not isParalyze(cid) and getPlayerStorageValue(cid, 654878) <= 0 then --alterado v1.6
  225. doChangeSpeed(cid, -getCreatureSpeed(cid))
  226. doChangeSpeed(cid, 100)
  227. doPushCreature(cid, math.random(0, 3), 1, 0) --alterado v1.6
  228. doChangeSpeed(cid, -100)
  229. end
  230.  
  231. local pos = getThingPos(cid)
  232. addEvent(doSendMagicEffect, math.random(0, 450), pos, 31)
  233.  
  234. addEvent(doConfusion2, 1000, cid, -1, a)
  235. end
  236.  
  237. function doBurn2(cid, cd, check, damage)
  238. local stg = conds["Burn"]
  239. if not isCreature(cid) then return true end --is creature?
  240. if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then
  241. setPlayerStorageValue(cid, stg, cd) --allterado v1.8
  242. return true
  243. end
  244. if not check and getPlayerStorageValue(cid, stg) >= 1 then
  245. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)
  246. else
  247. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)
  248. end
  249.  
  250. local a = getPlayerStorageValue(cid, stg)
  251.  
  252. if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then
  253. local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
  254. doItemSetAttribute(item.uid, "burn", a)
  255. doItemSetAttribute(item.uid, "burndmg", damage)
  256. end
  257.  
  258. if a <= -1 then
  259. setPlayerStorageValue(cid, stg, -1)
  260. return true
  261. end
  262.  
  263. doCreatureAddHealth(cid, -damage, 15, COLOR_BURN)
  264. addEvent(doBurn2, 3500, cid, -1, a, damage)
  265. end
  266.  
  267. function doPoison2(cid, cd, check, damage)
  268. local stg = conds["Poison"]
  269. if not isCreature(cid) then return true end --is creature?
  270. ----------
  271. if isSummon(cid) or ehMonstro(cid) and pokes[getCreatureName(cid)] then --alterado v1.6
  272. local type = pokes[getCreatureName(cid)].type
  273. local type2 = pokes[getCreatureName(cid)].type2
  274. if isInArray({"poison", "steel"}, type) or isInArray({"poison", "steel"}, type2) then
  275. return true
  276. end
  277. end
  278. ---------
  279. if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then
  280. setPlayerStorageValue(cid, stg, cd) --allterado v1.8
  281. return true
  282. end
  283. if not check and getPlayerStorageValue(cid, stg) >= 1 then
  284. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)
  285. else
  286. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)
  287. end
  288.  
  289. local a = getPlayerStorageValue(cid, stg)
  290.  
  291. if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then
  292. local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
  293. doItemSetAttribute(item.uid, "poison", a)
  294. doItemSetAttribute(item.uid, "poisondmg", damage)
  295. end
  296.  
  297. if a <= -1 or getCreatureHealth(cid) == 1 then
  298. setPlayerStorageValue(cid, stg, -1)
  299. return true
  300. end
  301.  
  302. local dano = getCreatureHealth(cid)-damage <= 0 and getCreatureHealth(cid)-1 or damage
  303. doCreatureAddHealth(cid, -dano, 8, COLOR_GRASS)
  304.  
  305. addEvent(doPoison2, 1500, cid, -1, a, damage)
  306. end
  307.  
  308. function doFear2(cid, cd, check, skill)
  309. local stg = conds["Fear"]
  310. if not isCreature(cid) then return true end --is creature?
  311. if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then
  312. setPlayerStorageValue(cid, stg, cd) --allterado v1.8
  313. return true
  314. end
  315. if not check and getPlayerStorageValue(cid, stg) >= 1 then
  316. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)
  317. else
  318. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)
  319. end
  320.  
  321. local a = getPlayerStorageValue(cid, stg)
  322.  
  323. if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then
  324. local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
  325. doItemSetAttribute(item.uid, "fear", a)
  326. doItemSetAttribute(item.uid, "fearSkill", skill)
  327. end
  328.  
  329. if a <= -1 then
  330. if getCreatureCondition(cid, CONDITION_PARALYZE) == true then
  331. doRemoveCondition(cid, CONDITION_PARALYZE)
  332. addEvent(doAddCondition, 10, cid, paralizeArea2)
  333. end
  334. if not isSleeping(cid) and not isParalyze(cid) then
  335. doRegainSpeed(cid) --alterado
  336. end
  337. setPlayerStorageValue(cid, stg, -1)
  338. return true
  339. end
  340.  
  341. if skill == "Roar" then
  342. eff = 244
  343. else --edited Roar
  344. eff = 139
  345. end
  346.  
  347. if math.random(1, 6) >= 4 then
  348. doSendMagicEffect(getThingPos(cid), eff)
  349. end
  350.  
  351. local isTarget = isSummon(cid) and getCreatureTarget(getCreatureMaster(cid)) or getCreatureTarget(cid)
  352. if isCreature(isTarget) and not isSleeping(cid) and not isParalyze(cid) and getPlayerStorageValue(cid, 654878) <= 0 then --alterado v1.6
  353. local dir = getCreatureDirectionToTarget(cid, isTarget)
  354. doChangeSpeed(cid, -getCreatureSpeed(cid))
  355. doChangeSpeed(cid, 250)
  356. doPushCreature(cid, roardirections[dir][1], 1, 0) --alterado v1.6
  357. doChangeSpeed(cid, -250)
  358. end
  359.  
  360. local pos = getThingPos(cid)
  361. addEvent(doSendMagicEffect, math.random(0, 450), pos, eff)
  362.  
  363. addEvent(doFear2, 400, cid, -1, a, skill)
  364. end
  365.  
  366. function doStun2(cid, cd, eff, check, spell)
  367. local stg = conds["Stun"]
  368. if not isCreature(cid) then return true end --is creature?
  369. if not canDoMiss(cid, spell) then return true end
  370. if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then
  371. setPlayerStorageValue(cid, stg, cd) --allterado v1.8
  372. return true
  373. end
  374. if not check and getPlayerStorageValue(cid, stg) >= 1 then
  375. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)
  376. else
  377. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)
  378. end
  379.  
  380. local a = getPlayerStorageValue(cid, stg)
  381.  
  382. if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then
  383. local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
  384. doItemSetAttribute(item.uid, "stun", a)
  385. doItemSetAttribute(item.uid, "stunEff", eff)
  386. doItemSetAttribute(item.uid, "stunSpell", spell)
  387. end
  388.  
  389. if a <= -1 then
  390. doRemoveCondition(cid, CONDITION_PARALYZE)
  391. if not isSleeping(cid) and not isParalyze(cid) then
  392. addEvent(doRegainSpeed, 50, cid) --alterado
  393. end
  394. setPlayerStorageValue(cid, stg, -1)
  395. return true
  396. end
  397.  
  398. if getCreatureCondition(cid, CONDITION_PARALYZE) == false then
  399. doAddCondition(cid, paralizeArea2)
  400. end
  401. doSendMagicEffect(getThingPos(cid), eff)
  402. addEvent(doStun2, 1000, cid, -1, eff, a, spell)
  403. end
  404.  
  405. function doParalyze2(cid, cd, eff, check, first)
  406. local stg = conds["Paralyze"]
  407. if not isCreature(cid) then return true end --is creature?
  408. if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then
  409. setPlayerStorageValue(cid, stg, cd) --allterado v1.8
  410. return true
  411. end
  412. if not check and getPlayerStorageValue(cid, stg) >= 1 then
  413. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)
  414. else
  415. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)
  416. end
  417.  
  418. local a = getPlayerStorageValue(cid, stg)
  419.  
  420. if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then
  421. local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
  422. doItemSetAttribute(item.uid, "paralyze", a)
  423. doItemSetAttribute(item.uid, "paralyzeEff", eff)
  424. end
  425.  
  426. if a <= -1 then
  427. if isPlayer(cid) then
  428. if not isSleeping(cid) then --alterado
  429. mayNotMove(cid, false)
  430. end
  431. else
  432. if getCreatureCondition(cid, CONDITION_PARALYZE) == true then
  433. doRemoveCondition(cid, CONDITION_PARALYZE)
  434. addEvent(doAddCondition, 10, cid, paralizeArea2)
  435. end
  436. if not isSleeping(cid) then
  437. doRegainSpeed(cid) --alterado
  438. end
  439. end
  440. setPlayerStorageValue(cid, stg, -1)
  441. return true
  442. end
  443.  
  444. if isPlayer(cid) then
  445. mayNotMove(cid, true)
  446. else --alterado v1.6
  447. doChangeSpeed(cid, -2000)
  448. end
  449. doSendMagicEffect(getThingPos(cid), eff)
  450. addEvent(doParalyze2, 1000, cid, -1, eff, a, false)
  451. end
  452.  
  453. function doSleep2(cid, cd, check, first)
  454. local stg = conds["Sleep"]
  455. if not isCreature(cid) then return true end --is creature?
  456. if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then
  457. setPlayerStorageValue(cid, stg, cd) --allterado v1.8
  458. return true
  459. end
  460. if not isSleeping(cid) then
  461. addEvent(doSendSleepEffect, 500, cid)
  462. end
  463.  
  464. if not check and getPlayerStorageValue(cid, stg) >= 1 then
  465. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)
  466. else
  467. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)
  468. end
  469.  
  470. local a = getPlayerStorageValue(cid, stg)
  471.  
  472. if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then
  473. local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
  474. doItemSetAttribute(item.uid, "sleep", a)
  475. end
  476.  
  477. if a <= -1 then
  478. if not isPlayer(cid) then
  479. local dittoStg = getPlayerStorageValue(cid, 1010)
  480. if getCreatureName(cid) == "Ditto" and isSummon(cid) and tostring(dittoStg) and dittoStg ~= "Ditto" then
  481. doSetCreatureOutfit(cid, {lookType = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "transOutfit")}, -1)
  482. else
  483. doRemoveCondition(cid, CONDITION_OUTFIT)
  484. end
  485. if getPlayerStorageValue(cid, 625877) ~= -1 then
  486. doSetCreatureOutfit(cid, {lookType = getPlayerStorageValue(cid, 625877)}, -1) --alterado v1.6
  487. end
  488. end
  489. if isPlayer(cid) then
  490. if not isParalyze(cid) then
  491. mayNotMove(cid, false) --alterado
  492. end
  493. else
  494. if getCreatureCondition(cid, CONDITION_PARALYZE) == true then
  495. doRemoveCondition(cid, CONDITION_PARALYZE)
  496. addEvent(doAddCondition, 10, cid, paralizeArea2)
  497. end
  498. if not isParalyze(cid) then
  499. doRegainSpeed(cid) --alterado
  500. end
  501. end
  502. setPlayerStorageValue(cid, stg, -1)
  503. return true
  504. end
  505.  
  506. if first then
  507. if getCreatureName(cid) == "Ursaring" and getCreatureCondition(cid, CONDITION_OUTFIT) == true then
  508.  
  509. elseif not isPlayer(cid) then
  510. if isInArray({604, 605, 1015, 1016, 1183, 1184}, getCreatureOutfit(cid).lookType) then
  511. Info = 0 --alterado v1.6
  512. else
  513. Info = getMonsterInfo(getCreatureName(cid)).lookCorpse
  514. end
  515. local look = getCreatureOutfit(cid)
  516. ---------
  517. local dittoStg = getPlayerStorageValue(cid, 1010)
  518. if getCreatureName(cid) == "Ditto" and isSummon(cid) and tostring(dittoStg) and dittoStg ~= "Ditto" then
  519. local InfoDitto = getMonsterInfo(tostring(dittoStg)).lookCorpse
  520. if InfoDitto ~= 0 and look.lookType ~= 0 then
  521. --doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(tostring(dittoStg)).lookCorpse}, -1)
  522. end
  523. else
  524. if getCreatureName(cid) == "Shiny Golem" and getCreatureOutfit(cid).lookType == 1403 then
  525. doRemoveCondition(cid, CONDITION_OUTFIT)
  526. elseif Info ~= 0 and look.lookType ~= 0 then
  527. --doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(getCreatureName(cid)).lookCorpse}, -1)
  528. end
  529. end
  530. end
  531. end
  532. --alterado v1.6
  533. if isPlayer(cid) then
  534. mayNotMove(cid, true)
  535. else
  536. doChangeSpeed(cid, -getCreatureSpeed(cid))
  537. end
  538. addEvent(doSleep2, 1000, cid, -1, a, false)
  539. end
  540.  
  541. function doLeech2(cid, attacker, cd, check, damage)
  542. local stg = conds["Leech"]
  543. if not isCreature(cid) then return true end --is creature?
  544. if attacker ~= 0 and not isCreature(attacker) then return true end --is creature?
  545. if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then
  546. setPlayerStorageValue(cid, stg, cd) --allterado v1.8
  547. return true
  548. end
  549. if not check and getPlayerStorageValue(cid, stg) >= 1 then
  550. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)
  551. else
  552. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)
  553. end
  554.  
  555. local a = getPlayerStorageValue(cid, stg)
  556.  
  557. if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then
  558. local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
  559. doItemSetAttribute(item.uid, "leech", a)
  560. doItemSetAttribute(item.uid, "leechdmg", damage)
  561. end
  562.  
  563. if a <= -1 then
  564. setPlayerStorageValue(cid, stg, -1)
  565. return true
  566. end
  567.  
  568. local life = getCreatureHealth(cid)
  569. ------
  570. doCreatureAddHealth(cid, -damage)
  571. doSendAnimatedText(getThingPos(cid), "-"..damage.."", 144)
  572. doSendMagicEffect(getThingPos(cid), 45)
  573. ------
  574. local newlife = life - getCreatureHealth(cid)
  575. if newlife >= 1 and attacker ~= 0 then
  576. doSendMagicEffect(getThingPos(attacker), 14)
  577. doCreatureAddHealth(attacker, newlife)
  578. doSendAnimatedText(getThingPos(attacker), "+"..newlife.."", 32)
  579. end
  580. addEvent(doLeech2, 2000, cid, attacker, -1, a, damage)
  581. end
  582.  
  583. function doBuff2(cid, cd, eff, check, buff, first, attr)
  584. if not isCreature(cid) then return true end --is creature?
  585. ---------------------
  586. local atributo = attr and attr or ""
  587. if first and atributo == "" then
  588. for i = 1, 3 do
  589. if getPlayerStorageValue(cid, Buffs[i][2]) <= 0 then
  590. atributo = Buffs[i][1]
  591. break
  592. end
  593. end
  594. end
  595. if atributo == "" then return true end
  596. if ehMonstro(cid) then atributo = "Buff1" end
  597. ----------------------
  598. local stg = conds[atributo]
  599.  
  600. if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x
  601.  
  602. if not check and getPlayerStorageValue(cid, stg) >= 1 then
  603. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)
  604. else
  605. setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)
  606. end
  607.  
  608. local a = getPlayerStorageValue(cid, stg)
  609.  
  610. if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then
  611. local item = getPlayerSlotItem(getCreatureMaster(cid), 8)
  612. doItemSetAttribute(item.uid, atributo, a)
  613. doItemSetAttribute(item.uid, atributo.."eff", eff)
  614. doItemSetAttribute(item.uid, atributo.."skill", buff)
  615. end
  616.  
  617. if a <= -1 then --alterado v1.6
  618. if isInArray({"Psychic Sight", "Heal Bell", "Future Sight", "Camouflage", "Acid Armor", "Iron Defense", "Minimize", "Bug Fighter", "Ancient Fury"}, buff) then
  619. if not isSleeping(cid) then
  620. doRemoveCondition(cid, CONDITION_OUTFIT)
  621. end
  622. setPlayerStorageValue(cid, 9658783, -1)
  623. setPlayerStorageValue(cid, 625877, -1) --alterado v1.6
  624. end
  625. if isInArray({"Eruption", "Elecball", "Strafe", "Agility", "Ancient Fury", "War Dog", "Fighter Spirit", "Furious Legs", "Ultimate Champion", "Bug Fighter"}, buff) then
  626. setPlayerStorageValue(cid, 374896, -1) --alterado v1.6
  627. end
  628. setPlayerStorageValue(cid, stg, -1)
  629. return true
  630. end
  631.  
  632. doSendMagicEffect(getThingPos(cid), eff)
  633.  
  634. if first then
  635. if buff == "Strafe" or buff == "Agility" then
  636. setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6
  637. doRaiseStatus(cid, 0, 0, 100, a)
  638. elseif buff == "Eruption" or buff == "Elecball" then
  639. setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6
  640. doRaiseStatus(cid, 2, 0, 150, a)
  641. elseif buff == "Tailwind" then
  642. doRaiseStatus(cid, 0, 0, 200, a)
  643. elseif buff == "Rage" then
  644. doRaiseStatus(cid, 2, 0, 0, a)
  645. elseif buff == "Harden" then
  646. doRaiseStatus(cid, 0, 2, 0, a)
  647. elseif buff == "Calm Mind" then
  648. doRaiseStatus(cid, 0, 2, 0, a)
  649. elseif buff == "Ancient Fury" then
  650. doSetCreatureOutfit(cid, {lookType = outFurys[getCreatureName(cid)].outFury}, a*1000)
  651. setPlayerStorageValue(cid, 374896, 1) --velo atk
  652. if getCreatureName(cid) == "Shiny Charizard" or getCreatureName(cid) == "Elder Charizard" then
  653. doRaiseStatus(cid, 2, 0, 0, a) --atk melee --alterado v1.6
  654. else
  655. doRaiseStatus(cid, 0, 2, 0, a) --def
  656. end
  657. setPlayerStorageValue(cid, 625877, outFurys[getCreatureName(cid)].outFury) --alterado v1.6
  658. elseif buff == "War Dog" then
  659. doRaiseStatus(cid, 1.5, 1.5, 0, a)
  660. setPlayerStorageValue(cid, 374896, 1) --velo atk
  661. elseif buff == "Rest" then
  662. doSleep2(cid, cd, getPlayerStorageValue(cid, conds["Sleep"]), true)
  663. doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
  664. elseif isInArray({"Fighter Spirit", "Furious Legs", "Ultimate Champion"}, buff) then
  665. doRaiseStatus(cid, 1.5, 0, 0, a) --atk melee --alterado v1.6
  666. setPlayerStorageValue(cid, 374896, 1) --velo atk
  667. addEvent(setPlayerStorageValue, a*1000, cid, 465987, -1)
  668. elseif isInArray({"Psychic Sight", "Heal Bell", "Future Sight", "Camouflage", "Acid Armor", "Iron Defense", "Minimize"}, buff) then
  669. doSetCreatureOutfit(cid, {lookType = outImune[buff]}, -1)
  670. setPlayerStorageValue(cid, 9658783, 1)
  671. setPlayerStorageValue(cid, 625877, outImune[buff]) --alterado v1.6
  672. elseif buff == "Bug Fighter" then
  673. setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6
  674. doRaiseStatus(cid, 1.5, 1.5, 100, a)
  675. doSetCreatureOutfit(cid, {lookType = 1448}, a*1000)
  676. setPlayerStorageValue(cid, 625877, 1448) --alterado v1.6
  677. end
  678. end
  679. addEvent(doBuff2, 1000, cid, -1, eff, a, buff, false, atributo)
  680. end
  681.  
  682. if ret.buff and ret.buff ~= "" then
  683. doBuff2(ret.id, ret.cd, ret.eff, ret.check, ret.buff, ret.first, (ret.attr and ret.attr or false))
  684. end
  685.  
  686. if isSummon(ret.id) and getPokemonBoost(ret.id) ~= 0 and math.random(1, 100) <= getPokemonBoost(ret.id) then --sistema "pegou no boost"
  687. if ret.cond and not isInArray({"Poison", "Leech", "Fear"}, ret.cond) then
  688. doSendMagicEffect(getThingPosWithDebug(ret.id), 114)
  689. doSendAnimatedText(getThingPosWithDebug(ret.id), "BOOST", 215) --alterado v1.8
  690. return true
  691. end
  692. end
  693.  
  694. if ret.cond and ret.cond == "Miss" then
  695. doMiss2(ret.id, ret.cd, ret.eff, ret.check, ret.spell)
  696. elseif ret.cond and ret.cond == "Silence" then
  697. doSilence2(ret.id, ret.cd, ret.eff, ret.check)
  698. elseif ret.cond and ret.cond == "Slow" then
  699. doSlow2(ret.id, ret.cd, ret.eff, ret.check, ret.first)
  700. elseif ret.cond and ret.cond == "Confusion" then
  701. doConfusion2(ret.id, ret.cd, ret.check)
  702. elseif ret.cond and ret.cond == "Burn" then
  703. doBurn2(ret.id, ret.cd, ret.check, ret.damage)
  704. elseif ret.cond and ret.cond == "Poison" then
  705. doPoison2(ret.id, ret.cd, ret.check, ret.damage)
  706. elseif ret.cond and ret.cond == "Fear" then
  707. doFear2(ret.id, ret.cd, ret.check, ret.skill)
  708. elseif ret.cond and ret.cond == "Stun" then
  709. doStun2(ret.id, ret.cd, ret.eff, ret.check, ret.spell)
  710. elseif ret.cond and ret.cond == "Paralyze" then
  711. doParalyze2(ret.id, ret.cd, ret.eff, ret.check, ret.first)
  712. elseif ret.cond and ret.cond == "Sleep" then
  713. doSleep2(ret.id, ret.cd, ret.check, ret.first)
  714. elseif ret.cond and ret.cond == "Leech" then
  715. doLeech2(ret.id, ret.attacker, ret.cd, ret.check, ret.damage)
  716. end
  717. end
  718.  
  719. --------------------------------
  720. function cleanBuffs2(item)
  721. if item ~= 0 then
  722. for i = 1, 3 do
  723. doItemEraseAttribute(item, Buffs[i][1])
  724. doItemEraseAttribute(item, Buffs[i][1].."eff")
  725. doItemEraseAttribute(item, Buffs[i][1].."skill")
  726. end
  727. end
  728. end
  729. --------------------------------
  730. function doCureStatus(cid, type, playerballs)
  731. if not isCreature(cid) then return true end
  732. if playerballs and isPlayer(cid) then
  733. local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
  734. local mb = getPlayerSlotItem(cid, 8)
  735. if isPokeball(mb.itemid) then
  736. if not type or type == "all" then
  737. for b = 1, #injuries2 do
  738. doItemSetAttribute(mb.uid, ""..injuries2[b].n.."", -1)
  739. end
  740. else
  741. doItemSetAttribute(mb.uid, ""..type.."", -1)
  742. end
  743. end
  744. for bname, balls in pairs (pokeballs) do
  745. for times = 1,3 do
  746. local items = getItemsInContainerById(bp.uid, balls.all[times])
  747. for _, uid in pairs(items) do
  748. if not type or type == "all" then
  749. for b = 1, #injuries2 do
  750. doItemSetAttribute(uid, ""..injuries2[b].n.."", -1)
  751. end
  752. else
  753. doItemSetAttribute(uid, ""..type.."", -1)
  754. end
  755. end
  756. end
  757. end
  758. end
  759. if type == "all" then
  760. for a = 1, #injuries2 do
  761. setPlayerStorageValue(cid, injuries2[a].m, -1)
  762. end
  763. return true
  764. end
  765. for a, b in pairs (injuries2) do
  766. if b.n == type then
  767. setPlayerStorageValue(cid, b.m, -1)
  768. end
  769. end
  770. end
  771. ---------------------------------
  772. function isWithCondition(cid)
  773. for i = 1, #injuries2 do
  774. if getPlayerStorageValue(cid, injuries2[i].m) >= 1 then
  775. return true
  776. end
  777. end
  778. return false
  779. end
  780. ---------------------------------
  781. function doCureBallStatus(item, type)
  782. if not type or type == "all" then
  783. for b = 1, #injuries2 do
  784. doItemSetAttribute(item, ""..injuries2[b].n.."", -1)
  785. end
  786. else
  787. doItemSetAttribute(item, ""..type.."", -1)
  788. end
  789. end
  790. ---------------------------------
  791. function isBurning(cid)
  792. if not isCreature(cid) then return false end
  793. if getPlayerStorageValue(cid, conds["Burn"]) >= 0 then return true end
  794. return false
  795. end
  796.  
  797. function isPoisoned(cid)
  798. if not isCreature(cid) then return false end
  799. if getPlayerStorageValue(cid, conds["Poison"]) >= 0 then return true end
  800. return false
  801. end
  802.  
  803. function isSilence(cid)
  804. if not isCreature(cid) then return false end
  805. if getPlayerStorageValue(cid, conds["Silence"]) >= 0 then return true end
  806. return false
  807. end
  808.  
  809. function isParalyze(cid)
  810. if not isCreature(cid) then return false end
  811. if getPlayerStorageValue(cid, conds["Paralyze"]) >= 0 then return true end
  812. return false
  813. end
  814.  
  815. function isSleeping(cid)
  816. if not isCreature(cid) then return false end
  817. if getPlayerStorageValue(cid, conds["Sleep"]) >= 0 then return true end
  818. return false
  819. end
  820.  
  821. function isWithFear(cid)
  822. if not isCreature(cid) then return false end
  823. if getPlayerStorageValue(cid, conds["Fear"]) >= 0 then return true end
  824. return false
  825. end
  826. -----------------------------------
  827. function doMoveInArea2(cid, eff, area, element, min, max, spell, ret)
  828. if not isCreature(cid) then return true end
  829.  
  830. local pos = getPosfromArea(cid, area) --alterado v1.8
  831. setPlayerStorageValue(cid, 21101, -1)
  832.  
  833. local skills = {"Skull Bash", "Gust", "Water Pulse", "Stick Throw", "Last Resort", "Ground Crusher", "Overheat", "Toxic", "Take Down", "Gyro Ball"} --alterado v1.7
  834. local n = 0
  835. local l = 0
  836.  
  837. while n < #pos do
  838. if not isCreature(cid) then return true end
  839. if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  840. if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  841.  
  842. n = n+1
  843. thing = {x=pos[n].x,y=pos[n].y,z=pos[n].z,stackpos=253}
  844. local pid = getThingFromPosWithProtect(thing)
  845. ----
  846. if pid ~= cid then
  847. if spell and isInArray(skills, spell) then
  848. if spell == "Stick Throw" then
  849. addEvent(sendEffWithProtect, l*300, cid, pos[n], eff)
  850. addEvent(sendMoveBack, 1200, cid, pos, eff, min, max)
  851. addEvent(doMoveDano2, l*300, cid, pid, element, min, max, ret, spell) --alterado v1.6
  852. elseif spell and spell == "Gyro Ball" then --alterado v1.7
  853. pos[n].x = pos[n].x+1
  854. addEvent(sendEffWithProtect, l*200, cid, pos[n], eff)
  855. addEvent(doMoveDano2, l*200, cid, pid, element, min, max, ret, spell)
  856. else
  857. addEvent(sendEffWithProtect, l*200, cid, pos[n], eff)
  858. addEvent(doMoveDano2, l*200, cid, pid, element, min, max, ret, spell) --alterado v1.6
  859. end
  860. elseif spell and spell == "Epicenter" then
  861. local random = math.random(50, 500)
  862. addEvent(sendEffWithProtect, random, cid, pos[n], eff)
  863. addEvent(doDanoWithProtect, random, cid, GROUNDDAMAGE, pos[n], crusher, -min, -max, 255)
  864. elseif spell and spell == "Shadowave" then
  865. posi = {x=pos[n].x, y=pos[n].y+1, z=pos[n].z}
  866. sendEffWithProtect(cid, posi, eff)
  867. doMoveDano2(cid, pid, element, min, max, ret, spell) --alterado v1.6
  868. elseif spell and spell == "Surf" then
  869. addEvent(sendEffWithProtect, math.random(50, 500), cid, pos[n], eff)
  870. addEvent(doMoveDano2, 400, cid, pid, element, min, max, ret, spell) --alterado v1.6
  871. elseif spell and spell == "Sand Attack" then
  872. addEvent(sendEffWithProtect, n*200, cid, pos[n], eff)
  873. addEvent(doMoveDano2, n*200, cid, pid, element, min, max, ret, spell) --alterado v1.6
  874. elseif spell and (spell == "Muddy Water" or spell == "Venom Motion") then
  875. local arr = {
  876. [1] = 0, [2] = 0, [3] = 0, [4] = 200, [5] = 200, [6] = 200, [7] = 400, [8] = 400, [9] = 400, [10] = 600, [11] = 600,
  877. [12] = 600, [13] = 800, [14] = 800, [15] = 800
  878. }
  879.  
  880. local time = {0, 200, 400, 600, 800}
  881.  
  882. addEvent(sendEffWithProtect, arr[n], cid, pos[n], eff)
  883. addEvent(doMoveDano2, arr[n], cid, pid, element, min, max, ret, spell)
  884. elseif spell and (spell == "Inferno" or spell == "Fissure") then
  885. addEvent(sendEffWithProtect, math.random(0, 500), cid, pos[n], eff)
  886. addEvent(doMoveDano2, math.random(0, 500), cid, pid, element, min, max, ret, spell)
  887. elseif spell == "Last Resort" then
  888.  
  889. local pos = getThingPosWithDebug(cid)
  890. local areas = {rock5, rock4, rock3, rock2, rock1, rock5, rock4, rock3, rock2, rock1}
  891.  
  892. for i = 0, 9 do
  893. addEvent(doMoveInArea2, i*400, cid, 3, areas[i+1], NORMALDAMAGE, min, max, spell)
  894. addEvent(doMoveInArea2, i*410, cid, 3, areas[i+1], NORMALDAMAGE, 0, 0, spell)
  895. end
  896. else
  897. sendEffWithProtect(cid, pos[n], eff)
  898. doMoveDano2(cid, pid, element, min, max, ret, spell)
  899. end
  900. end
  901. l = l+1
  902. end
  903. end
  904. -------------------------------------------
  905. function doMoveDano2(cid, pid, element, min, max, ret, spell)
  906. if isCreature(pid) and isCreature(cid) and cid ~= pid then
  907. if isNpcSummon(pid) and getCreatureTarget(pid) ~= cid then
  908. return true --alterado v1.6
  909. end
  910. if ehNPC(pid) then return true end
  911. ---
  912. local canAtk = true --alterado v1.6
  913. if getPlayerStorageValue(pid, 21099) >= 1 then
  914. doSendMagicEffect(getThingPosWithDebug(pid), 135)
  915. doSendAnimatedText(getThingPosWithDebug(pid), "REFLECT", COLOR_GRASS)
  916. addEvent(docastspell, 100, pid, spell)
  917. if getCreatureName(pid) == "Wobbuffet" or getCreatureName(pid) == "Reflector Wobbuffet" or getCreatureName(pid) == "Wowofet" then
  918. doRemoveCondition(pid, CONDITION_OUTFIT)
  919. end
  920. canAtk = false
  921. setPlayerStorageValue(pid, 21099, -1)
  922. setPlayerStorageValue(pid, 21100, 1)
  923. setPlayerStorageValue(pid, 21101, cid)
  924. setPlayerStorageValue(pid, 21103, getTableMove(cid, getPlayerStorageValue(cid, 21102)).f)
  925. end
  926. ---
  927. if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  928. if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  929. if isSummon(cid) and (ehMonstro(pid) or (isSummon(pid) and canAttackOther(cid, pid) == "Can") or (isPlayer(pid) and canAttackOther(cid, pid) == "Can" and #getCreatureSummons(pid) <= 0)) and pid ~= cid then
  930. if canAtk then --alterado v1.6
  931. if ret and ret.cond then
  932. ret.id = pid
  933. ret.check = getPlayerStorageValue(pid, conds[ret.cond])
  934. doCondition2(ret)
  935. end
  936. if spell == "Selfdestruct" then
  937. if getPlayerStorageValue(pid, 9658783) <= 0 then
  938. doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)
  939. doCreatureAddHealth(pid, -max) --alterado v1.6
  940. end
  941. else
  942. doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)
  943. end
  944. end
  945. elseif ehMonstro(cid) and (isSummon(pid) or (isPlayer(pid) and #getCreatureSummons(pid) <= 0)) and pid ~= cid then
  946. if canAtk then --alterado v1.6
  947. if ret and ret.cond then
  948. ret.id = pid
  949. ret.check = getPlayerStorageValue(pid, conds[ret.cond])
  950. doCondition2(ret)
  951. end
  952. if spell == "Selfdestruct" then
  953. if getPlayerStorageValue(pid, 9658783) <= 0 then
  954. doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)
  955. doCreatureAddHealth(pid, -max) --alterado v1.6
  956. end
  957. else
  958. doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)
  959. end
  960. end
  961. elseif isPlayer(cid) and ehMonstro(pid) and pid ~= cid then
  962. if canAtk then --alterado v1.6
  963. if ret and ret.cond then
  964. ret.id = pid
  965. ret.check = getPlayerStorageValue(pid, conds[ret.cond])
  966. doCondition2(ret)
  967. end
  968. if spell == "Selfdestruct" then
  969. if getPlayerStorageValue(pid, 9658783) <= 0 then
  970. doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)
  971. doCreatureAddHealth(pid, -max) --alterado v1.6
  972. end
  973. else
  974. doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)
  975. end
  976. end
  977. end
  978. end
  979. end
  980. --------------------------------------------------------------------------------
  981. function sendEffWithProtect(cid, pos, eff) --Manda algum magic effect com proteçoes
  982. if not isCreature(cid) then return true end
  983. if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  984. if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  985. local checkpos = pos
  986. checkpos.stackpos = 0
  987. if not hasTile(checkpos) then
  988. return true
  989. end
  990. if not canWalkOnPos2(pos, false, true, false, true, false) then --alterado v1.6
  991. return true
  992. end
  993.  
  994. doSendMagicEffect(pos, eff)
  995. end
  996. ---------------------------------------------------------------------------------
  997. function getThingPosWithDebug(what)
  998. if not isCreature(what) or getCreatureHealth(what) <= 0 then
  999. return {x = 1, y = 1, z = 10}
  1000. end
  1001. return getThingPos(what)
  1002. end
  1003. ---------------------------------------------------------------------------------
  1004. function doDanoWithProtect(cid, element, pos, area, min, max, eff) --Da dano com proteçoes
  1005. if not isCreature(cid) then return true end
  1006. if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1007. if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1008. doAreaCombatHealth(cid, element, pos, area, -(math.abs(min)), -(math.abs(max)), eff)
  1009. end
  1010. ---------------------------------------------------------------------------------
  1011. function doDanoWithProtectWithDelay(cid, target, element, min, max, eff, area)
  1012. const_distance_delay = 56
  1013. if not isCreature(cid) then return true end
  1014. if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1015. if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1016. if target ~= 0 and isCreature(target) and not area then
  1017. delay = getDistanceBetween(getThingPosWithDebug(cid), getThingPosWithDebug(target)) * const_distance_delay
  1018. addEvent(doDanoWithProtect, delay, cid, element, getThingPosWithDebug(target), 0, min, max, eff)
  1019. return true
  1020. end
  1021. addEvent(doDanoWithProtect, 200, cid, element, getThingPosWithDebug(target), area, min, max, eff)
  1022. end
  1023. --------------------------------------------------------------------------------
  1024. function sendDistanceShootWithProtect(cid, frompos, topos, eff) --Manda um efeito de distancia com proteçoes
  1025. if not isCreature(cid) then return true end
  1026. if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1027. if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1028. doSendDistanceShoot(frompos, topos, eff)
  1029. end
  1030. ---------------------------------------------------------------------------------
  1031. function sendMoveBack(cid, pos, eff, min, max) --Manda o Atk do farfetchd de volta...
  1032. local m = #pos+1
  1033. for i = 1, #pos do
  1034. if not isCreature(cid) then return true end
  1035. ---
  1036. m = m-1
  1037. thing = {x=pos[m].x,y=pos[m].y,z=pos[m].z,stackpos=253}
  1038. local pid = getThingFromPosWithProtect(thing)
  1039. addEvent(doMoveDano2, i*200, cid, pid, FLYINGDAMAGE, min/4, max/4)
  1040. addEvent(sendEffWithProtect, i*200, cid, pos[m], eff) --alterado v1.3
  1041. --
  1042. end
  1043. end
  1044. ---------------------------------------------------------------------------------
  1045. function upEffect(cid, effDis)
  1046. if not isCreature(cid) then return true end
  1047. if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1048. if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1049. pos = getThingPos(cid)
  1050. frompos = {x = pos.x+1, y = pos.y, z = pos.z}
  1051. frompos.x = pos.x - math.random(4, 7)
  1052. frompos.y = pos.y - math.random(5, 8)
  1053. doSendDistanceShoot(getThingPos(cid), frompos, effDis)
  1054. end
  1055. ---------------------------------------------------------------------------------
  1056. function fall(cid, master, element, effDis, effArea) --Function pra jogar efeitos pra cima e cair depois... tpw falling rocks e blizzard
  1057. if isCreature(cid) then
  1058. if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1059. if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1060. pos = getThingPos(cid)
  1061. pos.x = pos.x + math.random(-4,4)
  1062. pos.y = pos.y + math.random(-4,4)
  1063. if isMonster(cid) or isPlayer(cid) then
  1064. frompos = {x = pos.x+1, y = pos.y, z = pos.z}
  1065. elseif isSummon(cid) then
  1066. frompos = getThingPos(master)
  1067. end
  1068. frompos.x = pos.x - 7
  1069. frompos.y = pos.y - 6
  1070. if effDis ~= -1 then --alterado!
  1071. doSendDistanceShoot(frompos, pos, effDis)
  1072. end
  1073. doAreaCombatHealth(cid, element, pos, 0, 0, 0, effArea)
  1074. end
  1075. end
  1076. ---------------------------------------------------------------------------------
  1077. function canDoMiss(cid, nameAtk) --alterado v1.5
  1078. local atkTerra = {"Sand Attack", "Mud Shot", "Mud Bomb", "Stomp", "Crusher Stomp", "Mud Slap", "Sand Tomb"} --alterado v1.7
  1079. local atkElectric = {"Electric Storm", "Thunder Wave", "Thunder", "Electricity", "Wild Charge"} --alterado v1.7
  1080. if not isCreature(cid) then return false end
  1081. if isPlayer(cid) then return true end
  1082. if not pokes[getCreatureName(cid)] then return true end
  1083.  
  1084. if isInArray(atkTerra, nameAtk) then
  1085. if (pokes[getCreatureName(cid)].type == "flying") or (pokes[getCreatureName(cid)].type2 == "flying") or isInArray(specialabilities["levitate"], getCreatureName(cid)) then
  1086. return false
  1087. end
  1088. elseif isInArray(atkElectric, nameAtk) then
  1089. if (pokes[getCreatureName(cid)].type == "ground") or (pokes[getCreatureName(cid)].type2 == "ground") then
  1090. return false
  1091. end
  1092. end
  1093.  
  1094. return true
  1095. end
  1096. ---------------------------------------------------------------------------------
  1097. function doMoveInAreaMulti(cid, effDis, effMagic, areaEff, areaDano, element, min, max, ret) --alterado v1.7
  1098. if not isCreature(cid) then return true end
  1099. local pos = getPosfromArea(cid, areaEff)
  1100. local pos2 = getPosfromArea(cid, areaDano)
  1101. local n = 0
  1102.  
  1103. while n < #pos2 do
  1104. if not isCreature(cid) then return true end
  1105. if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1106. if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1107.  
  1108. n = n+1
  1109. thing = {x=pos2[n].x,y=pos2[n].y,z=pos2[n].z,stackpos=253}
  1110. if n < #pos then
  1111. addEvent(sendDistanceShootWithProtect, 50, cid, getThingPos(cid), pos[n], effDis) --39
  1112. addEvent(sendEffWithProtect, 100, cid, pos[n], effMagic) -- 112
  1113. --- --alterado v1.6.1
  1114. if math.random(1, 2) == 2 then
  1115. addEvent(sendDistanceShootWithProtect, 450, cid, getThingPos(cid), pos[n], effDis) --550
  1116. addEvent(sendEffWithProtect, 550, cid, pos[n], effMagic) -- 650
  1117. end
  1118. end
  1119. local pid = getThingFromPosWithProtect(thing)
  1120. if isCreature(pid) then
  1121. if ret and ret.id == 0 then --alterado v1.8
  1122. ret.id = pid
  1123. ret.check = getPlayerStorageValue(pid, conds[ret.cond])
  1124. end
  1125. if not ret then ret = {} end --alterado v1.7
  1126. doMoveDano2(cid, pid, element, min, max, ret, getPlayerStorageValue(cid, 21102))
  1127. end
  1128. end
  1129. end
  1130. ---------------------------------------------------------------------------------------
  1131. function doDoubleHit(cid, pid, valor, races) --alterado v1.6
  1132. if isCreature(cid) and isCreature(pid) then
  1133. if getPlayerStorageValue(cid, 374896) >= 1 then
  1134. if getMasterTarget(cid) == pid then
  1135. if isInArray({"Kadabra", "Alakazam", "Mew", "Shiny Abra", "Shiny Alakazam"}, getCreatureName(cid)) then
  1136. doSendDistanceShoot(getThingPosWithDebug(cid), getThingPosWithDebug(pid), 39)
  1137. end
  1138. if isSummon(cid) then
  1139. doTargetCombatHealth(getCreatureMaster(cid), pid, PHYSICALDAMAGE, -math.abs(valor), -math.abs(valor), 255)
  1140. else
  1141. doCreatureAddHealth(pid, -math.abs(valor), 3, races[getMonsterInfo(getCreatureName(pid)).race].cor)
  1142. end
  1143. end
  1144. end
  1145. end
  1146. end
  1147. ---------------------------------------------------------------------------------------
  1148. function doDanoInTarget(cid, target, combat, min, max, eff) --alterado v1.7
  1149. if not isCreature(cid) or not isCreature(target) then return true end
  1150. if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1151. if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1152. doTargetCombatHealth(cid, target, combat, -math.abs(min), -math.abs(max), eff)
  1153. end
  1154. -----------------------------------------------------------------------------------------
  1155. function doDanoInTargetWithDelay(cid, target, combat, min, max, eff) --alterado v1.7
  1156. const_distance_delay = 56
  1157. if not isCreature(cid) or not isCreature(target) then return true end
  1158. if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1159. if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
  1160. local delay = getDistanceBetween(getThingPosWithDebug(cid), getThingPosWithDebug(target)) * const_distance_delay
  1161. addEvent(doDanoInTarget, delay, cid, target, combat, min, max, eff)
  1162. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement