Advertisement
Guest User

Move1.lua

a guest
Jul 20th, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.65 KB | None | 0 0
  1. local msgs = {"use ", ""}
  2.  
  3. function doAlertReady(cid, id, movename, n, cd)
  4. if movename == "Mega Evolution" then return true end
  5. if not isCreature(cid) then return true end
  6. local myball = getPlayerSlotItem(cid, 8)
  7. if myball.itemid > 0 and getItemAttribute(myball.uid, cd) == "cd:"..id.."" then
  8. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPokeballName(myball.uid).." - "..movename.." (m"..n..") is ready!")
  9. return true
  10. end
  11. local p = getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid)
  12. if not p or #p <= 0 then return true end
  13. for a = 1, #p do
  14. if getItemAttribute(p[a], cd) == "cd:"..id.."" then
  15. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPokeballName(p[a]).." - "..movename.." (m"..n..") is ready!")
  16. return true
  17. end
  18. end
  19. end
  20.  
  21. function onSay(cid, words, param, channel)
  22.  
  23.  
  24. if param ~= "" then return true end
  25. if string.len(words) > 3 then return true end
  26.  
  27. if #getCreatureSummons(cid) == 0 then
  28. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need a pokemon to use moves.")
  29. return 0
  30. end
  31. --alterado v1.5
  32. local mypoke = getCreatureSummons(cid)[1]
  33.  
  34. if getCreatureCondition(cid, CONDITION_EXHAUST) then return true end
  35. if getCreatureName(mypoke) == "Evolution" then return true end
  36.  
  37. if getCreatureName(mypoke) == "Ditto" or getCreatureName(mypoke) == "Shiny Ditto" then
  38. name = getPlayerStorageValue(mypoke, 1010) --edited
  39. else
  40. name = getCreatureName(mypoke)
  41. end
  42.  
  43. --local name = getCreatureName(mypoke) == "Ditto" and getPlayerStorageValue(mypoke, 1010) or getCreatureName(mypoke)
  44.  
  45. local it = string.sub(words, 2, 3)
  46. local move = movestable[name].move1
  47. if getPlayerStorageValue(mypoke, 212123) >= 1 then
  48. cdzin = "cm_move"..it..""
  49. else
  50. cdzin = "move"..it.."" --alterado v1.5
  51. end
  52.  
  53. if it == "2" then
  54. move = movestable[name].move2
  55. elseif it == "3" then
  56. move = movestable[name].move3
  57. elseif it == "4" then
  58. move = movestable[name].move4
  59. elseif it == "5" then
  60. move = movestable[name].move5
  61. elseif it == "6" then
  62. move = movestable[name].move6
  63. elseif it == "7" then
  64. move = movestable[name].move7
  65. elseif it == "8" then
  66. move = movestable[name].move8
  67. elseif it == "9" then
  68. move = movestable[name].move9
  69. elseif it == "10" then
  70. move = movestable[name].move10
  71. elseif it == "11" then
  72. move = movestable[name].move11
  73. elseif it == "12" then
  74. move = movestable[name].move12
  75. elseif it == "13" then
  76. move = movestable[name].move13
  77. end
  78.  
  79. if not move then
  80. local isMega = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "megaStone")
  81. if not isMega or name:find("Mega") then
  82. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your pokemon doesn't recognize this move.")
  83. return true
  84. end
  85. local moveTable, index = getNewMoveTable(movestable[name]), 0
  86. for i = 1, 12 do
  87. if not moveTable[i] then
  88. index = i
  89. break
  90. end
  91. end
  92. if tonumber(it) ~= index then
  93. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your pokemon doesn't recognize this move.")
  94. return true
  95. end
  96. local needCds = true --Coloque false se o pokémon puder mega evoluir mesmo com spells em cooldown.
  97. if needCds then
  98. for i = 1, 12 do
  99. if getCD(getPlayerSlotItem(cid, 8).uid, "move"..i) > 0 then
  100. return doPlayerSendCancel(cid, "To mega evolve, all the spells of your pokemon need to be ready.")
  101. end
  102. end
  103. end
  104. local megaEvoClans = {
  105. --[mega_stone_id] = {"clan_name", "clan_name", etc},
  106. [20886] = {"Psycraft"},
  107. [20913] = {"Malefic"},
  108. [20886] = {"Psycraft"},
  109. [20886] = {"Psycraft"},
  110. [20886] = {"Psycraft"},
  111. --etc,
  112. }
  113. if megaEvoClans[isMega] then
  114. if not isInArray(megaEvoClans[isMega], getPlayerClanName(cid)) then
  115. return doPlayerSendCancel(cid, "You can't mega evolve this pokemon.")
  116. end
  117. end
  118. move = {name = "Mega Evolution", level = 0, cd = 0, dist = 1, target = 0, f = 0, t = "?"}
  119. end
  120.  
  121. if getPlayerLevel(cid) < move.level then
  122. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need be atleast level "..move.level.." to use this move.")
  123. return true
  124. end
  125.  
  126. if getCD(getPlayerSlotItem(cid, 8).uid, cdzin) > 0 and getCD(getPlayerSlotItem(cid, 8).uid, cdzin) < (move.cd + 2) then
  127. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to wait "..getCD(getPlayerSlotItem(cid, 8).uid, cdzin).." seconds to use "..move.name.." again.")
  128. return true
  129. end
  130.  
  131. if getTileInfo(getThingPos(mypoke)).protection then
  132. doPlayerSendCancel(cid, "Your pokemon cannot use moves while in protection zone.")
  133. return true
  134. end
  135.  
  136. if getPlayerLevel(cid) < move.level then
  137. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need be atleast level "..move.level.." to use this move.")
  138. return true
  139. end
  140.  
  141. if getPlayerStorageValue(mypoke, 3894) >= 1 then
  142. return doPlayerSendCancel(cid, "You can't attack because you is with fear") --alterado v1.3
  143. end
  144. --alterado v1.6
  145. if (move.name == "Team Slice" or move.name == "Team Claw") and #getCreatureSummons(cid) < 2 then
  146. doPlayerSendCancel(cid, "Your pokemon need be in a team for use this move!")
  147. return true
  148. end
  149. --alterado v1.7 \/\/\/
  150. if isCreature(getCreatureTarget(cid)) and isInArray(specialabilities["evasion"], getCreatureName(getCreatureTarget(cid))) then
  151. local target = getCreatureTarget(cid)
  152. if math.random(1, 100) <= passivesChances["Evasion"][getCreatureName(target)] then
  153. if isCreature(getMasterTarget(target)) then --alterado v1.6
  154. doSendMagicEffect(getThingPos(target), 211)
  155. doSendAnimatedText(getThingPos(target), "TOO BAD", 215)
  156. doTeleportThing(target, getClosestFreeTile(target, getThingPos(mypoke)), false)
  157. doSendMagicEffect(getThingPos(target), 211)
  158. doFaceCreature(target, getThingPos(mypoke))
  159. return true --alterado v1.6
  160. end
  161. end
  162. end
  163.  
  164.  
  165. if move.target == 1 then
  166.  
  167. if not isCreature(getCreatureTarget(cid)) then
  168. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don\'t have any targets.")
  169. return 0
  170. end
  171.  
  172. if getCreatureCondition(getCreatureTarget(cid), CONDITION_INVISIBLE) then
  173. return 0
  174. end
  175.  
  176. if getCreatureHealth(getCreatureTarget(cid)) <= 0 then
  177. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your have already defeated your target.")
  178. return 0
  179. end
  180.  
  181. if not isCreature(getCreatureSummons(cid)[1]) then
  182. return true
  183. end
  184.  
  185. if getDistanceBetween(getThingPos(getCreatureSummons(cid)[1]), getThingPos(getCreatureTarget(cid))) > move.dist then
  186. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Get closer to the target to use this move.")
  187. return 0
  188. end
  189.  
  190. if not isSightClear(getThingPos(getCreatureSummons(cid)[1]), getThingPos(getCreatureTarget(cid)), false) then
  191. return 0
  192. end
  193. end
  194.  
  195. local newid = 0
  196.  
  197. -- Cooldown --
  198. local Tiers = {
  199. [113] = {bonus = Cdown1},
  200. [114] = {bonus = Cdown2},
  201. [115] = {bonus = Cdown3},
  202. }
  203. local Tier = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "heldx")
  204. local cdzao = {}
  205. if Tier and Tier > 112 and Tier < 116 then
  206. cdzao = math.ceil(move.cd - (move.cd * Tiers[Tier].bonus))
  207. else
  208. cdzao = move.cd
  209. end
  210. -- Cooldown --
  211.  
  212. if isSleeping(mypoke) or isSilence(mypoke) then --alterado v1.5
  213. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry you can't do that right now.")
  214. return 0
  215. else
  216. newid = setCD(getPlayerSlotItem(cid, 8).uid, cdzin, cdzao)
  217. end
  218.  
  219. local spellMessage = msgs[math.random(#msgs)]..""..move.name.."!"
  220. if move.name == "Mega Evolution" then
  221. spellMessage = "Mega Evolve!"
  222. end
  223. doCreatureSay(cid, getPokeName(mypoke)..", "..spellMessage, TALKTYPE_ORANGE_1)
  224.  
  225. local summons = getCreatureSummons(cid) --alterado v1.6
  226.  
  227. addEvent(doAlertReady, move.cd * 1000, cid, newid, move.name, it, cdzin)
  228.  
  229. for i = 2, #summons do
  230. if isCreature(summons[i]) and getPlayerStorageValue(cid, 637501) >= 1 then
  231. docastspell(summons[i], move.name) --alterado v1.6
  232. end
  233. end
  234.  
  235. docastspell(mypoke, move.name)
  236. doCreatureAddCondition(cid, playerexhaust)
  237.  
  238. if useKpdoDlls then
  239. doUpdateCooldowns(cid)
  240. end
  241.  
  242. return 0
  243. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement