SHARE
TWEET

Untitled

a guest Jul 18th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getMoveInfo(cid, moveid)
  2.     local name = doCorrectString(getCreatureName(cid))
  3.     if moveid == 1 then
  4.         move = movestable[name].move1
  5.     elseif moveid == 2 then
  6.         move = movestable[name].move2
  7.     elseif moveid == 3 then
  8.         move = movestable[name].move3
  9.     elseif moveid == 4 then
  10.         move = movestable[name].move4
  11.     elseif moveid == 5 then
  12.         move = movestable[name].move5
  13.     elseif moveid == 6 then
  14.         move = movestable[name].move6
  15.     elseif moveid == 7 then
  16.         move = movestable[name].move7
  17.     elseif moveid == 8 then
  18.         move = movestable[name].move8
  19.     elseif moveid == 9 then
  20.         move = movestable[name].move9
  21.     elseif moveid == 10 then
  22.         move = movestable[name].move10
  23.     elseif moveid == 11 then
  24.         move = movestable[name].move11
  25.     elseif moveid == 12 then
  26.         move = movestable[name].move12
  27.     elseif moveid == 13 then
  28.         move = movestable[name].move13
  29.     elseif moveid == 14 then
  30.         move = movestable[name].move14
  31.     end
  32.     return move
  33. end
  34.  
  35. function getPokemonNumberMoves(cid)
  36.     local name = doCorrectString(getCreatureName(cid))
  37.     if not movestable[name].move1 then
  38.         return 0
  39.     elseif not movestable[name].move2 then
  40.         return 1
  41.     elseif not movestable[name].move3 then
  42.         return 2
  43.     elseif not movestable[name].move4 then
  44.         return 3
  45.     elseif not movestable[name].move5 then
  46.         return 4
  47.     elseif not movestable[name].move6 then
  48.         return 5
  49.     elseif not movestable[name].move7 then
  50.         return 6
  51.     elseif not movestable[name].move8 then
  52.         return 7
  53.     elseif not movestable[name].move9 then
  54.         return 8
  55.     elseif not movestable[name].move10 then
  56.         return 9
  57.     elseif not movestable[name].move11 then
  58.         return 10
  59.     elseif not movestable[name].move12 then
  60.         return 11
  61.     elseif not movestable[name].move13 then
  62.         return 12
  63.     elseif not movestable[name].move14 then
  64.         return 13
  65.     else
  66.         return 14
  67.     end
  68. end
  69.  
  70. function setPokemonMoveDelay(cid, move, time)
  71.     if not isCreature(cid) then return true end
  72.     local ball = isSummon(cid) and getPlayerSlotItem(getCreatureMaster(cid), CONST_SLOT_FEET) or nil
  73.     if ball then
  74.         doItemSetAttribute(ball.uid, "move"..move, time)
  75.     end
  76.     setPlayerStorageValue(cid, storages.moves[move], time)
  77.     if time <= 0 then return true end
  78.     addEvent(setPokemonMoveDelay, 1000, cid, move, time - 1)
  79. end
  80.  
  81. function getPokemonMoveDelay(cid, move)
  82.     local storage = storages.moves[move]
  83.     if getPlayerStorageValue(cid, storage) and getPlayerStorageValue(cid, storage) > 0 then
  84.         return true
  85.     else
  86.         return false
  87.     end
  88. end
  89.  
  90. function doClearBallMoveDelay(ball)
  91.     for i = 1, 14 do
  92.         doItemEraseAttribute(ball, "move"..i)
  93.     end
  94. end
  95.  
  96. function getBallMoveDelay(ball, move)
  97.     if getItemAttribute(ball, "move"..move) and getItemAttribute(ball, "move"..move) > 0 then
  98.         return true
  99.     else
  100.         return false
  101.     end
  102. end
  103.  
  104. function setPokemonStatus(cid, status, time, damage, first, attacker)
  105.     if not isCreature(cid) then return true end
  106.     if isSummon(cid) then
  107.         master = getCreatureMaster(cid)
  108.         ball = getPlayerSlotItem(master, CONST_SLOT_FEET)
  109.     else
  110.         master = 0
  111.         ball = false
  112.     end
  113.     local storage = storages.status[status]
  114.     local pos1 = getThingPos(cid)
  115.     local pos2 = getThingPos(cid)
  116.     pos2.y = pos2.y - 1
  117.     if first then
  118.         setPlayerStorageValue(cid, storage, time)
  119.     else
  120.         if getPlayerStorageValue(cid, storage) - 1 == time then
  121.             setPlayerStorageValue(cid, storage, time)
  122.         else
  123.             return true
  124.         end
  125.     end
  126.     if ball ~= false then
  127.         doItemSetAttribute(ball.uid, status, time)
  128.         doItemSetAttribute(ball.uid, status.."Damage", damage)
  129.     end
  130.     if status == "sleep" then
  131.         if time <= 0 then
  132.             doRegainSpeed(cid)
  133.             doCreatureSetNoMove(cid, false)
  134.         return true
  135.         end
  136.         doChangeSpeed(cid, -getCreatureSpeed(cid))
  137.         doCreatureSetNoMove(cid, true)
  138.         if isNumberPair(time) then
  139.             doSendMagicEffect(pos2, 32)
  140.         end
  141.         if not isPlayer(cid) then
  142.             if getCreatureCondition(cid, CONDITION_OUTFIT) then
  143.                 doRemoveCondition(cid, CONDITION_OUTFIT)
  144.             end
  145.         end
  146.     elseif status == "stun" then
  147.         if time <= 0 then
  148.             doRegainSpeed(cid)
  149.         return true
  150.         end
  151.         if isPlayer(cid) then
  152.             if playerSpeed <= getCreatureSpeed(cid) then
  153.                 doChangeSpeed(cid, -getCreatureSpeed(cid)/2)
  154.             end
  155.         else
  156.             if getCreatureBaseSpeed(cid) <= getCreatureSpeed(cid) then
  157.                 doChangeSpeed(cid, -getCreatureSpeed(cid)/2)
  158.             end
  159.         end
  160.     elseif status == "string" then
  161.         if time <= 0 then
  162.             doRegainSpeed(cid)
  163.         return true
  164.         end
  165.         doSendMagicEffect(pos1, 150)
  166.         if isPlayer(cid) then
  167.             if playerSpeed <= getCreatureSpeed(cid) then
  168.                 doChangeSpeed(cid, -getCreatureSpeed(cid)/2)
  169.             end
  170.         else
  171.             if getCreatureBaseSpeed(cid) <= getCreatureSpeed(cid) then
  172.                 doChangeSpeed(cid, -getCreatureSpeed(cid)/2)
  173.             end
  174.         end
  175.     elseif status == "blind" then
  176.         if time <= 0 then return true end
  177.         doSendMagicEffect(pos1, 34)
  178.     elseif status == "confusion" then
  179.         if time <= 0 then return true end
  180.         if damage == 31 then
  181.             doSendMagicEffect(pos2, damage)
  182.         else
  183.             doSendMagicEffect(pos1, damage)
  184.         end
  185.         doAddCondition(cid, confusioncondition)
  186.     elseif status == "poison" then
  187.         if time <= 0 then return true end
  188.         if getCreatureHealth(cid) - math.floor(damage/2) <= 0 then
  189.             doCreatureAddHealth(cid, -getCreatureHealth(cid) + 1, 8, COMBAT_COLORS[COMBAT_POISONDAMAGE])
  190.         else
  191.             doCreatureAddHealth(cid, -math.floor(damage/2), 8, COMBAT_COLORS[COMBAT_POISONDAMAGE])
  192.         end
  193.     elseif status == "burn" then
  194.         if time <= 0 then return true end
  195.         doCreatureAddHealth(cid, -math.floor(damage/2), 15, COMBAT_COLORS[COMBAT_FIREDAMAGE], attacker)
  196.     elseif status == "leechSeed" then
  197.         if time <= 0 then return true end
  198.         if not isCreature(attacker) then return true end
  199.         if not isNumberPair(time) then
  200.             if getCreatureHealth(cid) - damage <= 0 then
  201.                 hit = getCreatureHealth(cid)
  202.             else
  203.                 hit = damage
  204.             end
  205.             doSendAnimatedText(getThingPos(attacker), "+"..hit, 35)
  206.             doSendAnimatedText(pos1, "-"..hit, 180)
  207.             doSendMagicEffect(pos1, 45)
  208.             doCreatureAddHealth(attacker, hit)
  209.             doCreatureAddHealth(cid, -hit)
  210.         end
  211.     elseif status == "speedDown" then
  212.         if time <= 0 then
  213.             doRegainSpeed(cid)
  214.         return true
  215.         end
  216.         if isPlayer(cid) then
  217.             if playerSpeed <= getCreatureSpeed(cid) then
  218.                 doChangeSpeed(cid, -getCreatureSpeed(cid)/2)
  219.             end
  220.         else
  221.             if getCreatureBaseSpeed(cid) <= getCreatureSpeed(cid) then
  222.                 doChangeSpeed(cid, -getCreatureSpeed(cid)/2)
  223.             end
  224.         end
  225.     elseif status == "fear" then
  226.         if time <= 0 then
  227.             setCreatureTargetDistance(cid, getCreatureDefaultTargetDistance(cid))
  228.         return true
  229.         end
  230.         if getCreatureTargetDistance(cid) < 6 then
  231.             setCreatureTargetDistance(cid, 6)
  232.         end
  233.         local function doSendEffect(cid)
  234.             if not isCreature(cid) then return true end
  235.             doSendMagicEffect(pos1, 169)
  236.         end
  237.         for i = 0, 1 do
  238.             addEvent(doSendEffect, i * 500, cid)
  239.         end
  240.     elseif status == "involved" then
  241.         if time <= 0 then return true end
  242.         if isNumberPair(time) then
  243.             doSendMagicEffect(pos1, 105)
  244.             doSendMagicEffect(pos1, 170)
  245.             doCreatureAddHealth(cid, -damage, 2, 180)
  246.             doChangeSpeed(cid, -getCreatureSpeed(cid))
  247.             doCreatureSetNoMove(cid, false)
  248.         else
  249.             doRegainSpeed(cid)
  250.             doCreatureSetNoMove(cid, true)
  251.         end
  252.     elseif status == "silence" then
  253.         if time <= 0 then return true end
  254.         doSendMagicEffect(pos1, damage)
  255.     elseif status == "rage" then
  256.         if time <= 0 then return true end
  257.         doSendMagicEffect(pos1, 13)
  258.     elseif status == "harden" then
  259.         if time <= 0 then return true end
  260.         doSendMagicEffect(pos1, damage)
  261.     elseif status == "strafe" then
  262.         if time <= 0 then return true end
  263.         if isCreature(getMasterTarget(cid)) then
  264.             doCastMove(cid, "Attack")
  265.         end
  266.         doSendMagicEffect(pos1, 14)
  267.     elseif status == "speedUp" then
  268.         if time <= 0 then
  269.             doRegainSpeed(cid)
  270.         return true
  271.         end
  272.         if isPlayer(cid) then
  273.             if playerSpeed >= getCreatureSpeed(cid) then
  274.                 doChangeSpeed(cid, getCreatureSpeed(cid))
  275.             end
  276.         else
  277.             if getCreatureBaseSpeed(cid) >= getCreatureSpeed(cid) then
  278.                 doChangeSpeed(cid, getCreatureSpeed(cid))
  279.             end
  280.         end
  281.     end
  282.     if isCreature(master) then
  283.         doOTCSendPokemonHealth(master)
  284.     end
  285.     addEvent(setPokemonStatus, 1000, cid, status, time - 1, damage, false, attacker)
  286. end
  287.  
  288. function doClearPokemonStatus(cid)
  289.     for i = 1, #allStatus do
  290.         setPokemonStatus(cid, allStatus[i], 0, 0, true, 0)
  291.     end
  292. end
  293.  
  294. function getPokemonStatus(cid, status)
  295.     local storage = storages.status[status]
  296.     if getPlayerStorageValue(cid, storage) and getPlayerStorageValue(cid, storage) > 0 then
  297.         return true
  298.     else
  299.         return false
  300.     end
  301. end
  302.  
  303. function doClearBallStatus(ball)
  304.     for i = 1, #allStatus do
  305.         doItemEraseAttribute(ball, allStatus[i])
  306.     end
  307. end
  308.  
  309. function getBallStatus(ball, status)
  310.     if getItemAttribute(ball, status) and getItemAttribute(ball, status) > 0 then
  311.         return true
  312.     else
  313.         return false
  314.     end
  315. end
  316.  
  317. function getMasterTarget(cid)
  318.     if isSummon(cid) then
  319.         return getCreatureTarget(getCreatureMaster(cid))
  320.     else
  321.         return getCreatureTarget(cid)
  322.     end
  323. end
  324.  
  325. function getMasterLevel(cid)
  326.     if isSummon(cid) then
  327.         return getPlayerLevel(getCreatureMaster(cid))
  328.     else
  329.         return getPokemonLevel(getCreatureName(cid))
  330.     end
  331. end
  332.  
  333. function doMissChance(cid, move)
  334.     if move and isInArray(movesnevermiss, move) then return false end
  335.     for i = 1, #missStatus do
  336.         if getPokemonStatus(cid, missStatus[i]) and math.random(1, 2) == 1 then
  337.             doSendAnimatedText(getThingPos(cid), "MISS!", 215)
  338.             return true
  339.         else
  340.             return false
  341.         end
  342.     end
  343. end
  344.  
  345. function getPokemonPowerMove(cid, move)
  346.     if not isCreature(cid) then return true end
  347.     local power = movesinfo[move].power
  348.     return power
  349. end
  350.  
  351. function doSendMoveEffectUp(cid, shoteffect)
  352.     if not isCreature(cid) then return true end
  353.     local fromPos = getThingPos(cid)
  354.     local toPos = {x = fromPos.x - math.random(5, 7), y = fromPos.y - math.random(5, 7), z = fromPos.z}
  355.     doSendDistanceShoot(fromPos, toPos, shoteffect)
  356. end
  357.  
  358. function doSendMoveEffectDown(cid, effect, shoteffect)
  359.     if not isCreature(cid) then return true end
  360.     local myPos = getThingPos(cid)
  361.     local toPos = {x = myPos.x + math.random(-4, 4), y = myPos.y + math.random(-4, 4), z = myPos.z}
  362.     local fromPos = {x = toPos.x - 6, y = toPos.y - 6, z = toPos.z}
  363.     if getThingFromPos(toPos).itemid ~= 0 then
  364.         doSendMagicEffect(toPos, effect)
  365.         if shoteffect then
  366.             doSendDistanceShoot(fromPos, toPos, shoteffect)
  367.         end
  368.     end
  369. end
  370.  
  371. function doFrontalCombatHealth(cid, pos, type, min, max, effect, shoteffect)
  372.     local target = (isCreature(getMasterTarget(cid)) and getMasterTarget(cid) or 0)
  373.     local direction = getCreatureDirectionToTarget(cid, target)
  374.     local function doSendFrontalCombat(cid, turn, randomarea)
  375.         if not isCreature(cid) then return true end
  376.         local randomiclist = {
  377.             [1] = {11, 12, 3, 4, 1, 18, 10, 2, 7, 15},
  378.             [2] = {13, 11, 3, 17, 2, 9, 10, 1, 18, 4},
  379.             [3] = {10, 4, 2, 15, 1, 19, 13, 3, 14, 6},
  380.             [4] = {14, 17, 2, 18, 3, 19, 15, 1, 13, 7},
  381.             [5] = {6, 15, 3, 17, 1, 12, 19, 2, 16, 13}
  382.         }
  383.         local info = {
  384.             [0] = {
  385.                 [1] = {x = pos.x, y = pos.y - 1, z = pos.z},
  386.                 [2] = {x = pos.x - 1, y = pos.y - 2, z = pos.z},
  387.                 [3] = {x = pos.x + 1, y = pos.y - 2, z = pos.z},
  388.                 [4] = {x = pos.x, y = pos.y - 3, z = pos.z},
  389.                 [5] = {x = pos.x - 2, y = pos.y - 3, z = pos.z},
  390.                 [6] = {x = pos.x + 2, y = pos.y - 3, z = pos.z},
  391.                 [7] = {x = pos.x - 3, y = pos.y - 4, z = pos.z},
  392.                 [8] = {x = pos.x - 1, y = pos.y - 4, z = pos.z},
  393.                 [9] = {x = pos.x + 1, y = pos.y - 4, z = pos.z},
  394.                 [10] = {x = pos.x + 3, y = pos.y - 4, z = pos.z},
  395.                 [11] = {x = pos.x, y = pos.y - 5, z = pos.z},
  396.                 [12] = {x = pos.x - 4, y = pos.y - 5, z = pos.z},
  397.                 [13] = {x = pos.x - 2, y = pos.y - 5, z = pos.z},
  398.                 [14] = {x = pos.x + 2, y = pos.y - 5, z = pos.z},
  399.                 [15] = {x = pos.x + 4, y = pos.y - 5, z = pos.z},
  400.                 [16] = {x = pos.x - 3, y = pos.y - 6, z = pos.z},
  401.                 [17] = {x = pos.x - 1, y = pos.y - 6, z = pos.z},
  402.                 [18] = {x = pos.x + 1, y = pos.y - 6, z = pos.z},
  403.                 [19] = {x = pos.x + 3, y = pos.y - 6, z = pos.z},
  404.             },
  405.             [1] = {
  406.                 [1] = {x = pos.x + 1, y = pos.y, z = pos.z},
  407.                 [2] = {x = pos.x + 2, y = pos.y + 1, z = pos.z},
  408.                 [3] = {x = pos.x + 2, y = pos.y - 1, z = pos.z},
  409.                 [4] = {x = pos.x + 3, y = pos.y, z = pos.z},
  410.                 [5] = {x = pos.x + 3, y = pos.y + 2, z = pos.z},
  411.                 [6] = {x = pos.x + 3, y = pos.y - 2, z = pos.z},
  412.                 [7] = {x = pos.x + 4, y = pos.y + 3, z = pos.z},
  413.                 [8] = {x = pos.x + 4, y = pos.y + 1, z = pos.z},
  414.                 [9] = {x = pos.x + 4, y = pos.y - 1, z = pos.z},
  415.                 [10] = {x = pos.x + 4, y = pos.y - 3, z = pos.z},
  416.                 [11] = {x = pos.x + 5, y = pos.y, z = pos.z},
  417.                 [12] = {x = pos.x + 5, y = pos.y - 4, z = pos.z},
  418.                 [13] = {x = pos.x + 5, y = pos.y - 2, z = pos.z},
  419.                 [14] = {x = pos.x + 5, y = pos.y + 2, z = pos.z},
  420.                 [15] = {x = pos.x + 5, y = pos.y + 4, z = pos.z},
  421.                 [16] = {x = pos.x + 6, y = pos.y - 3, z = pos.z},
  422.                 [17] = {x = pos.x + 6, y = pos.y - 1, z = pos.z},
  423.                 [18] = {x = pos.x + 6, y = pos.y + 1, z = pos.z},
  424.                 [19] = {x = pos.x + 6, y = pos.y + 3, z = pos.z},
  425.             },
  426.             [2] = {
  427.                 [1] = {x = pos.x, y = pos.y + 1, z = pos.z},
  428.                 [2] = {x = pos.x + 1, y = pos.y + 2, z = pos.z},
  429.                 [3] = {x = pos.x - 1, y = pos.y + 2, z = pos.z},
  430.                 [4] = {x = pos.x, y = pos.y + 3, z = pos.z},
  431.                 [5] = {x = pos.x + 2, y = pos.y + 3, z = pos.z},
  432.                 [6] = {x = pos.x - 2, y = pos.y + 3, z = pos.z},
  433.                 [7] = {x = pos.x + 3, y = pos.y + 4, z = pos.z},
  434.                 [8] = {x = pos.x + 1, y = pos.y + 4, z = pos.z},
  435.                 [9] = {x = pos.x - 1, y = pos.y + 4, z = pos.z},
  436.                 [10] = {x = pos.x - 3, y = pos.y + 4, z = pos.z},
  437.                 [11] = {x = pos.x, y = pos.y + 5, z = pos.z},
  438.                 [12] = {x = pos.x - 4, y = pos.y + 5, z = pos.z},
  439.                 [13] = {x = pos.x - 2, y = pos.y + 5, z = pos.z},
  440.                 [14] = {x = pos.x + 2, y = pos.y + 5, z = pos.z},
  441.                 [15] = {x = pos.x + 4, y = pos.y + 5, z = pos.z},
  442.                 [16] = {x = pos.x - 3, y = pos.y + 6, z = pos.z},
  443.                 [17] = {x = pos.x - 1, y = pos.y + 6, z = pos.z},
  444.                 [18] = {x = pos.x + 1, y = pos.y + 6, z = pos.z},
  445.                 [19] = {x = pos.x + 3, y = pos.y + 6, z = pos.z},
  446.             },
  447.             [3] = {
  448.                 [1] = {x = pos.x - 1, y = pos.y, z = pos.z},
  449.                 [2] = {x = pos.x - 2, y = pos.y - 1, z = pos.z},
  450.                 [3] = {x = pos.x - 2, y = pos.y + 1, z = pos.z},
  451.                 [4] = {x = pos.x - 3, y = pos.y, z = pos.z},
  452.                 [5] = {x = pos.x - 3, y = pos.y - 2, z = pos.z},
  453.                 [6] = {x = pos.x - 3, y = pos.y + 2, z = pos.z},
  454.                 [7] = {x = pos.x - 4, y = pos.y - 3, z = pos.z},
  455.                 [8] = {x = pos.x - 4, y = pos.y - 1, z = pos.z},
  456.                 [9] = {x = pos.x - 4, y = pos.y + 1, z = pos.z},
  457.                 [10] = {x = pos.x - 4, y = pos.y + 3, z = pos.z},
  458.                 [11] = {x = pos.x - 5, y = pos.y, z = pos.z},
  459.                 [12] = {x = pos.x - 5, y = pos.y - 4, z = pos.z},
  460.                 [13] = {x = pos.x - 5, y = pos.y - 2, z = pos.z},
  461.                 [14] = {x = pos.x - 5, y = pos.y + 2, z = pos.z},
  462.                 [15] = {x = pos.x - 5, y = pos.y + 4, z = pos.z},
  463.                 [16] = {x = pos.x - 6, y = pos.y - 3, z = pos.z},
  464.                 [17] = {x = pos.x - 6, y = pos.y - 1, z = pos.z},
  465.                 [18] = {x = pos.x - 6, y = pos.y + 1, z = pos.z},
  466.                 [19] = {x = pos.x - 6, y = pos.y + 3, z = pos.z},
  467.             }
  468.         }
  469.         local area = info[direction][randomiclist[randomarea][turn+1]]
  470.         if getTopCreature(area).uid > 0 and isCreature(getTopCreature(area).uid) then
  471.             doTargetCombatHealth(cid, getTopCreature(area).uid, type, min/2, max/2, 2)
  472.         end
  473.         doSendMagicEffect(area, effect)
  474.         if shoteffect then
  475.             doSendDistanceShoot(getThingPos(cid), area, shoteffect)
  476.         end
  477.     end
  478.     local randomarea = math.random(1, 5)
  479.     for i = 0, 9 do
  480.         addEvent(doSendFrontalCombat, i * 100, cid, i, randomarea)
  481.     end
  482.     local area = {
  483.         [0] = frontalN,
  484.         [1] = frontalE,
  485.         [2] = frontalS,
  486.             [3] = frontalW
  487.     }
  488.     doAreaCombatHealth(cid, type, getThingPos(cid), area[getCreatureDirectionToTarget(cid, target)], min, max, 2)
  489. end
  490.  
  491. function doCastMove(cid, move, target, min, max)
  492.     if not isCreature(cid) or isPlayer(cid) then return true end
  493.     for i = 1, #silenceStatus do
  494.         if getPokemonStatus(cid, silenceStatus[i]) then return true end
  495.     end
  496.     local target = target or isCreature(getMasterTarget(cid)) and getMasterTarget(cid) or 0
  497.     local myPos = isCreature(cid) and getThingPos(cid) or nil
  498.     local targetPos = isCreature(target) and getThingPos(target) or nil
  499.     local myDirection = getCreatureDirectionToTarget(cid, target)
  500.     local master = isSummon(cid) and getCreatureMaster(cid) or 0
  501.     local pokeLevel = getMasterLevel(cid)
  502.     if isCreature(master) then
  503.         doAddCondition(master, fightcondition)
  504.     end
  505.  
  506.     if min and max then
  507.         min = math.abs(min)
  508.         max = math.abs(max)
  509.     else
  510.         min = (getPokemonSpAttack(getCreatureName(cid)) + (getPokemonPowerMove(cid, move) * 5)) * pokeLevel * 0.0175
  511.         max = min + pokeLevel
  512.         if move == "Selfdestruct" then
  513.             min = getCreatureHealth(cid)
  514.             max = getCreatureHealth(cid)
  515.         end
  516.     end
  517.  
  518.     if getPlayerStorageValue(cid, storages.focus) and getPlayerStorageValue(cid, storages.focus) == 1 and getPokemonPowerMove(cid, move) > 0 then
  519.         min = min * 2
  520.         max = max * 2
  521.         doSendMagicEffect(myPos, 117)
  522.         setPlayerStorageValue(cid, storages.focus, 0)
  523.     end
  524.  
  525.     if not isInArray({"Attack", "Fury", "Electric Charge", "Melody", "Lifesteal"}, move) and not isSummon(cid) then
  526.         doCreatureSay(cid, string.upper(move).."!", TALKTYPE_MONSTER)
  527.     end
  528.  
  529.     if doMissChance(cid, move) then return true end
  530.  
  531.     if move == "Attack" then
  532.         if isWild(cid) then
  533.             local modifier = 1.2 * getMultiplier("normal", target)
  534.             local defPercent =  1 - (getPokemonDefense(getCreatureName(cid))/255)
  535.             hit = math.ceil((getAttackValue(cid) * defPercent) * modifier)
  536.             if getPokemonStatus(cid, "rage") then
  537.                 hit = hit * 2
  538.             end
  539.             if getPokemonStatus(target, "harden") then
  540.                 hit = math.ceil(hit * 0.75)
  541.             end
  542.             if isCreature(target) and tonumber(getCreatureHealth(target)) - hit <= 0 then
  543.                 hit = getCreatureHealth(target)
  544.             end
  545.         elseif isSummon(cid) then
  546.             local modifier = tableFome[getFeedStatus(cid)].hitMultiplier * getMultiplier("normal", target) * getPlayerFightModeOffense(master)
  547.             local defPercent = 1 - (getPokemonDefense(getCreatureName(cid))/255)
  548.             hit = math.ceil((getAttackValue(cid) * defPercent) * modifier)
  549.             if getPokemonStatus(cid, "rage") then
  550.                 hit = hit * 2
  551.             end
  552.             if getPokemonStatus(target, "harden") then
  553.                 hit = math.ceil(hit * 0.75)
  554.             end
  555.             if isCreature(cid) and tonumber(getCreatureHealth(cid)) - hit <= 0 then
  556.                 hit = getCreatureHealth(cid)
  557.             end
  558.         end
  559.         if isInArray({"Butterfree"}, getCreatureName(cid)) then
  560.             doActivePassiveWithDamage(cid, target)
  561.             doTargetCombatHealth(cid, target, COMBAT_GHOSTDAMAGE, hit, hit, 154)
  562.             doSendDistanceShoot(myPos, targetPos, 53)
  563.         elseif isInArray({"Zubat", "Golbat"}, getCreatureName(cid)) then
  564.             doActivePassiveWithDamage(cid, target)
  565.         else
  566.             if getDistanceBetween(myPos, targetPos) <= 1 then
  567.                 doActivePassiveWithDamage(cid, target)
  568.                 doTargetCombatHealth(cid, target, COMBAT_NORMALDAMAGE, hit, hit, 3)
  569.             end
  570.         end
  571.     elseif move == "Tackle" or move == "Headbutt" or move == "Scratch" or move == "Quick Attack" or move == "Super Fang" then
  572.         local effect = (move == "Tackle" or move == "Quick Attack") and 104 or move == "Headbutt" and 88 or move == "Scratch" and 119 or 151
  573.         doSendDistanceShoot(myPos, targetPos, 40)
  574.         doTargetCombatHealth(cid, target, COMBAT_NORMALDAMAGE, min, max, effect)
  575.     elseif move == "Razor Leaf" then
  576.         local function doSendMove(cid, target)
  577.             if not isCreature(cid) or not isCreature(target) then return true end
  578.             if getPokemonStatus(cid, "sleep") then return true end
  579.             local myPos = isCreature(cid) and getThingPos(cid) or nil
  580.             local targetPos = isCreature(target) and getThingPos(target) or nil
  581.             doTargetCombatHealth(cid, target, COMBAT_GRASSDAMAGE, min/2, max/2, 105)
  582.             doSendDistanceShoot(myPos, targetPos, 47)
  583.         end
  584.         for i = 0, 1 do
  585.             addEvent(doSendMove, i * 250, cid, target)
  586.         end
  587.     elseif move == "Vine Whip" then
  588.         local function doSendMove(cid, area)
  589.             if not isCreature(cid) or not isCreature(target) then return true end
  590.             if getPokemonStatus(cid, "sleep") then return true end
  591.             doAreaCombatHealth(cid, COMBAT_GRASSDAMAGE, myPos, area, min/2, max/2, 2)
  592.         end
  593.         local info = {
  594.             [0] = {106, vineWhipN, {x = myPos.x + 1, y = myPos.y - 1, z = myPos.z}},
  595.             [1] = {107, vineWhipE, {x = myPos.x + 2, y = myPos.y + 1, z = myPos.z}},
  596.             [2] = {108, vineWhipS, {x = myPos.x + 1, y = myPos.y + 2, z = myPos.z}},
  597.             [3] = {109, vineWhipW, {x = myPos.x - 1, y = myPos.y + 1, z = myPos.z}}
  598.         }
  599.         doSendMagicEffect(info[myDirection][3], info[myDirection][1])
  600.         for i = 0, 1 do
  601.             addEvent(doSendMove, i * 500, cid, info[myDirection][2])
  602.         end
  603.     elseif move == "Leech Seed" then
  604.         doSendDistanceShoot(myPos, targetPos, 48)
  605.         doTargetCombatHealth(cid, target, STATUS_LEECHSEED, pokeLevel, pokeLevel, 2)
  606.     elseif move == "Solar Beam" then
  607.         local function doSendMove(cid)
  608.             if not isCreature(cid) then return true end
  609.             if getPokemonStatus(cid, "sleep") then return true end
  610.             local pos = getThingPos(cid)
  611.             local info = {
  612.                 [0] = {110, solarBeamN, {x = pos.x + 1, y = pos.y - 1, z = pos.z}},
  613.                 [1] = {111, solarBeamE, {x = pos.x + 6, y = pos.y + 1, z = pos.z}},
  614.                 [2] = {112, solarBeamS, {x = pos.x + 1, y = pos.y + 6, z = pos.z}},
  615.                 [3] = {113, solarBeamW, {x = pos.x - 1, y = pos.y + 1, z = pos.z}}
  616.             }
  617.             doSendMagicEffect(info[getCreatureDirectionToTarget(cid, target)][3], info[getCreatureDirectionToTarget(cid, target)][1])
  618.             doAreaCombatHealth(cid, COMBAT_GRASSDAMAGE, pos, info[getCreatureDirectionToTarget(cid, target)][2], min, max, 2)
  619.         end
  620.         doSendMagicEffect(myPos, 117)
  621.         addEvent(doSendMove, 500, cid)
  622.     elseif move == "Sleep Powder" then
  623.         doAreaCombatHealth(cid, STATUS_SLEEP, myPos, circle2x2, 5, 5, 114)
  624.     elseif move == "Stun Spore" then
  625.         doAreaCombatHealth(cid, STATUS_STUN, myPos, circle2x2, 10, 10, 115)
  626.     elseif move == "Poison Powder" then
  627.         doAreaCombatHealth(cid, STATUS_POISON20, myPos, circle2x2, pokeLevel, pokeLevel, 116)
  628.     elseif move == "Bullet Seed" then
  629.         doFrontalCombatHealth(cid, myPos, COMBAT_GRASSDAMAGE, min, max, 45, 48)
  630.     elseif move == "Giga Drain" then
  631.         doTargetCombatHealth(cid, target, ABSORB_GRASS, min, max, 118)
  632.         doSendMagicEffect(myPos, 117)
  633.         doSendDistanceShoot(myPos, targetPos, 49)
  634.     elseif move == "Leaf Storm" then
  635.         local function doSendMove(cid)
  636.             if not isCreature(cid) then return true end
  637.             if getPokemonStatus(cid, "sleep") then return true end
  638.             local myPos = getThingPos(cid)
  639.             local pos = {x = myPos.x + math.random(-4, 4), y = myPos.y + math.random(-4, 4), z = myPos.z}
  640.             if getTopCreature(pos).uid > 0 and isCreature(getTopCreature(pos).uid) then
  641.                 doTargetCombatHealth(cid, getTopCreature(pos).uid, COMBAT_GRASSDAMAGE, min/2, max/2, 2)
  642.             end
  643.             if getThingFromPos(pos).itemid ~= 0 then
  644.                 doSendDistanceShoot(myPos, pos, 47)
  645.                 doSendMagicEffect(pos, 105)
  646.             end
  647.         end
  648.         for i = 0, 9 do
  649.             addEvent(doSendMove, i * 100, cid)
  650.         end
  651.         doAreaCombatHealth(cid, COMBAT_GRASSDAMAGE, myPos, square4x4, min, max, 2)
  652.     elseif move == "Ember" then
  653.         doSendDistanceShoot(myPos, targetPos, 3)
  654.         doTargetCombatHealth(cid, target, COMBAT_FIREDAMAGE, min, max, 2)
  655.     elseif move == "Flamethrower" then
  656.         local info = {
  657.             [0] = {120, throwerN, {x = myPos.x + 1, y = myPos.y - 1, z = myPos.z}},
  658.             [1] = {121, throwerE, {x = myPos.x + 3, y = myPos.y + 1, z = myPos.z}},
  659.             [2] = {122, throwerS, {x = myPos.x + 1, y = myPos.y + 3, z = myPos.z}},
  660.             [3] = {123, throwerW, {x = myPos.x - 1, y = myPos.y + 1, z = myPos.z}}
  661.         }
  662.         doSendMagicEffect(info[myDirection][3], info[myDirection][1])
  663.         doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, myPos, info[myDirection][2], min, max, 2)
  664.         doAreaCombatHealth(cid, STATUS_BURN10, myPos, info[myDirection][2], pokeLevel, pokeLevel, 2)
  665.     elseif move == "Fireball" then
  666.         doSendDistanceShoot(myPos, targetPos, 3)
  667.         doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, targetPos, circle2x2, min, max, 6)
  668.         doTargetCombatHealth(cid, target, COMBAT_FIREDAMAGE, min, max, 6)
  669.         doAreaCombatHealth(cid, STATUS_BURN5, targetPos, circle2x2, pokeLevel, pokeLevel, 2)
  670.         doTargetCombatHealth(cid, target, STATUS_BURN5, pokeLevel, pokeLevel, 2)
  671.     elseif move == "Fire Fang" then
  672.         doSendMagicEffect(targetPos, 36)
  673.         doSendDistanceShoot(myPos, targetPos, 3)
  674.         doTargetCombatHealth(cid, target, COMBAT_FIREDAMAGE, min, max, 124)
  675.         doTargetCombatHealth(cid, target, STATUS_BURN10, pokeLevel, pokeLevel, 2)
  676.     elseif move == "Fire Blast" then
  677.         local function doSendMove(cid, area, effect, turn)
  678.             if not isCreature(cid) then return true end
  679.             if getPokemonStatus(cid, "sleep") then return true end
  680.             doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, area, line1x1, min, max, 36)
  681.             doAreaCombatHealth(cid, STATUS_BURN5, area, line1x1, pokeLevel, pokeLevel, 2)
  682.             doSendMagicEffect(area, effect)
  683.             if turn >= 6 then
  684.                 doRegainSpeed(cid)
  685.                 doCreatureSetNoMove(cid, false)
  686.             end
  687.         end
  688.         doChangeSpeed(cid, -getCreatureSpeed(cid))
  689.         doCreatureSetNoMove(cid, true)
  690.         for i = 0, 5 do
  691.             local info = {
  692.                 [0] = {125, {x = myPos.x, y = myPos.y - (i+1), z = myPos.z}},
  693.                 [1] = {126, {x = myPos.x + (i+1), y = myPos.y, z = myPos.z}},
  694.                 [2] = {127, {x = myPos.x, y = myPos.y + (i+1), z = myPos.z}},
  695.                 [3] = {128, {x = myPos.x - (i+1), y = myPos.y, z = myPos.z}}
  696.             }
  697.             addEvent(doSendMove, i * 300, cid, info[myDirection][2], info[myDirection][1], i+1)
  698.         end
  699.     elseif move == "Rage" then
  700.         setPokemonStatus(cid, "rage", 20, 0, true, 0)
  701.     elseif move == "Flame Burst" then
  702.         doFrontalCombatHealth(cid, myPos, COMBAT_FIREDAMAGE, min, max, 6, 3)
  703.     elseif move == "Wing Attack" then
  704.         local info = {
  705.             [0] = {129, {x = myPos.x + 1, y = myPos.y - 1, z = myPos.z}, {x = myPos.x, y = myPos.y - 1, z = myPos.z}},
  706.             [1] = {130, {x = myPos.x + 2, y = myPos.y + 1, z = myPos.z}, {x = myPos.x + 1, y = myPos.y, z = myPos.z}},
  707.             [2] = {131, {x = myPos.x + 1, y = myPos.y + 2, z = myPos.z}, {x = myPos.x, y = myPos.y + 1, z = myPos.z}},
  708.             [3] = {132, {x = myPos.x - 1, y = myPos.y + 1, z = myPos.z}, {x = myPos.x - 1, y = myPos.y, z = myPos.z}}
  709.         }
  710.         doSendMagicEffect(info[myDirection][2], info[myDirection][1])
  711.         doAreaCombatHealth(cid, COMBAT_FLYINGDAMAGE, info[myDirection][3], line1x1, min, max, 2)
  712.     elseif move == "Air Slash" then
  713.         local info = {
  714.             [1] = {133, 129, {x = myPos.x + 1, y = myPos.y - 1, z = myPos.z}},
  715.             [2] = {134, 130, {x = myPos.x + 2, y = myPos.y + 1, z = myPos.z}},
  716.             [3] = {135, 131, {x = myPos.x + 1, y = myPos.y + 2, z = myPos.z}},
  717.             [4] = {136, 132, {x = myPos.x - 1, y = myPos.y + 1, z = myPos.z}}
  718.         }
  719.         for i = 1, 4 do
  720.             doSendMagicEffect(info[i][3], info[i][1])
  721.             addEvent(doSendMagicEffect, 500, info[i][3], info[i][2])
  722.         end
  723.         doAreaCombatHealth(cid, COMBAT_FLYINGDAMAGE, myPos, circle2x2, min/2, max/2, 2)
  724.         addEvent(doAreaCombatHealth, 500, cid, COMBAT_FLYINGDAMAGE, myPos, circle2x2, min/2, max/2, 2)
  725.     elseif move == "Magma Storm" then
  726.         local function doSendMove(cid, area, effect, turn)
  727.             if not isCreature(cid) then return true end
  728.             if getPokemonStatus(cid, "sleep") then return true end
  729.             doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, myPos, area, min, max, effect)
  730.             if turn >= 5 then
  731.                 doRegainSpeed(cid)
  732.                 doCreatureSetNoMove(cid, false)
  733.             end
  734.         end
  735.         doChangeSpeed(cid, -getCreatureSpeed(cid))
  736.         doCreatureSetNoMove(cid, true)
  737.         for i = 0, 4 do
  738.             local areas = {square1x1, magmaStorm1, magmaStorm2, magmaStorm3, magmaStorm4}
  739.             local effects = {6, 5, 36, 36, 6}
  740.             addEvent(doSendMove, i * 500, cid, areas[i+1], effects[i+1], i+1)
  741.         end
  742.     elseif move == "Scary Face" then
  743.         doSendMagicEffect({x = myPos.x + 1, y = myPos.y + 1, z = myPos.z}, 137)
  744.         doAreaCombatHealth(cid, STATUS_STUN, myPos, circle4x4, 10, 10, 2)
  745.     elseif move == "Bubbles" then
  746.         doSendDistanceShoot(myPos, targetPos, 50)
  747.         doTargetCombatHealth(cid, target, COMBAT_WATERDAMAGE, min, max, 138)
  748.     elseif move == "Water Gun" then
  749.         local info = {
  750.             [0] = {139, missile6N, {x = myPos.x, y = myPos.y - 1, z = myPos.z}},
  751.             [1] = {140, missile6E, {x = myPos.x + 6, y = myPos.y, z = myPos.z}},
  752.             [2] = {141, missile6S, {x = myPos.x, y = myPos.y + 6, z = myPos.z}},
  753.             [3] = {142, missile6W, {x = myPos.x - 1, y = myPos.y, z = myPos.z}}
  754.         }
  755.         doSendMagicEffect(info[myDirection][3], info[myDirection][1])
  756.         doAreaCombatHealth(cid, COMBAT_WATERDAMAGE, myPos, info[myDirection][2], min, max, 2)
  757.     elseif move == "Waterball" then
  758.         doSendDistanceShoot(myPos, targetPos, 50)
  759.         doAreaCombatHealth(cid, COMBAT_WATERDAMAGE, targetPos, circle2x2, min, max, 138)
  760.         doTargetCombatHealth(cid, target, COMBAT_WATERDAMAGE, min, max, 138)
  761.     elseif move == "Aqua Tail" then
  762.         doSendDistanceShoot(myPos, targetPos, 50)
  763.         doTargetCombatHealth(cid, target, COMBAT_WATERDAMAGE, min, max, 138)
  764.     elseif move == "Hydro Cannon" then
  765.         local function doSendMove(cid, area, effect, turn)
  766.             if not isCreature(cid) then return true end
  767.             if getPokemonStatus(cid, "sleep") then return true end
  768.             doAreaCombatHealth(cid, COMBAT_WATERDAMAGE, area, line1x1, min, max, 138)
  769.             doSendMagicEffect(area, effect)
  770.             if turn >= 6 then
  771.                 doRegainSpeed(cid)
  772.                 doCreatureSetNoMove(cid, false)
  773.             end
  774.         end
  775.         doChangeSpeed(cid, -getCreatureSpeed(cid))
  776.         doCreatureSetNoMove(cid, true)
  777.         for i = 0, 5 do
  778.             local info = {
  779.                 [0] = {143, {x = myPos.x, y = myPos.y - (i+1), z = myPos.z}},
  780.                 [1] = {144, {x = myPos.x + (i+1), y = myPos.y, z = myPos.z}},
  781.                 [2] = {145, {x = myPos.x, y = myPos.y + (i+1), z = myPos.z}},
  782.                 [3] = {146, {x = myPos.x - (i+1), y = myPos.y, z = myPos.z}}
  783.             }
  784.             addEvent(doSendMove, i * 300, cid, info[myDirection][2], info[myDirection][1], i+1)
  785.         end
  786.     elseif move == "Harden" then
  787.         setPokemonStatus(cid, "harden", 10, 147, true, 0)
  788.     elseif move == "Brine" then
  789.         doFrontalCombatHealth(cid, myPos, COMBAT_WATERDAMAGE, min, max, 138, 50)
  790.     elseif move == "Water Pulse" then
  791.         doAreaCombatHealth(cid, COMBAT_WATERDAMAGE, myPos, circle3x3, min, max, 148)
  792.     elseif move == "Skull Bash" then
  793.         local function doSendMove(cid, area, turn)
  794.             if not isCreature(cid) then return true end
  795.             if getPokemonStatus(cid, "sleep") then return true end
  796.             doAreaCombatHealth(cid, COMBAT_NORMALDAMAGE, area, line1x1, min, max, 2)
  797.             doAreaCombatHealth(cid, STATUS_STUN, area, line1x1, 8, 8, 2)
  798.             if not isNumberPair(turn) then
  799.                 doSendMagicEffect(area, 149)
  800.             end
  801.             if turn >= 6 then
  802.                 doRegainSpeed(cid)
  803.                 doCreatureSetNoMove(cid, false)
  804.             end
  805.         end
  806.         doChangeSpeed(cid, -getCreatureSpeed(cid))
  807.         doCreatureSetNoMove(cid, true)
  808.         for i = 0, 5 do
  809.             local info = {
  810.                 [0] = {x = myPos.x, y = myPos.y - (i+1), z = myPos.z},
  811.                 [1] = {x = myPos.x + (i+1), y = myPos.y, z = myPos.z},
  812.                 [2] = {x = myPos.x, y = myPos.y + (i+1), z = myPos.z},
  813.                 [3] = {x = myPos.x - (i+1), y = myPos.y, z = myPos.z}
  814.             }
  815.             addEvent(doSendMove, i * 300, cid, info[myDirection], i+1)
  816.         end
  817.     elseif move == "Hydropump" then
  818.         local function doSendMove(cid)
  819.             if not isCreature(cid) then return true end
  820.             if getPokemonStatus(cid, "sleep") then return true end
  821.             local myPos = getThingPos(cid)
  822.             local pos = {x = myPos.x + math.random(-4, 4), y = myPos.y + math.random(-4, 4), z = myPos.z}
  823.             if getTopCreature(pos).uid > 0 and isCreature(getTopCreature(pos).uid) then
  824.                 doTargetCombatHealth(cid, getTopCreature(pos).uid, COMBAT_WATERDAMAGE, min/2, max/2, 2)
  825.             end
  826.             if getThingFromPos(pos).itemid ~= 0 then
  827.                 doSendDistanceShoot(myPos, pos, 50)
  828.                 doSendMagicEffect(pos, 53)
  829.             end
  830.         end
  831.         for i = 0, 9 do
  832.             addEvent(doSendMove, i * 100, cid)
  833.         end
  834.         doAreaCombatHealth(cid, COMBAT_WATERDAMAGE, myPos, square4x4, min, max, 2)
  835.     elseif move == "String Shot" then
  836.         doSendDistanceShoot(myPos, targetPos, 51)
  837.         doTargetCombatHealth(cid, target, STATUS_STRING, 5, 5, 2)
  838.     elseif move == "Bug Bite" then
  839.         doSendDistanceShoot(myPos, targetPos, 40)
  840.         doTargetCombatHealth(cid, target, COMBAT_BUGDAMAGE, min, max, 8)
  841.     elseif move == "Super Sonic" then
  842.         doSendDistanceShoot(myPos, targetPos, 52)
  843.         doTargetCombatHealth(cid, target, STATUS_CONFUSION10, 31, 31, 2)
  844.     elseif move == "Silver Wind" then
  845.         doSendDistanceShoot(myPos, targetPos, 51)
  846.         doAreaCombatHealth(cid, COMBAT_BUGDAMAGE, targetPos, cross1x1, min, max, 152)
  847.         doSendMagicEffect(targetPos, 153)
  848.     elseif move == "Whirlwind" then
  849.         local function doSendMove(cid, area, turn)
  850.             if not isCreature(cid) then return true end
  851.             if getPokemonStatus(cid, "sleep") then return true end
  852.             doAreaCombatHealth(cid, COMBAT_FLYINGDAMAGE, myPos, area, min/2, max/2, 159)
  853.             if turn >= 4 then
  854.                 doRegainSpeed(cid)
  855.                 doCreatureSetNoMove(cid, false)
  856.             end
  857.         end
  858.         doChangeSpeed(cid, -getCreatureSpeed(cid))
  859.         doCreatureSetNoMove(cid, true)
  860.         local info = {
  861.             [0] = {whirlwindN1, whirlwindN2, whirlwindN3, whirlwindN4},
  862.             [1] = {whirlwindE1, whirlwindE2, whirlwindE3, whirlwindE4},
  863.             [2] = {whirlwindS1, whirlwindS2, whirlwindS3, whirlwindS4},
  864.             [3] = {whirlwindW1, whirlwindW2, whirlwindW3, whirlwindW4}
  865.         }
  866.         for i = 0, 3 do
  867.             addEvent(doSendMove, i * 250, cid, info[myDirection][i+1], i)
  868.         end
  869.         for i = 1, 4 do
  870.             addEvent(doSendMove, i * 250, cid, info[myDirection][i], i)
  871.         end
  872.     elseif move == "Confusion" then
  873.         doAreaCombatHealth(cid, COMBAT_PSYCHICDAMAGE, myPos, circle3x3, min, max, 154)
  874.     elseif move == "Psybeam" then
  875.         for i = 1, 6 do
  876.             local info = {
  877.                 [0] = {155, {x = myPos.x, y = myPos.y - i, z = myPos.z}},
  878.                 [1] = {156, {x = myPos.x + i, y = myPos.y, z = myPos.z}},
  879.                 [2] = {157, {x = myPos.x, y = myPos.y + i, z = myPos.z}},
  880.                 [3] = {158, {x = myPos.x - i, y = myPos.y, z = myPos.z}}
  881.             }
  882.             doAreaCombatHealth(cid, COMBAT_PSYCHICDAMAGE, info[myDirection][2], nil, min, max, info[myDirection][1])
  883.         end
  884.     elseif move == "Air Cutter" then
  885.         local function doSendMove(cid, area, effect, turn)
  886.             if not isCreature(cid) then return true end
  887.             if getPokemonStatus(cid, "sleep") then return true end
  888.             doAreaCombatHealth(cid, COMBAT_FLYINGDAMAGE, area, line1x1, min, max, 2)
  889.             doSendMagicEffect(area, effect)
  890.             if turn >= 6 then
  891.                 doRegainSpeed(cid)
  892.                 doCreatureSetNoMove(cid, false)
  893.             end
  894.         end
  895.         doChangeSpeed(cid, -getCreatureSpeed(cid))
  896.         doCreatureSetNoMove(cid, true)
  897.         for i = 0, 5 do
  898.             local info = {
  899.                 [0] = {129, {x = myPos.x + 1, y = myPos.y - (i+1), z = myPos.z}},
  900.                 [1] = {130, {x = myPos.x + (i+2), y = myPos.y + 1, z = myPos.z}},
  901.                 [2] = {131, {x = myPos.x + 1, y = myPos.y + (i+2), z = myPos.z}},
  902.                 [3] = {132, {x = myPos.x - (i+1), y = myPos.y + 1, z = myPos.z}}
  903.             }
  904.             addEvent(doSendMove, i * 300, cid, info[myDirection][2], info[myDirection][1], i+1)
  905.         end
  906.     elseif move == "Safeguard" then
  907.         doClearPokemonStatus(cid)
  908.         doSendMagicEffect(myPos, 1)
  909.     elseif move == "Horn Attack" then
  910.         local function doSendMove(cid, target)
  911.             if not isCreature(cid) or not isCreature(target) then return true end
  912.             if getPokemonStatus(cid, "sleep") then return true end
  913.             local myPos = isCreature(cid) and getThingPos(cid) or nil
  914.             local targetPos = isCreature(target) and getThingPos(target) or nil
  915.             doSendDistanceShoot(myPos, targetPos, 54)
  916.             doTargetCombatHealth(cid, target, COMBAT_NORMALDAMAGE, min/5, max/5, 3)
  917.         end
  918.         for i = 0, 4 do
  919.             addEvent(doSendMove, i * 150, cid, target)
  920.         end
  921.     elseif move == "Poison Sting" then
  922.         doSendDistanceShoot(myPos, targetPos, 54)
  923.         doTargetCombatHealth(cid, target, COMBAT_POISONDAMAGE, min, max, 8)
  924.     elseif move == "Poison Jab" then
  925.         doSendDistanceShoot(myPos, targetPos, 54)
  926.         doTargetCombatHealth(cid, target, COMBAT_POISONDAMAGE, min, max, 160)
  927.         doTargetCombatHealth(cid, target, STATUS_POISON10, pokeLevel, pokeLevel, 2)
  928.     elseif move == "Fury Cutter" then
  929.         local function doSendMove(cid)
  930.             if not isCreature(cid) then return true end
  931.             if getPokemonStatus(cid, "sleep") then return true end
  932.             local myPos = isCreature(cid) and getThingPos(cid) or nil
  933.             local myDirection = getCreatureDirectionToTarget(cid, target)
  934.             local info = {
  935.                 [0] = {129, {x = myPos.x + 1, y = myPos.y - 1, z = myPos.z}, {x = myPos.x, y = myPos.y - 1, z = myPos.z}},
  936.                 [1] = {130, {x = myPos.x + 2, y = myPos.y + 1, z = myPos.z}, {x = myPos.x + 1, y = myPos.y, z = myPos.z}},
  937.                 [2] = {131, {x = myPos.x + 1, y = myPos.y + 2, z = myPos.z}, {x = myPos.x, y = myPos.y + 1, z = myPos.z}},
  938.                 [3] = {132, {x = myPos.x - 1, y = myPos.y + 1, z = myPos.z}, {x = myPos.x - 1, y = myPos.y, z = myPos.z}}
  939.             }
  940.             doSendMagicEffect(info[myDirection][2], info[myDirection][1])
  941.             doAreaCombatHealth(cid, COMBAT_BUGDAMAGE, info[myDirection][3], line1x1, min/2, max/2, 2)
  942.         end
  943.         for i = 0, 1 do
  944.             addEvent(doSendMove, i * 500, cid)
  945.         end
  946.     elseif move == "Pin Missile" then
  947.         doFrontalCombatHealth(cid, myPos, COMBAT_BUGDAMAGE, min, max, 16, 55)
  948.     elseif move == "Toxic Spikes" then
  949.         local function doSendMove(cid, target)
  950.             if not isCreature(cid) or not isCreature(target) then return true end
  951.             if getPokemonStatus(cid, "sleep") then return true end
  952.             local myPos = isCreature(cid) and getThingPos(cid) or nil
  953.             local targetPos = isCreature(target) and getThingPos(target) or nil
  954.             doSendDistanceShoot(myPos, targetPos, 54)
  955.             doTargetCombatHealth(cid, target, COMBAT_NORMALDAMAGE, min/5, max/5, 161)
  956.         end
  957.         for i = 0, 4 do
  958.             addEvent(doSendMove, i * 150, cid, target)
  959.         end
  960.     elseif move == "Strafe" then
  961.         setPokemonStatus(cid, "strafe", 20, 0, true, 0)
  962.     elseif move == "Sand Attack" then
  963.         for i = 1, 3 do
  964.             local info = {
  965.                 [0] = {162, {x = myPos.x, y = myPos.y - i, z = myPos.z}, {x = myPos.x, y = myPos.y - 1, z = myPos.z}},
  966.                 [1] = {163, {x = myPos.x + i, y = myPos.y, z = myPos.z}, {x = myPos.x + 3, y = myPos.y, z = myPos.z}},
  967.                 [2] = {164, {x = myPos.x, y = myPos.y + i, z = myPos.z}, {x = myPos.x, y = myPos.y + 3, z = myPos.z}},
  968.                 [3] = {165, {x = myPos.x - i, y = myPos.y, z = myPos.z}, {x = myPos.x - 1, y = myPos.y, z = myPos.z}}
  969.             }
  970.             doAreaCombatHealth(cid, STATUS_BLIND, info[myDirection][2], nil, 5, 5, 2)
  971.             if i == 1 then
  972.                 doSendMagicEffect(info[myDirection][3], info[myDirection][1])
  973.             end
  974.         end
  975.     elseif move == "Gust" then
  976.         local function doSendMove(cid, turn)
  977.             if not isCreature(cid) then return true end
  978.             if getPokemonStatus(cid, "sleep") then return true end
  979.             local info = {
  980.                 [0] = {x = myPos.x, y = myPos.y - turn, z = myPos.z},
  981.                 [1] = {x = myPos.x + turn, y = myPos.y, z = myPos.z},
  982.                 [2] = {x = myPos.x, y = myPos.y + turn, z = myPos.z},
  983.                 [3] = {x = myPos.x - turn, y = myPos.y, z = myPos.z}
  984.             }
  985.             doAreaCombatHealth(cid, COMBAT_FLYINGDAMAGE, info[myDirection], nil, min, max, 2)
  986.             if not isNumberPair(turn) then
  987.                 doSendMagicEffect(info[myDirection], 159)
  988.             end
  989.         end
  990.         for i = 0, 4 do
  991.             addEvent(doSendMove, i * 150, cid, i+1)
  992.         end
  993.     elseif move == "Drill Peck" then
  994.         for i = 0, 2 do
  995.             addEvent(doTargetCombatHealth, i * 100, cid, target, COMBAT_FLYINGDAMAGE, min/3, max/3, 2)
  996.         end
  997.         doSendMagicEffect(targetPos, 166)
  998.     elseif move == "Aeroblast" then
  999.         local function doSendMove(cid)
  1000.             if not isCreature(cid) then return true end
  1001.             if getPokemonStatus(cid, "sleep") then return true end
  1002.             local myPos = getThingPos(cid)
  1003.             local pos = {x = myPos.x + math.random(-4, 4), y = myPos.y + math.random(-4, 4), z = myPos.z}
  1004.             if getTopCreature(pos).uid > 0 and isCreature(getTopCreature(pos).uid) then
  1005.                 doTargetCombatHealth(cid, getTopCreature(pos).uid, COMBAT_FLYINGDAMAGE, min/2, max/2, 2)
  1006.             end
  1007.             if getThingFromPos(pos).itemid ~= 0 then
  1008.                 doSendDistanceShoot(myPos, pos, 56)
  1009.                 doSendMagicEffect(pos, 159)
  1010.             end
  1011.         end
  1012.         for i = 0, 9 do
  1013.             addEvent(doSendMove, i * 100, cid)
  1014.         end
  1015.         doAreaCombatHealth(cid, COMBAT_FLYINGDAMAGE, myPos, square4x4, min, max, 2)
  1016.     elseif move == "Hurricane" then
  1017.         local function doSendMove(cid, turn)
  1018.             if not isCreature(cid) then return true end
  1019.             local turn = turn or 1
  1020.             local event = addEvent(doSendMove, 500, cid, turn + 1)
  1021.             doAreaCombatHealth(cid, COMBAT_FLYINGDAMAGE, getThingPos(cid), square1x1, (min/20), (max/20), 159)
  1022.             if turn == 20 or getPokemonStatus(cid, "sleep") then
  1023.                 doRemoveCondition(cid, CONDITION_OUTFIT)
  1024.                 stopEvent(event)
  1025.             end
  1026.         end
  1027.         setPokemonStatus(cid, "speedUp", 20, 0, true, 0)
  1028.         doSetCreatureOutfit(cid, {lookType = 250}, -1)
  1029.         doSendMove(cid)
  1030.     elseif move == "Agility" then
  1031.         setPokemonStatus(cid, "strafe", 20, 0, true, 0)
  1032.         setPokemonStatus(cid, "speedUp", 10, 0, true, 0)
  1033.     elseif move == "Roost" then
  1034.         local healMin = (getCreatureMaxHealth(cid) * 40) / 100
  1035.         local healMax = healMin + pokeLevel
  1036.         local heal = math.random(healMin, healMax)
  1037.         if getCreatureHealth(cid) + heal > getCreatureMaxHealth(cid) then
  1038.             heal = getCreatureMaxHealth(cid) - getCreatureHealth(cid)
  1039.         end
  1040.         if heal > 0 then
  1041.             doSendAnimatedText(myPos, "+"..heal, 35)
  1042.             doCreatureAddHealth(cid, heal)
  1043.         end
  1044.         doSendMagicEffect(myPos, 167)
  1045.         if isSummon(cid) then
  1046.             doOTCSendPokemonHealth(master)
  1047.         end
  1048.     elseif move == "Bite" then
  1049.         doSendDistanceShoot(myPos, targetPos, 40)
  1050.         doTargetCombatHealth(cid, target, COMBAT_DARKDAMAGE, min, max, 168)
  1051.     elseif move == "Pursuit" then
  1052.         local function doSendMove(cid, target, turn)
  1053.             if not isCreature(cid) or not isCreature(target) then return true end
  1054.             if getPokemonStatus(cid, "sleep") then return true end
  1055.             local myPos = getThingPos(cid)
  1056.             local targetPos = getThingPos(target)
  1057.             local randomPos = getClosestFreeTile(cid, targetPos)
  1058.             if turn == 1 then
  1059.                 doSendDistanceShoot(myPos, targetPos, 57)
  1060.                 doSendMagicEffect(myPos, 95)
  1061.                 doChangeSpeed(cid, -getCreatureSpeed(cid))
  1062.                 doCreatureSetNoMove(cid, true)
  1063.                 setCreatureVisibility(cid, true)
  1064.             elseif turn == 2 then
  1065.                 doSendDistanceShoot(randomPos, targetPos, 57)
  1066.                 doSendMagicEffect(randomPos, 95)
  1067.                 doTargetCombatHealth(cid, target, COMBAT_DARKDAMAGE, min, max, 2)
  1068.             elseif turn == 3 then
  1069.                 doSendDistanceShoot(targetPos, myPos, 57)
  1070.                 doSendMagicEffect(myPos, 95)
  1071.                 doRegainSpeed(cid)
  1072.                 doCreatureSetNoMove(cid, false)
  1073.                 setCreatureVisibility(cid, false)
  1074.             end
  1075.         end
  1076.         for i = 0, 2 do
  1077.             addEvent(doSendMove, i * 500, cid, target, i+1)
  1078.         end
  1079.     elseif move == "Peck" then
  1080.         doSendDistanceShoot(myPos, targetPos, 40)
  1081.         doTargetCombatHealth(cid, target, COMBAT_FLYINGDAMAGE, min, max, 104)
  1082.     elseif move == "Aerial Ace" then
  1083.         local function doSendMoveDamage(cid)
  1084.             if not isCreature(cid) then return true end
  1085.             doAreaCombatHealth(cid, COMBAT_FLYINGDAMAGE, myPos, square4x4, min, max, 2)
  1086.         end
  1087.         for i = 0, 19 do
  1088.             addEvent(doSendMoveEffectDown, i * 50, cid, math.random(133, 136))
  1089.         end
  1090.         addEvent(doSendMoveDamage, 1000, cid)
  1091.     elseif move == "Poison Fang" then
  1092.         doSendDistanceShoot(myPos, targetPos, 40)
  1093.         doTargetCombatHealth(cid, target, COMBAT_POISONDAMAGE, min, max, 151)
  1094.         doTargetCombatHealth(cid, target, STATUS_POISON5, pokeLevel, pokeLevel, 2)
  1095.     elseif move == "Gunk Shot" then
  1096.         local function doSendMove(cid, target)
  1097.             if not isCreature(cid) or not isCreature(target) then return true end
  1098.             if getPokemonStatus(cid, "sleep") then return true end
  1099.             local myPos = isCreature(cid) and getThingPos(cid) or nil
  1100.             local targetPos = isCreature(target) and getThingPos(target) or nil
  1101.             doSendDistanceShoot(myPos, targetPos, 55)
  1102.             doTargetCombatHealth(cid, target, COMBAT_POISONDAMAGE, min/5, max/5, 8)
  1103.         end
  1104.         for i = 0, 4 do
  1105.             addEvent(doSendMove, i * 150, cid, target)
  1106.         end
  1107.     elseif move == "Acid" then
  1108.         doSendDistanceShoot(myPos, targetPos, 14)
  1109.         doTargetCombatHealth(cid, target, COMBAT_POISONDAMAGE, min, max, 20)
  1110.     elseif move == "Fear" then
  1111.         doAreaCombatHealth(cid, STATUS_FEAR, myPos, circle4x4, 6, 6, 2)
  1112.     elseif move == "Wrap" then
  1113.         doSendDistanceShoot(myPos, targetPos, 14)
  1114.         setPokemonStatus(target, "involved", 8, math.random(min, max), true, 0)
  1115.     elseif move == "Iron Tail" then
  1116.         doSendDistanceShoot(myPos, targetPos, 40)
  1117.         doTargetCombatHealth(cid, target, COMBAT_STEELDAMAGE, min, max, 171)
  1118.     elseif move == "Mega Kick" then
  1119.         doSendDistanceShoot(myPos, targetPos, 40)
  1120.         doTargetCombatHealth(cid, target, COMBAT_FIGHTINGDAMAGE, min, max, 172)
  1121.     elseif move == "Thunder Shock" then
  1122.         doSendDistanceShoot(myPos, targetPos, 40)
  1123.         doTargetCombatHealth(cid, target, COMBAT_ELECTRICDAMAGE, min, max, 48)
  1124.     elseif move == "Thunder Bolt" then
  1125.         local function doSendMoveDown(cid, target, toPos)
  1126.             if not isCreature(target) or not isCreature(cid) then return true end
  1127.             doSendDistanceShoot(toPos, getThingPos(target), 58)
  1128.             doTargetCombatHealth(cid, target, COMBAT_ELECTRICDAMAGE, min/2, max/2, 48)
  1129.         end
  1130.         local function doSendMoveUp(cid, target)
  1131.             if not isCreature(cid) or not isCreature(target) then return true end
  1132.             local myPos = getThingPos(cid)
  1133.             local targetPos = getThingPos(target)
  1134.             local toPos = targetPos
  1135.             toPos.x = toPos.x - 6
  1136.             toPos.y = toPos.y - 6
  1137.             doSendDistanceShoot(myPos, toPos, 58)
  1138.             addEvent(doSendMoveDown, 350, cid, target, toPos)
  1139.         end
  1140.         for i = 0, 1 do
  1141.             addEvent(doSendMoveUp, i * 200, cid, target)
  1142.         end
  1143.     elseif move == "Thunder Wave" then
  1144.         local info = {
  1145.             [0] = wave5N,
  1146.             [1] = wave5E,
  1147.             [2] = wave5S,
  1148.             [3] = wave5W
  1149.         }
  1150.         doAreaCombatHealth(cid, STATUS_STUN, myPos, info[myDirection], 10, 10, 2)
  1151.         doAreaCombatHealth(cid, COMBAT_ELECTRICDAMAGE, myPos, info[myDirection], min, max, 48)
  1152.     elseif move == "Thunder Punch" then
  1153.         doSendDistanceShoot(myPos, targetPos, 40)
  1154.         doTargetCombatHealth(cid, target, COMBAT_ELECTRICDAMAGE, min, max, 173)
  1155.     elseif move == "Thunder" then
  1156.         local effectPos = {x = myPos.x + 1, y = myPos.y, z = myPos.z}
  1157.         doSendMagicEffect(effectPos, 194)
  1158.         doAreaCombatHealth(cid, STATUS_STUN, myPos, thunder, 10, 10, 2)
  1159.         doAreaCombatHealth(cid, COMBAT_ELECTRICDAMAGE, myPos, thunder, min, max, 48)
  1160.     elseif move == "Electric Storm" then
  1161.         local function doSendMoveDown(cid)
  1162.             if not isCreature(cid) then return true end
  1163.             for i = 0, 39 do
  1164.                 addEvent(doSendMoveEffectDown, i * 50, cid, 48, 58)
  1165.             end
  1166.         end
  1167.         local function doSendMoveDamage(cid)
  1168.             if not isCreature(cid) then return true end
  1169.             doAreaCombatHealth(cid, STATUS_STUN, myPos, square4x4, 10, 10, 2)
  1170.             doAreaCombatHealth(cid, COMBAT_ELECTRICDAMAGE, myPos, square4x4, min, max, 2)
  1171.         end
  1172.         for i = 0, 19 do
  1173.             addEvent(doSendMoveEffectUp, i * 50, cid, 58)
  1174.         end
  1175.         addEvent(doSendMoveDown, 500, cid)
  1176.         addEvent(doSendMoveDamage, 1500, cid)
  1177.     elseif move == "Body Slam" then
  1178.         local damage = math.random(min, max)
  1179.         local counter = (damage*10/100)
  1180.         doSendDistanceShoot(myPos, targetPos, 40)
  1181.         doTargetCombatHealth(cid, target, COMBAT_NORMALDAMAGE, damage, damage, 88)
  1182.         doCreatureAddHealth(cid, -math.floor(counter), 2, 200, target)
  1183.     elseif move == "Mud Shot" then
  1184.         doSendDistanceShoot(myPos, targetPos, 59)
  1185.         doTargetCombatHealth(cid, target, COMBAT_GROUNDDAMAGE, min, max, 175)
  1186.         doTargetCombatHealth(cid, target, STATUS_BLIND, 6, 6, 2)
  1187.     elseif move == "Rollout" then
  1188.         local outfit = {
  1189.             ["Sandshrew"] = 251,
  1190.             ["Sandslash"] = 252,
  1191.         }
  1192.         local function doSendMove(cid, turn)
  1193.             if not isCreature(cid) then return true end
  1194.             local turn = turn or 1
  1195.             local event = addEvent(doSendMove, 500, cid, turn + 1)
  1196.             doAreaCombatHealth(cid, COMBAT_ROCKDAMAGE, getThingPos(cid), square1x1, (min/20), (max/20), 2)
  1197.             if turn == 20 or getPokemonStatus(cid, "sleep") then
  1198.                 doRemoveCondition(cid, CONDITION_OUTFIT)
  1199.                 stopEvent(event)
  1200.             end
  1201.         end
  1202.         setPokemonStatus(cid, "speedUp", 20, 0, true, 0)
  1203.         doSetCreatureOutfit(cid, {lookType = outfit[getCreatureName(cid)]}, -1)
  1204.         doSendMove(cid)
  1205.     elseif move == "Bulldoze" then
  1206.         local function doSendMove(cid, area, effectarea, effect, turn)
  1207.             if not isCreature(cid) then return true end
  1208.             if getPokemonStatus(cid, "sleep") then return true end
  1209.             doAreaCombatHealth(cid, COMBAT_GROUNDDAMAGE, area, line1x1, min, max, 176)
  1210.             doSendMagicEffect(effectarea, effect)
  1211.             if turn >= 6 then
  1212.                 doRegainSpeed(cid)
  1213.                 doCreatureSetNoMove(cid, false)
  1214.             end
  1215.         end
  1216.         doChangeSpeed(cid, -getCreatureSpeed(cid))
  1217.         doCreatureSetNoMove(cid, true)
  1218.         for i = 0, 5 do
  1219.             local info = {
  1220.                 [0] = {177, {x = myPos.x, y = myPos.y - (i+1), z = myPos.z}, {x = myPos.x + 1, y = myPos.y - i, z = myPos.z}},
  1221.                 [1] = {178, {x = myPos.x + (i+1), y = myPos.y, z = myPos.z}, {x = myPos.x + (i+2), y = myPos.y + 1, z = myPos.z}},
  1222.                 [2] = {179, {x = myPos.x, y = myPos.y + (i+1), z = myPos.z}, {x = myPos.x + 1, y = myPos.y + (i+2), z = myPos.z}},
  1223.                 [3] = {180, {x = myPos.x - (i+1), y = myPos.y, z = myPos.z}, {x = myPos.x - i, y = myPos.y + 1, z = myPos.z}}
  1224.             }
  1225.             addEvent(doSendMove, i * 300, cid, info[myDirection][2], info[myDirection][3], info[myDirection][1], i+1)
  1226.         end
  1227.     elseif move == "Earth Power" then
  1228.         local effectPos = {x = myPos.x + 1, y = myPos.y + 1, z = myPos.z}
  1229.         doAreaCombatHealth(cid, COMBAT_GROUNDDAMAGE, myPos, square1x1, min, max, 2)
  1230.         doSendMagicEffect(effectPos, 181)
  1231.     elseif move == "Earthquake" then
  1232.         local function doSendMove(cid, turn)
  1233.             if not isCreature(cid) then return true end
  1234.             local turn = turn or 1
  1235.             local event = addEvent(doSendMove, 500, cid, turn + 1)
  1236.             doAreaCombatHealth(cid, COMBAT_GROUNDDAMAGE, getThingPos(cid), circle2x2, (min/20), (max/20), 88)
  1237.             if turn == 20 or getPokemonStatus(cid, "sleep") then
  1238.                 stopEvent(event)
  1239.             end
  1240.         end
  1241.         doSendMove(cid)
  1242.     elseif move == "Defense Curl" then
  1243.         setPokemonStatus(cid, "harden", 10, 182, true, 0)
  1244.     elseif move == "Dig" then
  1245.         local function doReturn(cid)
  1246.             if not isCreature(cid) then return true end
  1247.             setCreatureVisibility(cid, false)
  1248.             doClearPokemonStatus(cid)
  1249.             doAreaCombatHealth(cid, COMBAT_GROUNDDAMAGE, getThingPos(cid), circle2x2, min, max, 184)
  1250.             doAreaCombatHealth(cid, STATUS_SLOW, getThingPos(cid), circle2x2, 10, 10, 2)
  1251.         end
  1252.         local function doReturnEffect(cid)
  1253.             if not isCreature(cid) then return true end
  1254.             doSendMagicEffect(getThingPos(cid), 183)
  1255.         end
  1256.         setCreatureVisibility(cid, true)
  1257.         setPokemonStatus(cid, "speedUp", 3, 0, true, 0)
  1258.         setPokemonStatus(cid, "silence", 3, 2, true, 0)
  1259.         doSendMagicEffect(myPos, 183)
  1260.         addEvent(doReturn, 3000, cid)
  1261.         addEvent(doReturnEffect, 2750, cid)
  1262.     elseif move == "Cross Poison" then
  1263.         doAreaCombatHealth(cid, COMBAT_POISONDAMAGE, myPos, crossPoison, min, max, 160)
  1264.         doAreaCombatHealth(cid, STATUS_POISON10, myPos, crossPoison, pokeLevel, pokeLevel, 2)
  1265.     elseif move == "Sand Tomb" then
  1266.         doFrontalCombatHealth(cid, myPos, COMBAT_GROUNDDAMAGE, min, max, 185, 56)
  1267.         doFrontalCombatHealth(cid, myPos, STATUS_BLIND, 5, 5, 2)
  1268.     elseif move == "Sludge Wave" then
  1269.         local function doSendMove(cid, area, turn)
  1270.             if not isCreature(cid) then return true end
  1271.             if getPokemonStatus(cid, "sleep") then return true end
  1272.             doAreaCombatHealth(cid, COMBAT_POISONDAMAGE, area, line1x1, min, max, 161)
  1273.             doAreaCombatHealth(cid, STATUS_BLIND, area, line1x1, 5, 5, 2)
  1274.             if turn >= 6 then
  1275.                 doRegainSpeed(cid)
  1276.                 doCreatureSetNoMove(cid, false)
  1277.             end
  1278.         end
  1279.         doChangeSpeed(cid, -getCreatureSpeed(cid))
  1280.         doCreatureSetNoMove(cid, true)
  1281.         for i = 0, 5 do
  1282.             local info = {
  1283.                 [0] = {125, {x = myPos.x, y = myPos.y - (i+1), z = myPos.z}},
  1284.                 [1] = {126, {x = myPos.x + (i+1), y = myPos.y, z = myPos.z}},
  1285.                 [2] = {127, {x = myPos.x, y = myPos.y + (i+1), z = myPos.z}},
  1286.                 [3] = {128, {x = myPos.x - (i+1), y = myPos.y, z = myPos.z}}
  1287.             }
  1288.             addEvent(doSendMove, i * 300, cid, info[myDirection][2], i+1)
  1289.         end
  1290.     elseif move == "Doubleslap" then
  1291.         for i = 0, 1 do
  1292.             addEvent(doTargetCombatHealth, i * 100, cid, target, COMBAT_NORMALDAMAGE, min/2, max/2, 2)
  1293.         end
  1294.         doSendMagicEffect(targetPos, 187)
  1295.     elseif move == "Sing" then
  1296.         doAreaCombatHealth(cid, STATUS_SLEEP, myPos, circle3x3, 10, 10, 22)
  1297.     elseif move == "Multi-Slap" then
  1298.         doAreaCombatHealth(cid, COMBAT_NORMALDAMAGE, myPos, square1x1, min/2, max/2, 187)
  1299.         addEvent(doAreaCombatHealth, 100, cid, COMBAT_NORMALDAMAGE, myPos, square1x1, min/2, max/2, 2)
  1300.     elseif move == "Great Love" then
  1301.         local function doSendMoveDamage(cid)
  1302.             if not isCreature(cid) then return true end
  1303.             doAreaCombatHealth(cid, STATUS_CONFUSION10, myPos, square4x4, 188, 188, 2)
  1304.             doAreaCombatHealth(cid, COMBAT_NORMALDAMAGE, myPos, square4x4, min, max, 2)
  1305.         end
  1306.         for i = 0, 19 do
  1307.             addEvent(doSendMoveEffectDown, i * 50, cid, 188)
  1308.         end
  1309.         addEvent(doSendMoveDamage, 1000, cid)
  1310.     elseif move == "Healarea" then
  1311.         local healMin = (getCreatureMaxHealth(cid) * 75) / 100
  1312.         local healMax = healMin + pokeLevel
  1313.         local heal = math.random(healMin, healMax)
  1314.         if getCreatureHealth(cid) + heal > getCreatureMaxHealth(cid) then
  1315.             heal = getCreatureMaxHealth(cid) - getCreatureHealth(cid)
  1316.         end
  1317.         if heal > 0 then
  1318.             doSendAnimatedText(myPos, "+"..heal, 35)
  1319.             doCreatureAddHealth(cid, heal)
  1320.         end
  1321.         doSendMagicEffect(myPos, 12)
  1322.         if isSummon(cid) then
  1323.             doOTCSendPokemonHealth(master)
  1324.         end
  1325.         doAreaCombatHealth(cid, COMBAT_HEAL, myPos, circle3x3, healMin, healMax, 12)
  1326.     elseif move == "Metronome" then
  1327.         local effectPos = {x = myPos.x, y = myPos.y - 1, z = myPos.z}
  1328.         local randomMoves = {"Leaf Storm", "Magma Storm", "Hydropump", "Electric Storm"}
  1329.         local move = randomMoves[math.random(#randomMoves)]
  1330.         doSendMagicEffect(effectPos, 189)
  1331.         addEvent(doCastMove, 500, cid, move)
  1332.     elseif move == "Dazzling Gleam" then
  1333.         doSendDistanceShoot(myPos, targetPos, 60)
  1334.         doTargetCombatHealth(cid, target, COMBAT_FAIRYDAMAGE, min, max, 190)
  1335.     elseif move == "Moonblast" then
  1336.         local function doSendMoveDamage(cid)
  1337.             if not isCreature(cid) then return true end
  1338.             doAreaCombatHealth(cid, STATUS_SILENCE, myPos, square4x4, 2, 2, 2)
  1339.             doAreaCombatHealth(cid, COMBAT_ELECTRICDAMAGE, myPos, square4x4, min, max, 2)
  1340.         end
  1341.         addEvent(doSendMoveDamage, 1000, cid)
  1342.     elseif move == "Flame Circle" then
  1343.         local area1 = {WF11, WF12, WF13, WF14, WF15, WF16, WF17, WF18}
  1344.         local area2 = {WF21, WF22, WF23, WF24, WF25, WF26, WF27, WF28, WF29, WF210, WF211, WF212, WF213, WF214, WF215, WF216}
  1345.         local area3 = {WF31, WF32, WF33, WF34, WF35, WF36, WF37, WF38, WF39, WF310, WF311, WF312, WF313, WF314, WF315, WF316, WF317, WF318, WF319, WF320, WF321, WF322, WF323, WF324}
  1346.         for i = 0, 7 do
  1347.             addEvent(doAreaCombatHealth, i * 300, cid, COMBAT_FIREDAMAGE, myPos, area1[i+1], min, max, 6)
  1348.         end
  1349.         for i = 0, 15 do
  1350.             addEvent(doAreaCombatHealth, i * 160, cid, COMBAT_FIREDAMAGE, myPos, area2[i+1], min, max, 6)
  1351.         end
  1352.         for i = 0, 23 do
  1353.             addEvent(doAreaCombatHealth, i * 110, cid, COMBAT_FIREDAMAGE, myPos, area3[i+1], min, max, 6)
  1354.         end
  1355.     elseif move == "Flame Wheel" then
  1356.         local function doSendMove(cid, turn)
  1357.             if not isCreature(cid) then return true end
  1358.             local turn = turn or 1
  1359.             local event = addEvent(doSendMove, 500, cid, turn + 1)
  1360.             doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, getThingPos(cid), square1x1, (min/20), (max/20), 2)
  1361.             if turn == 20 or getPokemonStatus(cid, "sleep") then
  1362.                 doRemoveCondition(cid, CONDITION_OUTFIT)
  1363.                 stopEvent(event)
  1364.             end
  1365.         end
  1366.         setPokemonStatus(cid, "speedUp", 20, 0, true, 0)
  1367.         doSetCreatureOutfit(cid, {lookType = 253}, -1)
  1368.         doSendMove(cid)
  1369.     elseif move == "Confuse Ray" then
  1370.         doSendDistanceShoot(myPos, targetPos, 40)
  1371.         doTargetCombatHealth(cid, target, COMBAT_GHOSTDAMAGE, min, max, 2)
  1372.         doTargetCombatHealth(cid, target, STATUS_CONFUSION10, 191, 191, 2)
  1373.     elseif move == "Hyper Voice" then
  1374.         local info = {
  1375.             [0] = wave5N,
  1376.             [1] = wave5E,
  1377.             [2] = wave5S,
  1378.             [3] = wave5W
  1379.         }
  1380.         doAreaCombatHealth(cid, STATUS_STUN, myPos, info[myDirection], 10, 10, 2)
  1381.         doAreaCombatHealth(cid, COMBAT_NORMALDAMAGE, myPos, info[myDirection], min, max, 22)
  1382.     elseif move == "Echoed Voice" then
  1383.         local function doSendMove(cid, area1, area2, effect, turn)
  1384.             if not isCreature(cid) then return true end
  1385.             if getPokemonStatus(cid, "sleep") then return true end
  1386.             doAreaCombatHealth(cid, COMBAT_NORMALDAMAGE, area1, line1x1, 0, 0, 209)
  1387.             doAreaCombatHealth(cid, COMBAT_NORMALDAMAGE, area1, line1x1, min, max, 39)
  1388.             if turn ~= 1 then
  1389.                 doAreaCombatHealth(cid, COMBAT_NORMALDAMAGE, area2, line1x3, 0, 0, 209)
  1390.                 doAreaCombatHealth(cid, COMBAT_NORMALDAMAGE, area2, line1x3, min, max, 39)
  1391.             end
  1392.             if turn >= 6 then
  1393.                 doRegainSpeed(cid)
  1394.                 doCreatureSetNoMove(cid, false)
  1395.             end
  1396.         end
  1397.         doChangeSpeed(cid, -getCreatureSpeed(cid))
  1398.         doCreatureSetNoMove(cid, true)
  1399.         for i = 0, 5 do
  1400.             local info = {
  1401.                 [0] = {125, {x = myPos.x, y = myPos.y - (i+1), z = myPos.z}, {x = myPos.x, y = myPos.y - i, z = myPos.z}},
  1402.                 [1] = {126, {x = myPos.x + (i+1), y = myPos.y, z = myPos.z}, {x = myPos.x + i, y = myPos.y, z = myPos.z}},
  1403.                 [2] = {127, {x = myPos.x, y = myPos.y + (i+1), z = myPos.z}, {x = myPos.x, y = myPos.y + i, z = myPos.z}},
  1404.                 [3] = {128, {x = myPos.x - (i+1), y = myPos.y, z = myPos.z}, {x = myPos.x - i, y = myPos.y, z = myPos.z}}
  1405.             }
  1406.             addEvent(doSendMove, i * 300, cid, info[myDirection][2], info[myDirection][3], info[myDirection][1], i+1)
  1407.         end
  1408.     elseif move == "Softboiled" then
  1409.         local healMin = (getCreatureMaxHealth(cid) * 95) / 100
  1410.         local healMax = healMin + pokeLevel
  1411.         local heal = math.random(healMin, healMax)
  1412.         if getCreatureHealth(cid) + heal > getCreatureMaxHealth(cid) then
  1413.             heal = getCreatureMaxHealth(cid) - getCreatureHealth(cid)
  1414.         end
  1415.         if heal > 0 then
  1416.             doSendAnimatedText(myPos, "+"..heal, 35)
  1417.             doCreatureAddHealth(cid, heal)
  1418.         end
  1419.         doSendMagicEffect(myPos, 117)
  1420.         if isSummon(cid) then
  1421.             doOTCSendPokemonHealth(master)
  1422.         end
  1423.     elseif move == "Charm" then
  1424.         setPokemonStatus(cid, "harden", 15, 192, true, 0)
  1425.     elseif move == "Rock n'Roll" then
  1426.         local function doSendMove(cid, area)
  1427.             if not isCreature(cid) then return true end
  1428.             doAreaCombatHealth(cid, STATUS_CONFUSION10, myPos, area, 193, 193, 2)
  1429.             doAreaCombatHealth(cid, COMBAT_NORMALDAMAGE, myPos, area, min/2, max/2, 1)
  1430.         end
  1431.         local areas = {square1x1, circleHollow2x2, circleHollow3x3, circleHollow4x4, circleHollow5x5, circleHollow4x4, circleHollow3x3, circleHollow2x2, square1x1}
  1432.         for i = 1, #areas do
  1433.             addEvent(doSendMove, (i-1) * 350, cid, areas[i])
  1434.         end
  1435.     elseif move == "Absorb" then
  1436.         local hit = (min + max) / 2
  1437.         doSendMagicEffect(myPos, 117)
  1438.         doTargetCombatHealth(cid, target, ABSORB_GRASS, hit, hit, 2)
  1439.     elseif move == "Toxic" then
  1440.         local function doSendMove(cid, area)
  1441.             if not isCreature(cid) then return true end
  1442.             doAreaCombatHealth(cid, STATUS_POISON20, myPos, area, pokeLevel, pokeLevel, 2)
  1443.             doAreaCombatHealth(cid, COMBAT_POISONDAMAGE, myPos, area, min, max, 161)
  1444.         end
  1445.         local areas = {square1x1, circleHollow2x2}
  1446.         for i = 1, #areas do
  1447.             addEvent(doSendMove, (i-1) * 350, cid, areas[i])
  1448.         end
  1449.     elseif move == "Poison Bomb" then
  1450.         doSendDistanceShoot(myPos, targetPos, 14)
  1451.         doAreaCombatHealth(cid, COMBAT_POISONDAMAGE, targetPos, square1x1, min, max, 20)
  1452.         doTargetCombatHealth(cid, target, COMBAT_POISONDAMAGE, min, max, 20)
  1453.         doAreaCombatHealth(cid, STATUS_POISON10, targetPos, square1x1, pokeLevel, pokeLevel, 2)
  1454.         doTargetCombatHealth(cid, target, STATUS_POISON10, pokeLevel, pokeLevel, 2)
  1455.     elseif move == "Poison Gas" then
  1456.         local function doSendMove(cid, turn)
  1457.             if not isCreature(cid) then return true end
  1458.             local turn = turn or 1
  1459.             local event = addEvent(doSendMove, 500, cid, turn + 1)
  1460.             doAreaCombatHealth(cid, COMBAT_POISONDAMAGE, getThingPos(cid), circle2x2, (min/20), (max/20), 161)
  1461.             doAreaCombatHealth(cid, STATUS_POISON20, getThingPos(cid), circle2x2, pokeLevel, pokeLevel, 2)
  1462.             doAreaCombatHealth(cid, STATUS_BLIND, getThingPos(cid), circle2x2, 3, 3, 2)
  1463.             if turn == 20 or getPokemonStatus(cid, "sleep") then
  1464.                 stopEvent(event)
  1465.             end
  1466.         end
  1467.         doSendMove(cid)
  1468.     elseif move == "Petal Dance" then
  1469.         doFrontalCombatHealth(cid, myPos, COMBAT_GRASSDAMAGE, min, max, 105, 61)
  1470.     elseif move == "Slash" then
  1471.         doSendDistanceShoot(myPos, targetPos, 40)
  1472.         doTargetCombatHealth(cid, target, COMBAT_NORMALDAMAGE, min, max, 195)
  1473.     elseif move == "Leech Life" then
  1474.         local hit = (min + max) / 2
  1475.         doSendMagicEffect(myPos, 117)
  1476.         doTargetCombatHealth(cid, target, ABSORB_BUG, hit, hit, 2)
  1477.     elseif move == "X-Scissor" then
  1478.         local info = {
  1479.             [0] = {133, xScissorN, {x = myPos.x + 1, y = myPos.y, z = myPos.z}},
  1480.             [1] = {134, xScissorE, {x = myPos.x + 2, y = myPos.y + 1, z = myPos.z}},
  1481.             [2] = {135, xScissorS, {x = myPos.x + 1, y = myPos.y + 2, z = myPos.z}},
  1482.             [3] = {136, xScissorW, {x = myPos.x, y = myPos.y + 1, z = myPos.z}}
  1483.         }
  1484.         doSendMagicEffect(info[myDirection][3], info[myDirection][1])
  1485.         doAreaCombatHealth(cid, COMBAT_BUGDAMAGE, myPos, info[myDirection][2], min/2, max/2, 2)
  1486.     elseif move == "Psychic" then
  1487.         doAreaCombatHealth(cid, COMBAT_PSYCHICDAMAGE, myPos, circle3x3, min, max, 196)
  1488.     elseif move == "Signal Beam" then
  1489.         local function doSendMove(cid, area)
  1490.             if not isCreature(cid) then return true end
  1491.             if getPokemonStatus(cid, "sleep") then return true end
  1492.             local pos = getThingPos(cid)
  1493.             doAreaCombatHealth(cid, COMBAT_BUGDAMAGE, pos, area, min, max, 2)
  1494.         end
  1495.         local info = {
  1496.             [0] = {197, solarBeamN, {x = pos.x + 1, y = pos.y - 1, z = pos.z}},
  1497.             [1] = {198, solarBeamE, {x = pos.x + 6, y = pos.y + 1, z = pos.z}},
  1498.             [2] = {199, solarBeamS, {x = pos.x + 1, y = pos.y + 6, z = pos.z}},
  1499.             [3] = {200, solarBeamW, {x = pos.x - 1, y = pos.y + 1, z = pos.z}}
  1500.         }
  1501.         doSendMagicEffect(info[myDirection][3], info[myDirection][1])
  1502.         addEvent(doSendMove, 2000, cid, info[myDirection][2])
  1503.     elseif move == "Bug Buzz" then
  1504.         local info = {
  1505.             [0] = wave5BN,
  1506.             [1] = wave5BE,
  1507.             [2] = wave5BS,
  1508.             [3] = wave5BW
  1509.         }
  1510.         doAreaCombatHealth(cid, STATUS_STUN, myPos, info[myDirection], 10, 10, 2)
  1511.         doAreaCombatHealth(cid, COMBAT_BUGDAMAGE, myPos, info[myDirection], min, max, 201)
  1512.     elseif move == "Mud Slap" then
  1513.         doSendDistanceShoot(myPos, targetPos, 59)
  1514.         doTargetCombatHealth(cid, target, COMBAT_GROUNDDAMAGE, min, max, 175)
  1515.         doTargetCombatHealth(cid, target, STATUS_BLIND, 10, 10, 2)
  1516.         doTargetCombatHealth(cid, target, STATUS_SLOW, 10, 10, 2)
  1517.     elseif move == "Night Slash" then
  1518.         local function doSendMove(cid)
  1519.             if not isCreature(cid) then return true end
  1520.             if getPokemonStatus(cid, "sleep") then return true end
  1521.             local info = {
  1522.                 [1] = {202, {x = myPos.x + 1, y = myPos.y - 1, z = myPos.z}},
  1523.                 [2] = {203, {x = myPos.x + 2, y = myPos.y + 1, z = myPos.z}},
  1524.                 [3] = {204, {x = myPos.x + 1, y = myPos.y + 2, z = myPos.z}},
  1525.                 [4] = {205, {x = myPos.x - 1, y = myPos.y + 1, z = myPos.z}}
  1526.             }
  1527.             for i = 1, 4 do
  1528.                 doSendMagicEffect(info[i][2], info[i][1])
  1529.             end
  1530.             doAreaCombatHealth(cid, COMBAT_DARKDAMAGE, myPos, square1x1, min/2, max/2, 206)
  1531.         end
  1532.         for i = 0, 1 do
  1533.             addEvent(doSendMove, i * 500, cid)
  1534.         end
  1535.     elseif move == "Pay Day" then
  1536.         local function doSendMoveDown(cid, target, toPos)
  1537.             if not isCreature(target) or not isCreature(cid) then return true end
  1538.             doSendDistanceShoot(toPos, getThingPos(target), 62)
  1539.             doTargetCombatHealth(cid, target, COMBAT_NORMALDAMAGE, min/2, max/2, 207)
  1540.         end
  1541.         local function doSendMoveUp(cid, target)
  1542.             if not isCreature(cid) or not isCreature(target) then return true end
  1543.             local myPos = getThingPos(cid)
  1544.             local targetPos = getThingPos(target)
  1545.             local toPos = targetPos
  1546.             toPos.x = toPos.x - 6
  1547.             toPos.y = toPos.y - 6
  1548.             doSendDistanceShoot(myPos, toPos, 62)
  1549.             addEvent(doSendMoveDown, 350, cid, target, toPos)
  1550.         end
  1551.         for i = 0, 1 do
  1552.             addEvent(doSendMoveUp, i * 200, cid, target)
  1553.         end
  1554.     elseif move == "Torment" then
  1555.         local function doSendMove(cid, area)
  1556.             if not isCreature(cid) then return true end
  1557.             doAreaCombatHealth(cid, STATUS_SILENCE, myPos, area, 191, 191, 208)
  1558.         end
  1559.         local areas = {circleHollow5x5, circleHollow4x4, circleHollow3x3, circleHollow2x2, square1x1}
  1560.         for i = 1, #areas do
  1561.             addEvent(doSendMove, (i-1) * 350, cid, areas[i])
  1562.         end
  1563.         setPlayerStorageValue(cid, storages.focus, 1)
  1564.     elseif move == "Invisible" then
  1565.         local function doChangeVisibility(cid)
  1566.             if not isCreature(cid) then return true end
  1567.             setCreatureVisibility(cid, false)
  1568.         end
  1569.         doSendMagicEffect(myPos, 154)
  1570.         setCreatureVisibility(cid, true)
  1571.         addEvent(doChangeVisibility, 8000, cid)
  1572. -------------------------------------------------------------------------- • PASSIVES • --------------------------------------------------------------------------
  1573.     elseif move == "Fury" then
  1574.         setPokemonStatus(cid, "rage", 20, 0, true, 0)
  1575.     elseif move == "Electric Charge" then
  1576.         local function doSendEffect(cid, turn)
  1577.             if not isCreature(cid) then return true end
  1578.             local turn = turn or 1
  1579.             local event = addEvent(doSendEffect, 1000, cid, turn + 1)
  1580.             if turn == 1 then
  1581.                 setPlayerStorageValue(cid, storages.focus, 1)
  1582.             end
  1583.             if getPlayerStorageValue(cid, storages.focus) and getPlayerStorageValue(cid, storages.focus) == 1 then
  1584.                 doSendMagicEffect(getThingPos(cid), 174)
  1585.             else
  1586.                 stopEvent(event)
  1587.             end
  1588.         end
  1589.         if not getPlayerStorageValue(cid, storages.focus) or getPlayerStorageValue(cid, storages.focus) < 1 then
  1590.             doSendEffect(cid)
  1591.         end
  1592.     elseif move == "Melody" then
  1593.         doAreaCombatHealth(cid, STATUS_SLEEP, myPos, circle3x3, 5, 5, 22)
  1594.     elseif move == "Lifesteal" then
  1595.         doSendMagicEffect(myPos, 117)
  1596.         doTargetCombatHealth(cid, target, ABSORB_POISON, max/3, max/3, 2)
  1597.     elseif move == "Spores Reaction" then
  1598.         local randomMoves = {"Sleep Powder", "Stun Spore", "Poison Powder"}
  1599.         local move = randomMoves[math.random(#randomMoves)]
  1600.         doCastMove(cid, move)
  1601.     elseif move == "Mega Drain" then
  1602.         local hit = (min + max) / 2
  1603.         doSendMagicEffect(myPos, 117)
  1604.         doTargetCombatHealth(cid, target, ABSORB_NORMAL, hit, hit, 2)
  1605.     end
  1606. return true
  1607. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top