Ir para conteúdo

[Encerrado] (Bugs) PokeTibia


BrunooMaciell

Posts Recomendados

Bug

 

[16/12/2012 15:00:39] [Error - Action Interface]

[16/12/2012 15:00:39] data/actions/scripts/goback.lua:onUse

[16/12/2012 15:00:39] Description:

[16/12/2012 15:00:39] data/lib/catch system.lua:345: attempt to index a boolean value

[16/12/2012 15:00:39] stack traceback:

[16/12/2012 15:00:39] data/lib/catch system.lua:345: in function 'doAddPokemonInOwnList'

[16/12/2012 15:00:39] data/actions/scripts/goback.lua:200: in function <data/actions/scripts/goback.lua:8>

 

 

Script

 

function onLogout(cid)

 

if not isCreature(cid) then return true end

local thisitem = getPlayerSlotItem(cid, 8)

 

if thisitem.uid <= 0 then return true end

 

local ballName = getItemAttribute(thisitem.uid, "poke")

 

--------------------------------------------------------

btype = getPokeballType(thisitem.itemid)

---------------------------------------------------------------

if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then --alterado v1.6

if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then

BackTeam(cid)

end

end

--////////////////////////////////////////////////////////////////////////////////////////--

if not isCreature(cid) then return true end

if getPlayerStorageValue(cid, 52480) >= 1 or getPlayerStorageValue(cid, 52481) >= 0 then

local sid = getPlayerByName(getPlayerStorageValue(cid, 52482))

local sendLose = true

if isCreature(sid) then

if getPlayerStorageValue(sid, 52482) == getCreatureName(cid) then

addEvent(doSendAnimatedText, 1000, getThingPosWithDebug(sid), "WIN", COLOR_ELECTRIC)

setPlayerStorageValue(sid, 52480, -1)

setPlayerStorageValue(sid, 52481, -1)

setPlayerStorageValue(sid, 52482, -1)

setPlayerStorageValue(sid, 52483, -1) --alterado v1.6.1

setPlayerStorageValue(sid, 6598754, -1)

doCreatureSetSkullType(sid, 0)

else

sendLose = false

end

end

if sendLose then

addEvent(doSendAnimatedText, 1000, getThingPosWithDebug(cid), "LOSE", COLOR_BURN)

end

setPlayerStorageValue(cid, 52480, -1)

setPlayerStorageValue(cid, 52481, -1)

setPlayerStorageValue(cid, 52482, -1)

setPlayerStorageValue(cid, 52483, -1)

setPlayerStorageValue(cid, 6598754, -1)

doCreatureSetSkullType(cid, 0)

end

--////////////////////////////////////////////////////////////////////////////////////////--

if #getCreatureSummons(cid) == 2 and getPlayerStorageValue(cid, 212124) >= 1 then

local cmed2 = getCreatureSummons(cid)[1]

local poscmed = getThingPos(cmed2)

local cmeddir = getCreatureLookDir(cmed2)

local namecmed = getCreatureName(cmed2)

local hp, maxHp = getCreatureHealth(getCreatureSummons(cid)[1]), getCreatureMaxHealth(getCreatureSummons(cid)[1])

local gender = getPokemonGender(cmed2)

doRemoveCreature(getCreatureSummons(cid)[1])

local back = doCreateMonster(namecmed, poscmed)

addEvent(doCreatureSetSkullType, 150, back, gender)

doCreatureSetLookDir(back, cmeddir)

addEvent(doCreatureAddHealth, 100, back, hp-maxHp)

--alterado v1.5

-- pokemon controlador

local ball2 = getPlayerSlotItem(cid, 8)

local mynewpos = getThingPos(getCreatureSummons(cid)[1])

doRemoveCreature(getCreatureSummons(cid)[1])

local pk2 = doSummonCreature(getItemAttribute(ball2.uid, "poke"), mynewpos)

doConvinceCreature(cid, pk2)

addEvent(doAdjustWithDelay, 100, cid, pk2, true, true, false)

setPlayerStorageValue(cid, 888, -1) --alterado v1.7

cleanCMcds(ball2.uid)

doCreatureSetLookDir(getCreatureSummons(cid)[1], 2)

registerCreatureEvent(pk2, "SummonDeath") --alterado v1.6

end

 

----------------------------------------------------------------------

local summon = getCreatureSummons(cid)[1]

 

if #getCreatureSummons(cid) >= 1 and thisitem.uid > 1 then

if getPlayerStorageValue(cid, 212124) <= 0 then

doItemSetAttribute(thisitem.uid, "hp", (getCreatureHealth(summon) / getCreatureMaxHealth(summon)))

end --alterado v1.5

setPlayerStorageValue(cid, 212124, 0)

doTransformItem(thisitem.uid, pokeballs[btype].on)

doSendMagicEffect(getThingPos(summon), pokeballs[btype].effect)

doRemoveCreature(summon)

end

if getCreatureOutfit(cid).lookType == 814 then

doPlayerStopWatching(cid)

end

if tonumber(getPlayerStorageValue(cid, 17000)) and getPlayerStorageValue(cid, 17000) >= 1 then --alterado v1.6

markFlyingPos(cid, getThingPos(cid))

end

 

if getPlayerStorageValue(cid, 22545) == 1 then --alterado v1.4

setGlobalStorageValue(22550, getGlobalStorageValue(22550)-1)

if getGlobalStorageValue(22550) <= 0 then

endGoldenArena() --alterado v1.7

end

end

return TRUE

end

local deathtexts = {"Oh no! POKENAME, come back!", "Come back, POKENAME!", "That's enough, POKENAME!", "You did well, POKENAME!",

"You need to rest, POKENAME!", "Nice job, POKENAME!", "POKENAME, you are too hurt!"}

function onDeath(cid, deathList)

local owner = getCreatureMaster(cid)

if getPlayerStorageValue(cid, 637500) >= 1 then

doSendMagicEffect(getThingPos(cid), 211)

doRemoveCreature(cid)

return true

end

 

if getPlayerStorageValue(cid, 212123) >= 1 then

return true

end

 

--////////////////////////////////////////////////////////////////////////////////////////--

checkDuel(owner) --alterado v1.6 duel system

--////////////////////////////////////////////////////////////////////////////////////////--

 

local thisball = getPlayerSlotItem(owner, 8)

local ballName = getItemAttribute(thisball.uid, "poke")

 

btype = getPokeballType(thisball.itemid)

if #getCreatureSummons(owner) > 1 then

BackTeam(owner, getCreatureSummons(owner))

end

doSendMagicEffect(getThingPos(cid), pokeballs[btype].effect)

doTransformItem(thisball.uid, pokeballs[btype].off)

doPlayerSendTextMessage(owner, 22, "Your pokemon fainted.")

local say = deathtexts[math.random(#deathtexts)]

say = string.gsub(say, "POKENAME", getCreatureName(cid))

if getPlayerStorageValue(cid, 33) <= 0 then

doCreatureSay(owner, say, TALKTYPE_SAY)

end

doItemSetAttribute(thisball.uid, "hp", 0)

if ehMonstro(deathList[1]) then

doItemSetAttribute(thisball.uid, "happy", getPlayerStorageValue(cid, 1008) - happyLostOnDeath)

end

doItemSetAttribute(thisball.uid, "hunger", getPlayerStorageValue(cid, 1009))

if useOTClient then

doPlayerSendCancel(owner, '12//,hide') --alterado v1.7

end

doRemoveCreature(cid)

return false

end

 

 

 

Outro Bug ...

 

 

[16/12/2012 15:09:57] [Error - Spell Interface]

[16/12/2012 15:09:57] In a timer event called from:

[16/12/2012 15:09:57] data/spells/scripts/ps/Mud Bomb.lua:onCastSpell

[16/12/2012 15:09:57] Description:

[16/12/2012 15:09:57] data/lib/032-position.lua:211: attempt to index local 'pos' (a boolean value)

[16/12/2012 15:09:57] stack traceback:

[16/12/2012 15:09:57] data/lib/032-position.lua:211: in function 'getPosfromArea'

[16/12/2012 15:09:57] data/lib/newStatusSyst.lua:804: in function <data/lib/newStatusSyst.lua:801>

 

 

Script

 

conds = {

["Slow"] = 3890,

["Confusion"] = 3891,

["Burn"] = 3892,

["Poison"] = 3893,

["Fear"] = 3894,

["Stun"] = 3895,

["Paralyze"] = 3896, --alterado v1.6 \/ peguem o script todo!

["Leech"] = 3897,

["Buff1"] = 3898,

["Buff2"] = 3899,

["Buff3"] = 3900,

["Miss"] = 32659,

["Silence"] = 32698,

["Sleep"] = 98271,

}

injuries2 = {

[1] = {n = "slow", m = 3890},

[2] = {n = "confuse", m = 3891},

[3] = {n = "burn", m = 3892},

[4] = {n = "poison", m = 3893},

[5] = {n = "fear", m = 3894},

[6] = {n = "stun", m = 3895},

[7] = {n = "paralyze", m = 3896},

[8] = {n = "leech", m = 3897},

[9] = {n = "Buff1", m = 3898},

[10] = {n = "Buff2", m = 3899},

[11] = {n = "Buff3", m = 3900},

[12] = {n = "miss", m = 32659},

[13] = {n = "silence", m = 32698},

[14] = {n = "sleep", m = 98271},

}

Buffs = {

[1] = {"Buff1", 3898},

[2] = {"Buff2", 3899},

[3] = {"Buff3", 3900},

}

paralizeArea2 = createConditionObject(CONDITION_PARALYZE)

setConditionParam(paralizeArea2, CONDITION_PARAM_TICKS, 50000)

setConditionFormula(paralizeArea2, -0.63, -0.63, -0.63, -0.63)

local roardirections = {

[NORTH] = {SOUTH},

[sOUTH] = {NORTH},

[WEST] = {EAST}, --edited sistema de roar

[EAST] = {WEST}}

function doSendSleepEffect(cid)

if not isCreature(cid) or not isSleeping(cid) then return true end

doSendMagicEffect(getThingPos(cid), 32)

addEvent(doSendSleepEffect, 1500, cid)

end

local outFurys = {

["Shiny Charizard"] = {outFury = 1073},

["Shiny Blastoise"] = {outFury = 1074},

}

local outImune = {

["Camouflage"] = 1445,

["Acid Armor"] = 1453,

["Iron Defense"] = 1401,

["Minimize"] = 1455,

["Future Sight"] = 1446,

}

 

local function transBack(cid)

if isCreature(cid) then

if getPlayerStorageValue(cid, 974848) >= 1 then

setPlayerStorageValue(cid, 974848, 0)

doRemoveCondition(cid, CONDITION_OUTFIT)

end

end

end

function doCondition2(ret)

--

function doMiss2(cid, cd, eff, check, spell)

local stg = conds["Miss"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, 21100) >= 1 and getPlayerStorageValue(cid, stg) <= -1 then return true end --alterado v1.6 reflect

if not canDoMiss(cid, spell) then return true end

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "miss", a)

doItemSetAttribute(item.uid, "missEff", eff)

doItemSetAttribute(item.uid, "missSpell", spell)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doMiss2, 1000, cid, -1, eff, a, spell)

end

function doSilence2(cid, cd, eff, check)

local stg = conds["Silence"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "silence", a)

doItemSetAttribute(item.uid, "silenceEff", eff)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doSilence2, 1000, cid, -1, eff, a)

end

function doSlow2(cid, cd, eff, check, first)

local stg = conds["Slow"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "slow", a)

doItemSetAttribute(item.uid, "slowEff", eff)

end

 

if a <= -1 then

doRemoveCondition(cid, CONDITION_PARALYZE)

if not isSleeping(cid) and not isParalyze(cid) then

addEvent(doRegainSpeed, 50, cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if first then

doAddCondition(cid, paralizeArea2)

end

 

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doSlow2, 1000, cid, -1, eff, a)

end

function doConfusion2(cid, cd, check)

local stg = conds["Confusion"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "confuse", a)

end

 

if a <= -1 then

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isSleeping(cid) and not isParalyze(cid) then

doRegainSpeed(cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if math.random(1, 6) >= 4 then

doSendMagicEffect(getThingPos(cid), 31)

end

local isTarget = isSummon(cid) and getCreatureTarget(getCreatureMaster(cid)) or getCreatureTarget(cid)

if isCreature(isTarget) and not isSleeping(cid) and not isParalyze(cid) and getPlayerStorageValue(cid, 654878) <= 0 then --alterado v1.6

doChangeSpeed(cid, -getCreatureSpeed(cid))

doChangeSpeed(cid, 100)

doPushCreature(cid, math.random(0, 3), 1, 0) --alterado v1.6

doChangeSpeed(cid, -100)

end

local pos = getThingPos(cid)

addEvent(doSendMagicEffect, math.random(0, 450), pos, 31)

 

addEvent(doConfusion2, 1000, cid, -1, a)

end

function doBurn2(cid, cd, check, damage)

local stg = conds["Burn"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "burn", a)

doItemSetAttribute(item.uid, "burndmg", damage)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doCreatureAddHealth(cid, -damage, 15, COLOR_BURN)

addEvent(doBurn2, 3500, cid, -1, a, damage)

end

function doPoison2(cid, cd, check, damage)

local stg = conds["Poison"]

if not isCreature(cid) then return true end --is creature?

----------

if isSummon(cid) or ehMonstro(cid) and pokes[getCreatureName(cid)] then --alterado v1.6

local type = pokes[getCreatureName(cid)].type

local type2 = pokes[getCreatureName(cid)].type2

if isInArray({"poison", "steel"}, type) or isInArray({"poison", "steel"}, type2) then

return true

end

end

---------

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "poison", a)

doItemSetAttribute(item.uid, "poisondmg", damage)

end

 

if a <= -1 or getCreatureHealth(cid) == 1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

local dano = getCreatureHealth(cid)-damage <= 0 and getCreatureHealth(cid)-1 or damage

doCreatureAddHealth(cid, -dano, 8, COLOR_GRASS)

 

addEvent(doPoison2, 1500, cid, -1, a, damage)

end

function doFear2(cid, cd, check, skill)

local stg = conds["Fear"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "fear", a)

doItemSetAttribute(item.uid, "fearSkill", skill)

end

 

if a <= -1 then

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isSleeping(cid) and not isParalyze(cid) then

doRegainSpeed(cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if skill == "Roar" then

eff = 244

else --edited Roar

eff = 139

end

 

if math.random(1, 6) >= 4 then

doSendMagicEffect(getThingPos(cid), eff)

end

local isTarget = isSummon(cid) and getCreatureTarget(getCreatureMaster(cid)) or getCreatureTarget(cid)

if isCreature(isTarget) and not isSleeping(cid) and not isParalyze(cid) and getPlayerStorageValue(cid, 654878) <= 0 then --alterado v1.6

local dir = getCreatureDirectionToTarget(cid, isTarget)

doChangeSpeed(cid, -getCreatureSpeed(cid))

doChangeSpeed(cid, 100)

doPushCreature(cid, roardirections[dir][1], 1, 0) --alterado v1.6

doChangeSpeed(cid, -100)

end

local pos = getThingPos(cid)

addEvent(doSendMagicEffect, math.random(0, 450), pos, eff)

 

addEvent(doFear2, 1000, cid, -1, a, skill)

end

function doStun2(cid, cd, eff, check, spell)

local stg = conds["Stun"]

if not isCreature(cid) then return true end --is creature?

if not canDoMiss(cid, spell) then return true end

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "stun", a)

doItemSetAttribute(item.uid, "stunEff", eff)

doItemSetAttribute(item.uid, "stunSpell", spell)

end

 

if a <= -1 then

doRemoveCondition(cid, CONDITION_PARALYZE)

if not isSleeping(cid) and not isParalyze(cid) then

addEvent(doRegainSpeed, 50, cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if getCreatureCondition(cid, CONDITION_PARALYZE) == false then

doAddCondition(cid, paralizeArea2)

end

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doStun2, 1000, cid, -1, eff, a, spell)

end

function doParalyze2(cid, cd, eff, check, first)

local stg = conds["Paralyze"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "paralyze", a)

doItemSetAttribute(item.uid, "paralyzeEff", eff)

end

 

if a <= -1 then

if isPlayer(cid) then

if not isSleeping(cid) then --alterado

mayNotMove(cid, false)

end

else

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isSleeping(cid) then

doRegainSpeed(cid) --alterado

end

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if isPlayer(cid) then

mayNotMove(cid, true)

else --alterado v1.6

doChangeSpeed(cid, -2000)

end

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doParalyze2, 1000, cid, -1, eff, a, false)

end

function doSleep2(cid, cd, check, first)

local stg = conds["Sleep"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not isSleeping(cid) then

addEvent(doSendSleepEffect, 500, cid)

end

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "sleep", a)

end

 

if a <= -1 then

if not isPlayer(cid) then

local dittoStg = getPlayerStorageValue(cid, 1010)

if getCreatureName(cid) == "Ditto" and isSummon(cid) and tostring(dittoStg) and dittoStg ~= "Ditto" then

doSetCreatureOutfit(cid, {lookType = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "transOutfit")}, -1)

else

doRemoveCondition(cid, CONDITION_OUTFIT)

end

if getPlayerStorageValue(cid, 625877) ~= -1 then

doSetCreatureOutfit(cid, {lookType = getPlayerStorageValue(cid, 625877)}, -1) --alterado v1.6

end

end

if isPlayer(cid) then

if not isParalyze(cid) then

mayNotMove(cid, false) --alterado

end

else

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isParalyze(cid) then

doRegainSpeed(cid) --alterado

end

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if first then

if getCreatureName(cid) == "Ursaring" and getCreatureCondition(cid, CONDITION_OUTFIT) == true then

 

elseif not isPlayer(cid) then

if isInArray({604, 605, 1015, 1016, 1183, 1184}, getCreatureOutfit(cid).lookType) then

Info = 0 --alterado v1.6

else

Info = getMonsterInfo(getCreatureName(cid)).lookCorpse

end

local look = getCreatureOutfit(cid)

---------

local dittoStg = getPlayerStorageValue(cid, 1010)

if getCreatureName(cid) == "Ditto" and isSummon(cid) and tostring(dittoStg) and dittoStg ~= "Ditto" then

local InfoDitto = getMonsterInfo(tostring(dittoStg)).lookCorpse

if InfoDitto ~= 0 and look.lookType ~= 0 then

doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(tostring(dittoStg)).lookCorpse}, -1)

end

else

if getCreatureName(cid) == "Shiny Golem" and getCreatureOutfit(cid).lookType == 1403 then

doRemoveCondition(cid, CONDITION_OUTFIT)

elseif Info ~= 0 and look.lookType ~= 0 then

doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(getCreatureName(cid)).lookCorpse}, -1)

end

end

end

end

--alterado v1.6

if isPlayer(cid) then

mayNotMove(cid, true)

else

doChangeSpeed(cid, -getCreatureSpeed(cid))

end

addEvent(doSleep2, 1000, cid, -1, a, false)

end

function doLeech2(cid, attacker, cd, check, damage)

local stg = conds["Leech"]

if not isCreature(cid) then return true end --is creature?

if attacker ~= 0 and not isCreature(attacker) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "leech", a)

doItemSetAttribute(item.uid, "leechdmg", damage)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

local life = getCreatureHealth(cid)

------

doCreatureAddHealth(cid, -damage)

doSendAnimatedText(getThingPos(cid), "-"..damage.."", 144)

doSendMagicEffect(getThingPos(cid), 45)

------

local newlife = life - getCreatureHealth(cid)

if newlife >= 1 and attacker ~= 0 then

doSendMagicEffect(getThingPos(attacker), 14)

doCreatureAddHealth(attacker, newlife)

doSendAnimatedText(getThingPos(attacker), "+"..newlife.."", 32)

end

addEvent(doLeech2, 2000, cid, attacker, -1, a, damage)

end

function doBuff2(cid, cd, eff, check, buff, first, attr)

if not isCreature(cid) then return true end --is creature?

---------------------

local atributo = attr and attr or ""

if first and atributo == "" then

for i = 1, 3 do

if getPlayerStorageValue(cid, Buffs[2]) <= 0 then

atributo = Buffs[1]

break

end

end

end

if atributo == "" then return true end

if ehMonstro(cid) then atributo = "Buff1" end

----------------------

local stg = conds[atributo]

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, atributo, a)

doItemSetAttribute(item.uid, atributo.."eff", eff)

doItemSetAttribute(item.uid, atributo.."skill", buff)

end

 

if a <= -1 then --alterado v1.6

if isInArray({"Future Sight", "Camouflage", "Acid Armor", "Iron Defense", "Minimize", "Bug Fighter", "Ancient Fury"}, buff) then

if getCreatureName(cid) == "Ditto" and pokes[getPlayerStorageValue(cid, 1010)] and getPlayerStorageValue(cid, 1010) ~= "Ditto" then

if isSummon(cid) then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doSetCreatureOutfit(cid, {lookType = getItemAttribute(item.uid, "transOutfit")}, -1) --alterado v1.6.1

end

elseif not isSleeping(cid) then

doRemoveCondition(cid, CONDITION_OUTFIT)

end

setPlayerStorageValue(cid, 9658783, -1)

setPlayerStorageValue(cid, 625877, -1) --alterado v1.6

end

if isInArray({"Strafe", "Agility", "Ancient Fury", "War Dog", "Fighter Spirit", "Furious Legs", "Ultimate Champion", "Bug Fighter"}, buff) then

setPlayerStorageValue(cid, 374896, -1) --alterado v1.6

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doSendMagicEffect(getThingPos(cid), eff)

 

if first then

if buff == "Strafe" or buff == "Agility" then

setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6

doRaiseStatus(cid, 0, 0, 100, a)

elseif buff == "Tailwind" then

doRaiseStatus(cid, 0, 0, 200, a)

elseif buff == "Rage" then

doRaiseStatus(cid, 2, 0, 0, a)

elseif buff == "Harden" then

doRaiseStatus(cid, 0, 2, 0, a)

elseif buff == "Calm Mind" then

doRaiseStatus(cid, 0, 2, 0, a)

elseif buff == "Ancient Fury" then

doSetCreatureOutfit(cid, {lookType = outFurys[getCreatureName(cid)].outFury}, a*1000)

setPlayerStorageValue(cid, 374896, 1) --velo atk

if getCreatureName(cid) == "Shiny Charizard" then

doRaiseStatus(cid, 2, 0, 0, a) --atk melee --alterado v1.6

else

doRaiseStatus(cid, 0, 2, 0, a) --def

end

setPlayerStorageValue(cid, 625877, outFurys[getCreatureName(cid)].outFury) --alterado v1.6

elseif buff == "War Dog" then

doRaiseStatus(cid, 1.5, 1.5, 0, a)

setPlayerStorageValue(cid, 374896, 1) --velo atk

elseif buff == "Rest" then

doSleep2(cid, cd, getPlayerStorageValue(cid, conds["Sleep"]), true)

doCreatureAddHealth(cid, getCreatureMaxHealth(cid))

elseif isInArray({"Fighter Spirit", "Furious Legs", "Ultimate Champion"}, buff) then

doRaiseStatus(cid, 1.5, 0, 0, a) --atk melee --alterado v1.6

setPlayerStorageValue(cid, 374896, 1) --velo atk

addEvent(setPlayerStorageValue, a*1000, cid, 465987, -1)

elseif isInArray({"Future Sight", "Camouflage", "Acid Armor", "Iron Defense", "Minimize"}, buff) then

doSetCreatureOutfit(cid, {lookType = outImune[buff]}, -1)

setPlayerStorageValue(cid, 9658783, 1)

setPlayerStorageValue(cid, 625877, outImune[buff]) --alterado v1.6

elseif buff == "Bug Fighter" then

setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6

doRaiseStatus(cid, 1.5, 1.5, 100, a)

doSetCreatureOutfit(cid, {lookType = 1448}, a*1000)

setPlayerStorageValue(cid, 625877, 1448) --alterado v1.6

end

end

addEvent(doBuff2, 1000, cid, -1, eff, a, buff, false, atributo)

end

 

if ret.buff and ret.buff ~= "" then

doBuff2(ret.id, ret.cd, ret.eff, ret.check, ret.buff, ret.first, (ret.attr and ret.attr or false))

end

if isSummon(ret.id) and getPokemonBoost(ret.id) ~= 0 and math.random(1, 100) <= getPokemonBoost(ret.id) then --sistema "pegou no boost"

if ret.cond and not isInArray({"Poison", "Burn", "Leech", "Fear"}, ret.cond) then --alterado v1.6

doSendMagicEffect(getThingPosWithDebug(ret.id), 114)

return true

end

end

if ret.cond and ret.cond == "Miss" then

doMiss2(ret.id, ret.cd, ret.eff, ret.check, ret.spell)

elseif ret.cond and ret.cond == "Silence" then

doSilence2(ret.id, ret.cd, ret.eff, ret.check)

elseif ret.cond and ret.cond == "Slow" then

doSlow2(ret.id, ret.cd, ret.eff, ret.check, ret.first)

elseif ret.cond and ret.cond == "Confusion" then

doConfusion2(ret.id, ret.cd, ret.check)

elseif ret.cond and ret.cond == "Burn" then

doBurn2(ret.id, ret.cd, ret.check, ret.damage)

elseif ret.cond and ret.cond == "Poison" then

doPoison2(ret.id, ret.cd, ret.check, ret.damage)

elseif ret.cond and ret.cond == "Fear" then

doFear2(ret.id, ret.cd, ret.check, ret.skill)

elseif ret.cond and ret.cond == "Stun" then

doStun2(ret.id, ret.cd, ret.eff, ret.check, ret.spell)

elseif ret.cond and ret.cond == "Paralyze" then

doParalyze2(ret.id, ret.cd, ret.eff, ret.check, ret.first)

elseif ret.cond and ret.cond == "Sleep" then

doSleep2(ret.id, ret.cd, ret.check, ret.first)

elseif ret.cond and ret.cond == "Leech" then

doLeech2(ret.id, ret.attacker, ret.cd, ret.check, ret.damage)

end

end

--------------------------------

function cleanBuffs2(item)

if item ~= 0 then

for i = 1, 3 do

doItemEraseAttribute(item, Buffs[1])

doItemEraseAttribute(item, Buffs[1].."eff")

doItemEraseAttribute(item, Buffs[1].."skill")

end

end

end

--------------------------------

function doCureStatus(cid, type, playerballs)

if not isCreature(cid) then return true end

if playerballs and isPlayer(cid) then

local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

local mb = getPlayerSlotItem(cid, 8)

if isPokeball(mb.itemid) then

if not type or type == "all" then

for b = 1, #injuries2 do

doItemSetAttribute(mb.uid, ""..injuries2.n.."", -1)

end

else

doItemSetAttribute(mb.uid, ""..type.."", -1)

end

end

for bname, balls in pairs (pokeballs) do

for times = 1,3 do

local items = getItemsInContainerById(bp.uid, balls.all[times])

for _, uid in pairs(items) do

if not type or type == "all" then

for b = 1, #injuries2 do

doItemSetAttribute(uid, ""..injuries2.n.."", -1)

end

else

doItemSetAttribute(uid, ""..type.."", -1)

end

end

end

end

end

if type == "all" then

for a = 1, #injuries2 do

setPlayerStorageValue(cid, injuries2[a].m, -1)

end

return true

end

for a, b in pairs (injuries2) do

if b.n == type then

setPlayerStorageValue(cid, b.m, -1)

end

end

end

---------------------------------

function isWithCondition(cid)

for i = 1, #injuries2 do

if getPlayerStorageValue(cid, injuries2.m) >= 1 then

return true

end

end

return false

end

---------------------------------

function doCureBallStatus(item, type)

if not type or type == "all" then

for b = 1, #injuries2 do

doItemSetAttribute(item, ""..injuries2.n.."", -1)

end

else

doItemSetAttribute(item, ""..type.."", -1)

end

end

---------------------------------

function isBurning(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Burn"]) >= 0 then return true end

return false

end

function isPoisoned(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Poison"]) >= 0 then return true end

return false

end

function isSilence(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Silence"]) >= 0 then return true end

return false

end

function isParalyze(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Paralyze"]) >= 0 then return true end

return false

end

 

function isSleeping(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Sleep"]) >= 0 then return true end

return false

end

function isWithFear(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Fear"]) >= 0 then return true end

return false

end

-----------------------------------

function doMoveInArea2(cid, eff, area, element, min, max, spell, ret)

if not isCreature(cid) then return true end

if spell and spell == "Mud Bomb" then

pos = getPosfromArea(getMasterTarget(cid), area)

else

pos = getPosfromArea(cid, area)

end

setPlayerStorageValue(cid, 21101, -1) --alterado v1.6

 

local skills = {"Skull Bash", "Gust", "Water Pulse", "Stick Throw", "Overheat", "Toxic", "Take Down", "Gyro Ball"} --alterado v1.7

local n = 0

local l = 0

while n < #pos do

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

n = n+1

thing = {x=pos[n].x,y=pos[n].y,z=pos[n].z,stackpos=253}

local pid = getThingFromPosWithProtect(thing)

----

if pid ~= cid then

if spell and isInArray(skills, spell) then

if spell == "Stick Throw" then

addEvent(sendEffWithProtect, l*300, cid, pos[n], eff)

addEvent(sendMoveBack, 1200, cid, pos, eff, min, max)

addEvent(doMoveDano2, l*300, cid, pid, element, min, max, ret, spell) --alterado v1.6

elseif spell and spell == "Gyro Ball" then --alterado v1.7

pos[n].x = pos[n].x+1

addEvent(sendEffWithProtect, l*200, cid, pos[n], eff)

addEvent(doMoveDano2, l*200, cid, pid, element, min, max, ret, spell)

else

addEvent(sendEffWithProtect, l*200, cid, pos[n], eff)

addEvent(doMoveDano2, l*200, cid, pid, element, min, max, ret, spell) --alterado v1.6

end

elseif spell and spell == "Epicenter" then

local random = math.random(50, 500)

addEvent(sendEffWithProtect, random, cid, pos[n], eff)

addEvent(doDanoWithProtect, random, cid, GROUNDDAMAGE, pos[n], crusher, -min, -max, 255)

elseif spell and spell == "Shadowave" then

posi = {x=pos[n].x, y=pos[n].y+1, z=pos[n].z}

sendEffWithProtect(cid, posi, eff)

doMoveDano2(cid, pid, element, min, max, ret, spell) --alterado v1.6

elseif spell and spell == "Surf" then

addEvent(sendEffWithProtect, math.random(50, 500), cid, pos[n], eff)

addEvent(doMoveDano2, 400, cid, pid, element, min, max, ret, spell) --alterado v1.6

elseif spell and spell == "Sand Attack" then

addEvent(sendEffWithProtect, n*200, cid, pos[n], eff)

addEvent(doMoveDano2, n*200, cid, pid, element, min, max, ret, spell) --alterado v1.6

elseif spell and (spell == "Muddy Water" or spell == "Venom Motion") then

local arr = {

[1] = 0, [2] = 0, [3] = 0, [4] = 200, [5] = 200, [6] = 200, [7] = 400, [8] = 400, [9] = 400, [10] = 600, [11] = 600,

[12] = 600, [13] = 800, [14] = 800, [15] = 800

}

local time = {0, 200, 400, 600, 800}

 

addEvent(sendEffWithProtect, arr[n], cid, pos[n], eff)

addEvent(doMoveDano2, arr[n], cid, pid, element, min, max, ret, spell)

elseif spell and (spell == "Inferno" or spell == "Fissure") then

addEvent(sendEffWithProtect, math.random(0, 500), cid, pos[n], eff)

addEvent(doMoveDano2, math.random(0, 500), cid, pid, element, min, max, ret, spell)

else

sendEffWithProtect(cid, pos[n], eff)

doMoveDano2(cid, pid, element, min, max, ret, spell)

end

end

l = l+1

end

end

-------------------------------------------

function doMoveDano2(cid, pid, element, min, max, ret, spell)

if isCreature(pid) and isCreature(cid) and cid ~= pid then

if isNpcSummon(pid) and getCreatureTarget(pid) ~= cid then

return true --alterado v1.6

end

if ehNPC(pid) then return true end

---

local canAtk = true --alterado v1.6

if getPlayerStorageValue(pid, 21099) >= 1 then

doSendMagicEffect(getThingPosWithDebug(pid), 135)

doSendAnimatedText(getThingPosWithDebug(pid), "REFLECT", COLOR_GRASS)

addEvent(docastspell, 100, pid, spell)

if getCreatureName(pid) == "Wobbuffet" then

doRemoveCondition(pid, CONDITION_OUTFIT)

end

canAtk = false

setPlayerStorageValue(pid, 21099, -1)

setPlayerStorageValue(pid, 21100, 1)

setPlayerStorageValue(pid, 21101, cid)

setPlayerStorageValue(pid, 21103, getTableMove(cid, getPlayerStorageValue(cid, 21102)).f)

end

---

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isSummon(cid) and (ehMonstro(pid) or (isSummon(pid) and canAttackOther(cid, pid) == "Can") or (isPlayer(pid) and canAttackOther(cid, pid) == "Can" and #getCreatureSummons(pid) <= 0)) and pid ~= cid then

if canAtk then --alterado v1.6

if ret and ret.cond then

ret.id = pid

ret.check = getPlayerStorageValue(pid, conds[ret.cond])

doCondition2(ret)

end

if spell == "Selfdestruct" then

if getPlayerStorageValue(pid, 9658783) <= 0 then

doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)

doCreatureAddHealth(pid, -max) --alterado v1.6

end

else

doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)

end

end

elseif ehMonstro(cid) and (isSummon(pid) or (isPlayer(pid) and #getCreatureSummons(pid) <= 0)) and pid ~= cid then

if canAtk then --alterado v1.6

if ret and ret.cond then

ret.id = pid

ret.check = getPlayerStorageValue(pid, conds[ret.cond])

doCondition2(ret)

end

if spell == "Selfdestruct" then

if getPlayerStorageValue(pid, 9658783) <= 0 then

doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)

doCreatureAddHealth(pid, -max) --alterado v1.6

end

else

doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)

end

end

elseif isPlayer(cid) and ehMonstro(pid) and pid ~= cid then

if canAtk then --alterado v1.6

if ret and ret.cond then

ret.id = pid

ret.check = getPlayerStorageValue(pid, conds[ret.cond])

doCondition2(ret)

end

if spell == "Selfdestruct" then

if getPlayerStorageValue(pid, 9658783) <= 0 then

doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)

doCreatureAddHealth(pid, -max) --alterado v1.6

end

else

doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)

end

end

end

end

end

--------------------------------------------------------------------------------

function sendEffWithProtect(cid, pos, eff) --Manda algum magic effect com proteçoes

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

local checkpos = pos

checkpos.stackpos = 0

if not hasTile(checkpos) then

return true

end

if not canWalkOnPos2(pos, false, true, false, true, false) then --alterado v1.6

return true

end

doSendMagicEffect(pos, eff)

end

---------------------------------------------------------------------------------

function getThingPosWithDebug(what)

if not isCreature(what) or getCreatureHealth(what) <= 0 then

return {x = 1, y = 1, z = 10}

end

return getThingPos(what)

end

---------------------------------------------------------------------------------

function doDanoWithProtect(cid, element, pos, area, min, max, eff) --Da dano com proteçoes

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

doAreaCombatHealth(cid, element, pos, area, -(math.abs(min)), -(math.abs(max)), eff)

end

---------------------------------------------------------------------------------

function doDanoWithProtectWithDelay(cid, target, element, min, max, eff, area)

const_distance_delay = 56

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if target ~= 0 and isCreature(target) and not area then

delay = getDistanceBetween(getThingPosWithDebug(cid), getThingPosWithDebug(target)) * const_distance_delay

addEvent(doDanoWithProtect, delay, cid, element, getThingPosWithDebug(target), 0, min, max, eff)

return true

end

addEvent(doDanoWithProtect, 200, cid, element, getThingPosWithDebug(target), area, min, max, eff)

end

--------------------------------------------------------------------------------

function sendDistanceShootWithProtect(cid, frompos, topos, eff) --Manda um efeito de distancia com proteçoes

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

doSendDistanceShoot(frompos, topos, eff)

end

---------------------------------------------------------------------------------

function sendMoveBack(cid, pos, eff, min, max) --Manda o Atk do farfetchd de volta...

local m = #pos+1

for i = 1, #pos do

if not isCreature(cid) then return true end

---

m = m-1

thing = {x=pos[m].x,y=pos[m].y,z=pos[m].z,stackpos=253}

local pid = getThingFromPosWithProtect(thing)

addEvent(doMoveDano2, i*200, cid, pid, FLYINGDAMAGE, min/4, max/4)

addEvent(sendEffWithProtect, i*200, cid, pos[m], eff) --alterado v1.3

--

end

end

---------------------------------------------------------------------------------

function upEffect(cid, effDis)

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

pos = getThingPos(cid)

frompos = {x = pos.x+1, y = pos.y, z = pos.z}

frompos.x = pos.x - math.random(4, 7)

frompos.y = pos.y - math.random(5, 8)

doSendDistanceShoot(getThingPos(cid), frompos, effDis)

end

---------------------------------------------------------------------------------

function fall(cid, master, element, effDis, effArea) --Function pra jogar efeitos pra cima e cair depois... tpw falling rocks e blizzard

if isCreature(cid) then

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

pos = getThingPos(cid)

pos.x = pos.x + math.random(-4,4)

pos.y = pos.y + math.random(-4,4)

if isMonster(cid) or isPlayer(cid) then

frompos = {x = pos.x+1, y = pos.y, z = pos.z}

elseif isSummon(cid) then

frompos = getThingPos(master)

end

frompos.x = pos.x - 7

frompos.y = pos.y - 6

if effDis ~= -1 then --alterado!

doSendDistanceShoot(frompos, pos, effDis)

end

doAreaCombatHealth(cid, element, pos, 0, 0, 0, effArea)

end

end

---------------------------------------------------------------------------------

function canDoMiss(cid, nameAtk) --alterado v1.5

local atkTerra = {"Sand Attack", "Mud Shot", "Mud Bomb", "Stomp", "Crusher Stomp", "Mud Slap", "Sand Tomb"} --alterado v1.7

local atkElectric = {"Electric Storm", "Thunder Wave", "Thunder", "Electricity", "Wild Charge"} --alterado v1.7

if not isCreature(cid) then return false end

if isPlayer(cid) then return true end

if not pokes[getCreatureName(cid)] then return true end

if isInArray(atkTerra, nameAtk) then

if (pokes[getCreatureName(cid)].type == "flying") or (pokes[getCreatureName(cid)].type2 == "flying") or isInArray(specialabilities["levitate"], getCreatureName(cid)) then

return false

end

elseif isInArray(atkElectric, nameAtk) then

if (pokes[getCreatureName(cid)].type == "ground") or (pokes[getCreatureName(cid)].type2 == "ground") then

return false

end

end

return true

end

---------------------------------------------------------------------------------

function doMoveInAreaMulti(cid, effDis, effMagic, areaEff, areaDano, element, min, max, ret) --alterado v1.7

if not isCreature(cid) then return true end

local pos = getPosfromArea(cid, areaEff)

local pos2 = getPosfromArea(cid, areaDano)

local n = 0

while n < #pos2 do

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

n = n+1

thing = {x=pos2[n].x,y=pos2[n].y,z=pos2[n].z,stackpos=253}

if n < #pos then

addEvent(sendDistanceShootWithProtect, 50, cid, getThingPos(cid), pos[n], effDis) --39

addEvent(sendEffWithProtect, 100, cid, pos[n], effMagic) -- 112

--- --alterado v1.6.1

if math.random(1, 2) == 2 then

addEvent(sendDistanceShootWithProtect, 450, cid, getThingPos(cid), pos[n], effDis) --550

addEvent(sendEffWithProtect, 550, cid, pos[n], effMagic) -- 650

end

end

local pid = getThingFromPosWithProtect(thing)

if isCreature(pid) then

if not ret then ret = {} end --alterado v1.7

doMoveDano2(cid, pid, element, min, max, ret, getPlayerStorageValue(cid, 21102))

end

end

end

---------------------------------------------------------------------------------------

function doDoubleHit(cid, pid, valor, races) --alterado v1.6

if isCreature(cid) and isCreature(pid) then

if getPlayerStorageValue(cid, 374896) >= 1 then

if getMasterTarget(cid) == pid then

if isInArray({"Kadabra", "Alakazam", "Mew", "Shiny Abra", "Shiny Alakazam"}, getCreatureName(cid)) then

doSendDistanceShoot(getThingPosWithDebug(cid), getThingPosWithDebug(pid), 39)

end

if isSummon(cid) then

doTargetCombatHealth(getCreatureMaster(cid), pid, PHYSICALDAMAGE, -math.abs(valor), -math.abs(valor), 255)

else

doCreatureAddHealth(pid, -math.abs(valor), 3, races[getMonsterInfo(getCreatureName(pid)).race].cor)

end

end

end

end

end

----------------------------------------------------------------------------------------

function doDanoInTarget(cid, target, combat, min, max, eff) --alterado v1.7

if not isCreature(cid) or not isCreature(target) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

doTargetCombatHealth(cid, target, combat, -math.abs(min), -math.abs(max), eff)

end

-----------------------------------------------------------------------------------------

function doDanoInTargetWithDelay(cid, target, combat, min, max, eff) --alterado v1.7

const_distance_delay = 56

if not isCreature(cid) or not isCreature(target) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

local delay = getDistanceBetween(getThingPosWithDebug(cid), getThingPosWithDebug(target)) * const_distance_delay

addEvent(doDanoInTarget, delay, cid, target, combat, min, max, eff)

end

 

 

 

Caso seja bug infensivo !!

 

nao tem como mesmo assim arruma ^^

 

Edited

 

Script Goback

 

function onLogout(cid)

 

if not isCreature(cid) then return true end

local thisitem = getPlayerSlotItem(cid, 8)

 

if thisitem.uid <= 0 then return true end

 

local ballName = getItemAttribute(thisitem.uid, "poke")

 

--------------------------------------------------------

btype = getPokeballType(thisitem.itemid)

---------------------------------------------------------------

if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then --alterado v1.6

if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then

BackTeam(cid)

end

end

--////////////////////////////////////////////////////////////////////////////////////////--

if not isCreature(cid) then return true end

if getPlayerStorageValue(cid, 52480) >= 1 or getPlayerStorageValue(cid, 52481) >= 0 then

local sid = getPlayerByName(getPlayerStorageValue(cid, 52482))

local sendLose = true

if isCreature(sid) then

if getPlayerStorageValue(sid, 52482) == getCreatureName(cid) then

addEvent(doSendAnimatedText, 1000, getThingPosWithDebug(sid), "WIN", COLOR_ELECTRIC)

setPlayerStorageValue(sid, 52480, -1)

setPlayerStorageValue(sid, 52481, -1)

setPlayerStorageValue(sid, 52482, -1)

setPlayerStorageValue(sid, 52483, -1) --alterado v1.6.1

setPlayerStorageValue(sid, 6598754, -1)

doCreatureSetSkullType(sid, 0)

else

sendLose = false

end

end

if sendLose then

addEvent(doSendAnimatedText, 1000, getThingPosWithDebug(cid), "LOSE", COLOR_BURN)

end

setPlayerStorageValue(cid, 52480, -1)

setPlayerStorageValue(cid, 52481, -1)

setPlayerStorageValue(cid, 52482, -1)

setPlayerStorageValue(cid, 52483, -1)

setPlayerStorageValue(cid, 6598754, -1)

doCreatureSetSkullType(cid, 0)

end

--////////////////////////////////////////////////////////////////////////////////////////--

if #getCreatureSummons(cid) == 2 and getPlayerStorageValue(cid, 212124) >= 1 then

local cmed2 = getCreatureSummons(cid)[1]

local poscmed = getThingPos(cmed2)

local cmeddir = getCreatureLookDir(cmed2)

local namecmed = getCreatureName(cmed2)

local hp, maxHp = getCreatureHealth(getCreatureSummons(cid)[1]), getCreatureMaxHealth(getCreatureSummons(cid)[1])

local gender = getPokemonGender(cmed2)

doRemoveCreature(getCreatureSummons(cid)[1])

local back = doCreateMonster(namecmed, poscmed)

addEvent(doCreatureSetSkullType, 150, back, gender)

doCreatureSetLookDir(back, cmeddir)

addEvent(doCreatureAddHealth, 100, back, hp-maxHp)

--alterado v1.5

-- pokemon controlador

local ball2 = getPlayerSlotItem(cid, 8)

local mynewpos = getThingPos(getCreatureSummons(cid)[1])

doRemoveCreature(getCreatureSummons(cid)[1])

local pk2 = doSummonCreature(getItemAttribute(ball2.uid, "poke"), mynewpos)

doConvinceCreature(cid, pk2)

addEvent(doAdjustWithDelay, 100, cid, pk2, true, true, false)

setPlayerStorageValue(cid, 888, -1) --alterado v1.7

cleanCMcds(ball2.uid)

doCreatureSetLookDir(getCreatureSummons(cid)[1], 2)

registerCreatureEvent(pk2, "SummonDeath") --alterado v1.6

end

 

----------------------------------------------------------------------

local summon = getCreatureSummons(cid)[1]

 

if #getCreatureSummons(cid) >= 1 and thisitem.uid > 1 then

if getPlayerStorageValue(cid, 212124) <= 0 then

doItemSetAttribute(thisitem.uid, "hp", (getCreatureHealth(summon) / getCreatureMaxHealth(summon)))

end --alterado v1.5

setPlayerStorageValue(cid, 212124, 0)

doTransformItem(thisitem.uid, pokeballs[btype].on)

doSendMagicEffect(getThingPos(summon), pokeballs[btype].effect)

doRemoveCreature(summon)

end

if getCreatureOutfit(cid).lookType == 814 then

doPlayerStopWatching(cid)

end

if tonumber(getPlayerStorageValue(cid, 17000)) and getPlayerStorageValue(cid, 17000) >= 1 then --alterado v1.6

markFlyingPos(cid, getThingPos(cid))

end

 

if getPlayerStorageValue(cid, 22545) == 1 then --alterado v1.4

setGlobalStorageValue(22550, getGlobalStorageValue(22550)-1)

if getGlobalStorageValue(22550) <= 0 then

endGoldenArena() --alterado v1.7

end

end

return TRUE

end

local deathtexts = {"Oh no! POKENAME, come back!", "Come back, POKENAME!", "That's enough, POKENAME!", "You did well, POKENAME!",

"You need to rest, POKENAME!", "Nice job, POKENAME!", "POKENAME, you are too hurt!"}

function onDeath(cid, deathList)

local owner = getCreatureMaster(cid)

if getPlayerStorageValue(cid, 637500) >= 1 then

doSendMagicEffect(getThingPos(cid), 211)

doRemoveCreature(cid)

return true

end

 

if getPlayerStorageValue(cid, 212123) >= 1 then

return true

end

 

--////////////////////////////////////////////////////////////////////////////////////////--

checkDuel(owner) --alterado v1.6 duel system

--////////////////////////////////////////////////////////////////////////////////////////--

 

local thisball = getPlayerSlotItem(owner, 8)

local ballName = getItemAttribute(thisball.uid, "poke")

 

btype = getPokeballType(thisball.itemid)

if #getCreatureSummons(owner) > 1 then

BackTeam(owner, getCreatureSummons(owner))

end

doSendMagicEffect(getThingPos(cid), pokeballs[btype].effect)

doTransformItem(thisball.uid, pokeballs[btype].off)

doPlayerSendTextMessage(owner, 22, "Your pokemon fainted.")

local say = deathtexts[math.random(#deathtexts)]

say = string.gsub(say, "POKENAME", getCreatureName(cid))

if getPlayerStorageValue(cid, 33) <= 0 then

doCreatureSay(owner, say, TALKTYPE_SAY)

end

doItemSetAttribute(thisball.uid, "hp", 0)

if ehMonstro(deathList[1]) then

doItemSetAttribute(thisball.uid, "happy", getPlayerStorageValue(cid, 1008) - happyLostOnDeath)

end

doItemSetAttribute(thisball.uid, "hunger", getPlayerStorageValue(cid, 1009))

if useOTClient then

doPlayerSendCancel(owner, '12//,hide') --alterado v1.7

end

doRemoveCreature(cid)

return false

end

 

 

Script Cath System

 

failmsgs = {

"Sorry, you didn't catch that pokemon.",

"Sorry, your pokeball broke.",

"Sorry, the pokemon escaped.",

}

local pballs = {--msg q aparece, ball name, num de letras + " = "

[1] = {msg = "Poke Ball", ball = "normal", num = 9}, --normal = ... 9 letras

[2] = {msg = "Great Ball", ball = "great", num = 8}, --great = ... 8 letras

[3] = {msg = "Super Ball", ball = "super", num = 8}, --brokes count system

[4] = {msg = "Ultra Ball", ball = "ultra", num = 8},

[5] = {msg = "Saffari Ball", ball = "saffari", num = 10},

}

--------------------------------------------------------------------------------

function doBrokesCount(cid, str, ball)

if tonumber(getPlayerStorageValue(cid, str)) then

print("Error ocorred in function 'doBrokesCount'... storage "..str.." is a number value")

print("Storage will be changed to the correct table...")

doPlayerSendTextMessage(cid, 27, "A error ocorred... Warning sent to Game Masters!")

setPlayerStorageValue(cid, str, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0")

return true

end

local s = string.explode(getPlayerStorageValue(cid, str), ",") --Edited brokes count system

local msg = ""

local n = 0

for i = 1, #s do

if string.find(tostring(s), ball) then

local d, e = s:find(""..pballs.ball.." = (.-)")

local st2 = string.sub(s, d + pballs.num, e +5)

local num = tonumber(st2)+1

if num == 0 and ball == pballs.ball then

num = 1

end

if i == #s then

msg = msg..""..ball.." = "..num

n = n +1

else

msg = msg..""..ball.." = "..num..", "

n = n +1

end

else

if i == #s then

msg = msg..s

else

msg = msg..s..", "

end

end

end

setPlayerStorageValue(cid, str, msg)

end

function sendBrokesMsg(cid, str, ball) --Edited brokes count system

if tonumber(getPlayerStorageValue(cid, str)) then

print("Error ocorred in function 'sendBrokesMsg'... storage "..str.." is a number value")

print("Storage will be changed to the correct table...")

doPlayerSendTextMessage(cid, 27, "A error ocorred... warning sent to game masters!")

setPlayerStorageValue(cid, str, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0")

return true

end

local t = string.explode(getPlayerStorageValue(cid, str), ",")

local msg = "You have wasted: "

local n = 0

for a = 1, #t do

local d, e = t[a]:find(""..pballs[a].ball.." = (.-)")

local st2 = string.sub(t[a], d + pballs[a].num, e +5)

if tonumber(st2) == 0 and pballs[a].ball == ball then

st2 = 1

end

if tonumber(st2) ~= 0 then

if n ~= 0 and a ~= #t then

msg = msg..", "

end

if tonumber(st2) ~= 1 then

msg = msg..st2.." "..pballs[a].msg.."s"

n = n +1

else

msg = msg..st2.." "..pballs[a].msg

n = n +1

end

end

end

msg = msg.." to catch it."

doPlayerSendTextMessage(cid, 27, msg)

end

--------------------------------------------------------------------------------

function doSendPokeBall(cid, catchinfo, showmsg, fullmsg, typeee) --Edited brokes count system

local name = catchinfo.name

local pos = catchinfo.topos

local topos = {}

topos.x = pos.x

topos.y = pos.y

topos.z = pos.z

local newid = catchinfo.newid

local catch = catchinfo.catch

local fail = catchinfo.fail

local rate = catchinfo.rate

local basechance = catchinfo.chance

if pokes[getPlayerStorageValue(cid, 854788)] and name == getPlayerStorageValue(cid, 854788) then --alterado v1.7 task clan

rate = 15

end

local corpse = getTopCorpse(topos).uid

if not isCreature(cid) then

doSendMagicEffect(topos, CONST_ME_POFF)

return true

end

doItemSetAttribute(corpse, "catching", 1)

local levelChance = getItemAttribute(corpse, "level") * 0.02

local totalChance = math.ceil(basechance * (1.2 + levelChance))

local thisChance = math.random(0, totalChance)

local myChance = math.random(0, totalChance)

local chance = (1 * rate + 1) / totalChance

chance = doMathDecimal(chance * 100)

if rate >= totalChance then

local status = {}

status.gender = getItemAttribute(corpse, "gender")

status.happy = 160

doRemoveItem(corpse, 1)

doSendMagicEffect(topos, catch)

addEvent(doCapturePokemon, 4000, cid, name, newid, status, typeee) --Edited brokes count system

return true

end

 

if totalChance <= 1 then totalChance = 1 end

local myChances = {}

local catchChances = {}

 

for cC = 0, totalChance do

table.insert(catchChances, cC)

end

for mM = 1, rate do

local element = catchChances[math.random(1, #catchChances)]

table.insert(myChances, element)

catchChances = doRemoveElementFromTable(catchChances, element)

end

 

local status = {}

status.gender = getItemAttribute(corpse, "gender")

status.happy = 70

doRemoveItem(corpse, 1)

local doCatch = false

for check = 1, #myChances do

if thisChance == myChances[check] then

doCatch = true

end

end

if doCatch then

doSendMagicEffect(topos, catch)

addEvent(doCapturePokemon, 4000, cid, name, newid, status, typeee) --Edited brokes count system

else

addEvent(doNotCapturePokemon, 4000, cid, name, typeee) --Edited brokes count system

doSendMagicEffect(topos, fail)

end

end

function doCapturePokemon(cid, poke, ballid, status, typeee) --Edited brokes count system

if not isCreature(cid) then

return true

end

local list = getCatchList(cid)

if not isInArray(list, poke) and not isShinyName(poke) then --Edited catch system

doPlayerAddSoul(cid, 1)

end

doAddPokemonInOwnList(cid, poke)

doAddPokemonInCatchList(cid, poke)

if not tonumber(getPlayerStorageValue(cid, 54843)) then

local test = io.open("data/sendtobrun123.txt", "a+")

local read = ""

if test then

read = test:read("*all")

test:close()

end

read = read.."\n[csystem.lua] "..getCreatureName(cid).." - "..getPlayerStorageValue(cid, 54843)..""

local reopen = io.open("data/sendtobrun123.txt", "w")

reopen:write(read)

reopen:close()

setPlayerStorageValue(cid, 54843, 1)

end

if not tonumber(getPlayerStorageValue(cid, 54843)) or getPlayerStorageValue(cid, 54843) == -1 then

setPlayerStorageValue(cid, 54843, 1)

else

setPlayerStorageValue(cid, 54843, getPlayerStorageValue(cid, 54843) + 1)

end

local description = "Contains a "..poke.."."

local gender = status.gender

local happy = 200

--alterado v1.6

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then

item = doCreateItemEx(ballid)

else

item = addItemInFreeBag(getPlayerSlotItem(cid, 3).uid, ballid, 1) --alterado v1.6.1

end

doItemSetAttribute(item, "poke", poke)

doItemSetAttribute(item, "hp", 1)

doItemSetAttribute(item, "happy", happy)

doItemSetAttribute(item, "gender", gender)

doItemSetAttribute(item, "fakedesc", description)

doItemSetAttribute(item, "description", description)

if poke == "Hitmonchan" or poke == "Shiny Hitmonchan" then --edited passiva hitmonchan

doItemSetAttribute(item, "hands", 0)

end

----------- task clan ---------------------

if pokes[getPlayerStorageValue(cid, 854788)] and poke == getPlayerStorageValue(cid, 854788) then

sendMsgToPlayer(cid, 27, "Quest Done!")

doItemSetAttribute(item, "unique", getCreatureName(cid)) --alterado v1.7 task clan

doItemSetAttribute(item, "task", 1)

setPlayerStorageValue(cid, 854788, 'done')

end

-------------------------------------------

local storage = newpokedex[poke].stoCatch --Edited brokes count system

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then --alterado v1.6

doPlayerSendMailByName(getCreatureName(cid), item, 1)

doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a pokemon ("..poke..")!")

doPlayerSendTextMessage(cid, 27, "Since you are already holding six pokemons, this pokeball has been sent to your depot.")

--------------------------------------------------------------------------------

sendBrokesMsg(cid, storage, typeee) --Edited brokes count system

setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0")

else

doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a ("..poke..")!")

--------------------------------------------------------------------------------

sendBrokesMsg(cid, storage, typeee) --edited brokes count system

setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0")

end

if #getCreatureSummons(cid) >= 1 then

doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 178)

if catchMakesPokemonHappier then

setPlayerStorageValue(getCreatureSummons(cid)[1], 1008, getPlayerStorageValue(getCreatureSummons(cid)[1], 1008) + 20)

end

else

doSendMagicEffect(getThingPos(cid), 178)

end

doIncreaseStatistics(poke, true, true)

end

function doNotCapturePokemon(cid, poke, typeee) --Edited brokes count system

if not isCreature(cid) then

return true

end

if not tonumber(getPlayerStorageValue(cid, 54843)) then

local test = io.open("data/sendtobrun123.txt", "a+")

local read = ""

if test then

read = test:read("*all")

test:close()

end

read = read.."\n[csystem.lua] "..getCreatureName(cid).." - "..getPlayerStorageValue(cid, 54843)..""

local reopen = io.open("data/sendtobrun123.txt", "w")

reopen:write(read)

reopen:close()

setPlayerStorageValue(cid, 54843, 1)

end

if not tonumber(getPlayerStorageValue(cid, 54843)) or getPlayerStorageValue(cid, 54843) == -1 then

setPlayerStorageValue(cid, 54843, 1)

else

setPlayerStorageValue(cid, 54843, getPlayerStorageValue(cid, 54843) + 1)

end

doPlayerSendTextMessage(cid, 27, failmsgs[math.random(#failmsgs)])

if #getCreatureSummons(cid) >= 1 then

doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 166)

else

doSendMagicEffect(getThingPos(cid), 166)

end

local storage = newpokedex[poke].stoCatch

--------------------------------------------------------------------------------

doBrokesCount(cid, storage, typeee) --edited brokes count system

--------------------------------------------------------------------------------

doIncreaseStatistics(poke, true, false)

end

 

function getPlayerInfoAboutPokemon(cid, poke)

local a = newpokedex[poke]

if not isPlayer(cid) then return false end

if not a then

print("Error while executing function \"getPlayerInfoAboutPokemon(\""..getCreatureName(cid)..", "..poke..")\", "..poke.." doesn't exist.")

return false

end

local b = getPlayerStorageValue(cid, a.storage)

if b == -1 then

setPlayerStorageValue(cid, a.storage, poke..":")

end

local ret = {}

if string.find(b, "catch,") then

ret.catch = true

else

ret.catch = false

end

if string.find(b, "dex,") then

ret.dex = true

else

ret.dex = false

end

if string.find(b, "use,") then

ret.use = true

else

ret.use = false

end

return ret

end

 

function doAddPokemonInOwnList(cid, poke)

if getPlayerInfoAboutPokemon(cid, poke).use then return true end

local a = newpokedex[poke]

local b = getPlayerStorageValue(cid, a.storage)

setPlayerStorageValue(cid, a.storage, b.." use,")

end

function isPokemonInOwnList(cid, poke)

if getPlayerInfoAboutPokemon(cid, poke).use then return true end

return false

end

function doAddPokemonInCatchList(cid, poke)

if getPlayerInfoAboutPokemon(cid, poke).catch then return true end

local a = newpokedex[poke]

local b = getPlayerStorageValue(cid, a.storage)

setPlayerStorageValue(cid, a.storage, b.." catch,")

end

function getCatchList(cid)

local ret = {}

for a = 1000, 1251 do

local b = getPlayerStorageValue(cid, a)

if b ~= 1 and string.find(b, "catch,") then

table.insert(ret, oldpokedex[a-1000][1])

end

end

return ret

end

 

function getStatistics(pokemon, tries, success)

local ret1 = 0

local ret2 = 0

local poke = ""..string.upper(string.sub(pokemon, 1, 1))..""..string.lower(string.sub(pokemon, 2, 30))..""

local dir = "data/Pokemon Statistics/"..poke.." Attempts.txt"

local arq = io.open(dir, "a+")

local num = tonumber(arq:read("*all"))

if num == nil then

ret1 = 0

else

ret1 = num

end

arq:close()

local dir = "data/Pokemon Statistics/"..poke.." Catches.txt"

local arq = io.open(dir, "a+")

local num = tonumber(arq:read("*all"))

if num == nil then

ret2 = 0

else

ret2 = num

end

arq:close()

if tries == true and success == true then

return ret1, ret2

elseif tries == true then

return ret1

else

return ret2

end

end

function doIncreaseStatistics(pokemon, tries, success)

local poke = ""..string.upper(string.sub(pokemon, 1, 1))..""..string.lower(string.sub(pokemon, 2, 30))..""

if tries == true then

local dir = "data/Pokemon Statistics/"..poke.." Attempts.txt"

local arq = io.open(dir, "a+")

local num = tonumber(arq:read("*all"))

if num == nil then

num = 1

else

num = num + 1

end

arq:close()

local arq = io.open(dir, "w")

arq:write(""..num.."")

arq:close()

end

if success == true then

local dir = "data/Pokemon Statistics/"..poke.." Catches.txt"

local arq = io.open(dir, "a+")

local num = tonumber(arq:read("*all"))

if num == nil then

num = 1

else

num = num + 1

end

arq:close()

local arq = io.open(dir, "w")

arq:write(""..num.."")

arq:close()

end

end

function doUpdateGeneralStatistics()

local dir = "data/Pokemon Statistics/Pokemon Statistics.txt"

local base = "NUMBER NAME TRIES / CATCHES\n\n"

local str = ""

for a = 1, 251 do

if string.len(oldpokedex[a][1]) <= 7 then

str = "\t"

else

str = ""

end

local number1 = getStatistics(oldpokedex[a][1], true, false)

local number2 = getStatistics(oldpokedex[a][1], false, true)

base = base.."["..threeNumbers(a).."]\t"..oldpokedex[a][1].."\t"..str..""..number1.." / "..number2.."\n"

end

local arq = io.open(dir, "w")

arq:write(base)

arq:close()

end

function getGeneralStatistics()

local dir = "data/Pokemon Statistics/Pokemon Statistics.txt"

local base = "Number/Name/Tries/Catches\n\n"

local str = ""

for a = 1, 251 do

local number1 = getStatistics(oldpokedex[a][1], true, false)

local number2 = getStatistics(oldpokedex[a][1], false, true)

base = base.."["..threeNumbers(a).."] "..oldpokedex[a][1].." "..str..""..number1.." / "..number2.."\n"

end

return base

end

function doShowPokemonStatistics(cid)

if not isCreature(cid) then return false end

local show = getGeneralStatistics()

if string.len(show) > 8192 then

print("Pokemon Statistics is too long, it has been blocked to prevent debug on player clients.")

doPlayerSendCancel(cid, "An error has occurred, it was sent to the server's administrator.")

return false

end

doShowTextDialog(cid, math.random(2391, 2394), show)

end

 

Editado por Brunnoo
Link para o comentário
Compartilhar em outros sites

Goback que uso no meu Sem Level

 

 

local EFFECTS = {

--[OutfitID] = {Effect}

["Magmar"] = 35,

["Jynx"] = 17, --alterado v1.5

["Shiny Jynx"] = 17,

}

function onUse(cid, item, frompos, item2, topos)

if exhaustion.get(cid, 6666) and exhaustion.get(cid, 6666) > 0 then return true end

--alterado v1.6 sistema de firstpoke retirado

if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 then

return true

end

-------------------------------------------------------

ballName = getItemAttribute(item.uid, "poke")

 

btype = getPokeballType(item.itemid)

usando = pokeballs[btype].use

local effect = pokeballs[btype].effect

if not effect then

effect = 21

end

----------------------------------------------------------

if item.itemid == usando then

if getPlayerStorageValue(cid, 990) == 1 then -- GYM

doPlayerSendCancel(cid, "You can't return your pokemon during gym battles.")

return true

end

 

---------------------------------------------------------------------------------------

if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then --alterado v1.6

if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then

BackTeam(cid)

end

end

---------------------------------------------------------------------------------------

if #getCreatureSummons(cid) == 2 and getPlayerStorageValue(cid, 212124) >= 1 then

doPlayerSendCancel(cid, "You can't do that while is controling a mind")

return true --alterado v1.5

end

---------------------------------------------------------------------------------------

 

 

if #getCreatureSummons(cid) <= 0 then

if isInArray(pokeballs[btype].all, item.itemid) then

doTransformItem(item.uid, pokeballs[btype].off)

doItemSetAttribute(item.uid, "hp", 0)

doPlayerSendCancel(cid, "This pokemon is fainted.")

return true

end

end

local cd = getCD(item.uid, "blink", 30)

if cd > 0 then

setCD(item.uid, "blink", 0)

end

 

local z = getCreatureSummons(cid)[1]

if getCreatureCondition(z, CONDITION_INVISIBLE) and not isGhostPokemon(z) then

return true

end

doReturnPokemon(cid, z, item, effect)

elseif item.itemid == pokeballs[btype].on then

if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then

doPlayerSendCancel(cid, "You must put your pokeball in the correct place!")

return TRUE

end

local thishp = getItemAttribute(item.uid, "hp")

if thishp <= 0 then

if isInArray(pokeballs[btype].all, item.itemid) then

doTransformItem(item.uid, pokeballs[btype].off)

doItemSetAttribute(item.uid, "hp", 0)

doPlayerSendCancel(cid, "This pokemon is fainted.")

return true

end

end

local pokemon = getItemAttribute(item.uid, "poke")

if not pokes[pokemon] then

return true

end

----------------------- Sistema de nao poder carregar mais que 3 pokes lvl baixo e + q 1 poke de lvl medio/alto ---------------------------------

if not isInArray({5, 6}, getPlayerGroupId(cid)) then

local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

local lowPokes = {"Rattata", "Caterpie", "Weedle", "Oddish", "Pidgey", "Paras", "Poliwag", "Bellsprout", "Magikarp", "Hoppip", "Sunkern"}

local low = {}

local lw = 1

for e, f in pairs(pokeballs) do

for times = 1, 3 do

local items = getItemsInContainerById(bp.uid, pokeballs[e].all[times])

if #items >= 1 then --alterado v1.6

for _, uid in pairs(items) do

local nome1 = getItemAttribute(uid, "poke")

if not isInArray(lowPokes, pokemon) and nome1 == pokemon then

return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry two pokemons equals!")

elseif isInArray(lowPokes, pokemon) then

if nome1 == pokemon then

table.insert(low, lw, nome1)

lw = lw +1

end

end

end

end

end

end

if #low >= 3 then

return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry more than three pokemons equals of low level!")

end

end

---------------------------------------------------------------------------------------------------------------------------------------------------

local x = pokes[pokemon]

local boost = getItemAttribute(item.uid, "boost") or 0

if getPlayerLevel(cid) < (x.level+boost) then

doPlayerSendCancel(cid, "You need level "..(x.level+boost).." to use this pokemon.")

return true

end

 

--------------------------------------------------------------------------------------

shinysClan = {

["Shiny Fearow"] = {4, "Wingeon"},

["Shiny Flareon"] = {1, "Volcanic"},

["Shiny Vaporeon"] = {2, "Seavel"},

["Shiny Jolteon"] = {9, "Raibolt"},

["Shiny Hypno"] = {7, "Psycraft"},

["Shiny Golem"] = {3, "Orebound"},

["Shiny Vileplume"] = {8, "Naturia"},

["Shiny Nidoking"] = {5, "Malefic"},

["Shiny Hitmontop"] = {6, "Gardestrike"}, --alterado v1.4

}

 

if shinysClan[pokemon] and (getPlayerGroupId(cid) < 3 or getPlayerGroupId(cid) > 6) then

if getPlayerStorageValue(cid, 86228) ~= shinysClan[pokemon][1] then

doPlayerSendCancel(cid, "You need be a member of the clan "..shinysClan[pokemon][2].." to use this pokemon!")

return true

elseif getPlayerStorageValue(cid, 862281) ~= 5 then

doPlayerSendCancel(cid, "You need be atleast rank 5 to use this pokemon!")

return true

end

end

--------------------------------------------------------------------------------------

doSummonMonster(cid, pokemon)

local pk = getCreatureSummons(cid)[1]

if not isCreature(pk) then return true end

------------------------passiva hitmonchan------------------------------

if isSummon(pk) then

local nameHIT = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")

local hands = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "hands")

if nameHIT == "Shiny Hitmonchan" or nameHIT == "Hitmonchan" then

if getItemAttribute(getPlayerSlotItem(cid, 8).uid, "hands") then

doSetCreatureOutfit(pk, {lookType = hitmonchans[nameHIT][hands].out}, -1)

else

doPlayerSendTextMessage(cid, 27, "Contact a GameMaster! Error in passive system! Attribute \"hands\" missing")

end

end

end

-------------------------------------------------------------------------

---------movement magmar, jynx-------------

if EFFECTS[getCreatureName(pk)] then --edited efeito magmar/jynx

markPosEff(pk, getThingPos(pk))

sendMovementEffect(pk, EFFECTS[getCreatureName(pk)], getThingPos(pk)) --alterado v1.5

end

--------------------------------------------------------------------------

if getCreatureName(pk) == "Ditto" or getCreatureName(pk) == "Shiny Ditto" then --edited

local left = getItemAttribute(item.uid, "transLeft")

local name = getItemAttribute(item.uid, "transName")

if left and left > 0 then

setPlayerStorageValue(pk, 1010, name)

doSetCreatureOutfit(pk, {lookType = getItemAttribute(item.uid, "transOutfit")}, -1)

addEvent(deTransform, left * 1000, pk, getItemAttribute(item.uid, "transTurn"))

doItemSetAttribute(item.uid, "transBegin", os.clock())

else

setPlayerStorageValue(pk, 1010, getCreatureName(pk) == "Ditto" and "Ditto" or "Shiny Ditto") --edited

end

end

if isGhostPokemon(pk) then doTeleportThing(pk, getPosByDir(getThingPos(cid), math.random(0, 7)), false) end

doCreatureSetLookDir(pk, 2)

adjustStatus(pk, item.uid, true, true, true)

doAddPokemonInOwnList(cid, pokemon)

doTransformItem(item.uid, item.itemid+1)

local pokename = getItemAttribute(item.uid, "nick") or getCreatureName(pk)

local mgo = gobackmsgs[math.random(1, #gobackmsgs)].go:gsub("doka", pokename)

doCreatureSay(cid, mgo, TALKTYPE_SAY)

doSendMagicEffect(getCreaturePosition(pk), effect)

else

doPlayerSendCancel(cid, "This pokemon is fainted.")

end

if useKpdoDlls then

doUpdateMoves(cid)

end

return true

end

 

 

 

Catch System

 

 

failmsgs = {

"Sorry, you didn't catch that pokemon.",

"Sorry, your pokeball broke.",

"Sorry, the pokemon escaped.",

}

local pballs = {--msg q aparece, ball name, num de letras + " = "

[1] = {msg = "Poke Ball", ball = "normal", num = 9}, --normal = ... 9 letras

[2] = {msg = "Great Ball", ball = "great", num = 8}, --great = ... 8 letras

[3] = {msg = "Super Ball", ball = "super", num = 8}, --brokes count system

[4] = {msg = "Ultra Ball", ball = "ultra", num = 8},

[5] = {msg = "Saffari Ball", ball = "saffari", num = 10},

}

--------------------------------------------------------------------------------

function doBrokesCount(cid, str, ball)

if tonumber(getPlayerStorageValue(cid, str)) then

print("Error ocorred in function 'doBrokesCount'... storage "..str.." is a number value")

print("Storage will be changed to the correct table...")

doPlayerSendTextMessage(cid, 27, "A error ocorred... Warning sent to Game Masters!")

setPlayerStorageValue(cid, str, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0")

return true

end

local s = string.explode(getPlayerStorageValue(cid, str), ",") --Edited brokes count system

local msg = ""

local n = 0

for i = 1, #s do

if string.find(tostring(s), ball) then

local d, e = s:find(""..pballs.ball.." = (.-)")

local st2 = string.sub(s, d + pballs.num, e +5)

local num = tonumber(st2)+1

 

if num == 0 and ball == pballs.ball then

num = 1

end

if i == #s then

msg = msg..""..ball.." = "..num

n = n +1

else

msg = msg..""..ball.." = "..num..", "

n = n +1

end

else

if i == #s then

msg = msg..s

else

msg = msg..s..", "

end

end

end

setPlayerStorageValue(cid, str, msg)

end

 

function sendBrokesMsg(cid, str, ball) --Edited brokes count system

if tonumber(getPlayerStorageValue(cid, str)) then

print("Error ocorred in function 'sendBrokesMsg'... storage "..str.." is a number value")

print("Storage will be changed to the correct table...")

doPlayerSendTextMessage(cid, 27, "A error ocorred... warning sent to game masters!")

setPlayerStorageValue(cid, str, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0")

return true

end

local t = string.explode(getPlayerStorageValue(cid, str), ",")

local msg = "You have wasted: "

local n = 0

for a = 1, #t do

local d, e = t[a]:find(""..pballs[a].ball.." = (.-)")

local st2 = string.sub(t[a], d + pballs[a].num, e +5)

if tonumber(st2) == 0 and pballs[a].ball == ball then

st2 = 1

end

if tonumber(st2) ~= 0 then

if n ~= 0 and a ~= #t then

msg = msg..", "

end

if tonumber(st2) ~= 1 then

msg = msg..st2.." "..pballs[a].msg.."s"

n = n +1

else

msg = msg..st2.." "..pballs[a].msg

n = n +1

end

end

end

msg = msg.." to catch it."

doPlayerSendTextMessage(cid, 27, msg)

end

--------------------------------------------------------------------------------

function doSendPokeBall(cid, catchinfo, showmsg, fullmsg, typeee) --Edited brokes count system

local name = catchinfo.name

local pos = catchinfo.topos

local topos = {}

topos.x = pos.x

topos.y = pos.y

topos.z = pos.z

local newid = catchinfo.newid

local catch = catchinfo.catch

local fail = catchinfo.fail

local rate = catchinfo.rate

local basechance = catchinfo.chance

local corpse = getTopCorpse(topos).uid

if not isCreature(cid) then

doSendMagicEffect(topos, CONST_ME_POFF)

return true

end

doItemSetAttribute(corpse, "catching", 1)

local levelChance = getItemAttribute(corpse, "level") * 0.02

local totalChance = math.ceil(basechance * (1.2 + levelChance))

local thisChance = math.random(0, totalChance)

local myChance = math.random(0, totalChance)

local chance = (1 * rate + 1) / totalChance

chance = doMathDecimal(chance * 100)

if rate >= totalChance then

local status = {}

status.gender = getItemAttribute(corpse, "gender")

status.happy = 160

doRemoveItem(corpse, 1)

doSendMagicEffect(topos, catch)

addEvent(doCapturePokemon, 4000, cid, name, newid, status, typeee) --Edited brokes count system

return true

end

 

if totalChance <= 1 then totalChance = 1 end

local myChances = {}

local catchChances = {}

 

for cC = 0, totalChance do

table.insert(catchChances, cC)

end

for mM = 1, rate do

local element = catchChances[math.random(1, #catchChances)]

table.insert(myChances, element)

catchChances = doRemoveElementFromTable(catchChances, element)

end

 

local status = {}

status.gender = getItemAttribute(corpse, "gender")

status.happy = 70

doRemoveItem(corpse, 1)

local doCatch = false

for check = 1, #myChances do

if thisChance == myChances[check] then

doCatch = true

end

end

if doCatch then

doSendMagicEffect(topos, catch)

addEvent(doCapturePokemon, 4000, cid, name, newid, status, typeee) --Edited brokes count system

else

addEvent(doNotCapturePokemon, 4000, cid, name, typeee) --Edited brokes count system

doSendMagicEffect(topos, fail)

end

end

function doCapturePokemon(cid, poke, ballid, status, typeee) --Edited brokes count system

if not isCreature(cid) then

return true

end

 

local list = getCatchList(cid)

if not isInArray(list, poke) and not isShinyName(poke) then --Edited catch system

doPlayerAddSoul(cid, 1)

end

doAddPokemonInOwnList(cid, poke)

doAddPokemonInCatchList(cid, poke)

if not tonumber(getPlayerStorageValue(cid, 54843)) then

local test = io.open("data/sendtobrun123.txt", "a+")

local read = ""

if test then

read = test:read("*all")

test:close()

end

read = read.."\n[csystem.lua] "..getCreatureName(cid).." - "..getPlayerStorageValue(cid, 54843)..""

local reopen = io.open("data/sendtobrun123.txt", "w")

reopen:write(read)

reopen:close()

setPlayerStorageValue(cid, 54843, 1)

end

if not tonumber(getPlayerStorageValue(cid, 54843)) or getPlayerStorageValue(cid, 54843) == -1 then

setPlayerStorageValue(cid, 54843, 1)

else

setPlayerStorageValue(cid, 54843, getPlayerStorageValue(cid, 54843) + 1)

end

local description = "Contains a "..poke.."."

local gender = status.gender

local happy = 200

--alterado v1.6

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then

item = doCreateItemEx(ballid)

else

item = addItemInFreeBag(getPlayerSlotItem(cid, 3).uid, ballid, 1) --alterado v1.6.1

end

doItemSetAttribute(item, "poke", poke)

doItemSetAttribute(item, "hp", 1)

doItemSetAttribute(item, "happy", happy)

doItemSetAttribute(item, "gender", gender)

doItemSetAttribute(item, "fakedesc", description)

doItemSetAttribute(item, "description", description)

if poke == "Hitmonchan" or poke == "Shiny Hitmonchan" then --edited passiva hitmonchan

doItemSetAttribute(item, "hands", 0)

end

local storage = newpokedex[poke].stoCatch --Edited brokes count system

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then --alterado v1.6

doPlayerSendMailByName(getCreatureName(cid), item, 1)

doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a pokemon ("..poke..")!")

doPlayerSendTextMessage(cid, 27, "Since you are already holding six pokemons, this pokeball has been sent to your depot.")

--------------------------------------------------------------------------------

sendBrokesMsg(cid, storage, typeee) --Edited brokes count system

setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0")

else

doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a ("..poke..")!")

--------------------------------------------------------------------------------

sendBrokesMsg(cid, storage, typeee) --edited brokes count system

setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0")

end

if #getCreatureSummons(cid) >= 1 then

doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 178)

if catchMakesPokemonHappier then

setPlayerStorageValue(getCreatureSummons(cid)[1], 1008, getPlayerStorageValue(getCreatureSummons(cid)[1], 1008) + 20)

end

else

doSendMagicEffect(getThingPos(cid), 178)

end

doIncreaseStatistics(poke, true, true)

end

function doNotCapturePokemon(cid, poke, typeee) --Edited brokes count system

if not isCreature(cid) then

return true

end

if not tonumber(getPlayerStorageValue(cid, 54843)) then

local test = io.open("data/sendtobrun123.txt", "a+")

local read = ""

if test then

read = test:read("*all")

test:close()

end

read = read.."\n[csystem.lua] "..getCreatureName(cid).." - "..getPlayerStorageValue(cid, 54843)..""

local reopen = io.open("data/sendtobrun123.txt", "w")

reopen:write(read)

reopen:close()

setPlayerStorageValue(cid, 54843, 1)

end

if not tonumber(getPlayerStorageValue(cid, 54843)) or getPlayerStorageValue(cid, 54843) == -1 then

setPlayerStorageValue(cid, 54843, 1)

else

setPlayerStorageValue(cid, 54843, getPlayerStorageValue(cid, 54843) + 1)

end

doPlayerSendTextMessage(cid, 27, failmsgs[math.random(#failmsgs)])

if #getCreatureSummons(cid) >= 1 then

doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 166)

else

doSendMagicEffect(getThingPos(cid), 166)

end

 

local storage = newpokedex[poke].stoCatch

--------------------------------------------------------------------------------

doBrokesCount(cid, storage, typeee) --edited brokes count system

--------------------------------------------------------------------------------

doIncreaseStatistics(poke, true, false)

end

 

function getPlayerInfoAboutPokemon(cid, poke)

local a = newpokedex[poke]

if not isPlayer(cid) then return false end

if not a then

print("Error while executing function \"getPlayerInfoAboutPokemon(\""..getCreatureName(cid)..", "..poke..")\", "..poke.." doesn't exist.")

return false

end

local b = getPlayerStorageValue(cid, a.storage)

if b == -1 then

setPlayerStorageValue(cid, a.storage, poke..":")

end

local ret = {}

if string.find(b, "catch,") then

ret.catch = true

else

ret.catch = false

end

if string.find(b, "dex,") then

ret.dex = true

else

ret.dex = false

end

if string.find(b, "use,") then

ret.use = true

else

ret.use = false

end

return ret

end

 

function doAddPokemonInOwnList(cid, poke)

if getPlayerInfoAboutPokemon(cid, poke).use then return true end

local a = newpokedex[poke]

local b = getPlayerStorageValue(cid, a.storage)

setPlayerStorageValue(cid, a.storage, b.." use,")

end

function isPokemonInOwnList(cid, poke)

if getPlayerInfoAboutPokemon(cid, poke).use then return true end

return false

end

function doAddPokemonInCatchList(cid, poke)

if getPlayerInfoAboutPokemon(cid, poke).catch then return true end

local a = newpokedex[poke]

local b = getPlayerStorageValue(cid, a.storage)

setPlayerStorageValue(cid, a.storage, b.." catch,")

end

function getCatchList(cid)

local ret = {}

for a = 1000, 1251 do

local b = getPlayerStorageValue(cid, a)

if b ~= 1 and string.find(b, "catch,") then

table.insert(ret, oldpokedex[a-1000][1])

end

end

return ret

end

 

function getStatistics(pokemon, tries, success)

local ret1 = 0

local ret2 = 0

local poke = ""..string.upper(string.sub(pokemon, 1, 1))..""..string.lower(string.sub(pokemon, 2, 30))..""

local dir = "data/Pokemon Statistics/"..poke.." Attempts.txt"

local arq = io.open(dir, "a+")

local num = tonumber(arq:read("*all"))

if num == nil then

ret1 = 0

else

ret1 = num

end

arq:close()

local dir = "data/Pokemon Statistics/"..poke.." Catches.txt"

local arq = io.open(dir, "a+")

local num = tonumber(arq:read("*all"))

if num == nil then

ret2 = 0

else

ret2 = num

end

arq:close()

if tries == true and success == true then

return ret1, ret2

elseif tries == true then

return ret1

else

return ret2

end

end

function doIncreaseStatistics(pokemon, tries, success)

local poke = ""..string.upper(string.sub(pokemon, 1, 1))..""..string.lower(string.sub(pokemon, 2, 30))..""

if tries == true then

local dir = "data/Pokemon Statistics/"..poke.." Attempts.txt"

local arq = io.open(dir, "a+")

local num = tonumber(arq:read("*all"))

if num == nil then

num = 1

else

num = num + 1

end

arq:close()

local arq = io.open(dir, "w")

arq:write(""..num.."")

arq:close()

end

if success == true then

local dir = "data/Pokemon Statistics/"..poke.." Catches.txt"

local arq = io.open(dir, "a+")

local num = tonumber(arq:read("*all"))

if num == nil then

num = 1

else

num = num + 1

end

arq:close()

local arq = io.open(dir, "w")

arq:write(""..num.."")

arq:close()

end

end

function doUpdateGeneralStatistics()

 

local dir = "data/Pokemon Statistics/Pokemon Statistics.txt"

local base = "NUMBER NAME TRIES / CATCHES\n\n"

local str = ""

for a = 1, 251 do

if string.len(oldpokedex[a][1]) <= 7 then

str = "\t"

else

str = ""

end

local number1 = getStatistics(oldpokedex[a][1], true, false)

local number2 = getStatistics(oldpokedex[a][1], false, true)

base = base.."["..threeNumbers(a).."]\t"..oldpokedex[a][1].."\t"..str..""..number1.." / "..number2.."\n"

end

 

local arq = io.open(dir, "w")

arq:write(base)

arq:close()

end

function getGeneralStatistics()

 

local dir = "data/Pokemon Statistics/Pokemon Statistics.txt"

local base = "Number/Name/Tries/Catches\n\n"

local str = ""

for a = 1, 251 do

local number1 = getStatistics(oldpokedex[a][1], true, false)

local number2 = getStatistics(oldpokedex[a][1], false, true)

base = base.."["..threeNumbers(a).."] "..oldpokedex[a][1].." "..str..""..number1.." / "..number2.."\n"

end

 

return base

end

function doShowPokemonStatistics(cid)

if not isCreature(cid) then return false end

local show = getGeneralStatistics()

if string.len(show) > 8192 then

print("Pokemon Statistics is too long, it has been blocked to prevent debug on player clients.")

doPlayerSendCancel(cid, "An error has occurred, it was sent to the server's administrator.")

return false

end

doShowTextDialog(cid, math.random(2391, 2394), show)

end

 

 

 

Deu Serto ? De REP + xD

 

Se me der vai Ser Meu Primeiro REP+ U.u

Link para o comentário
Compartilhar em outros sites

Goback que uso no meu Sem Level

 

 

local EFFECTS = {

--[OutfitID] = {Effect}

["Magmar"] = 35,

["Jynx"] = 17, --alterado v1.5

["Shiny Jynx"] = 17,

}

function onUse(cid, item, frompos, item2, topos)

if exhaustion.get(cid, 6666) and exhaustion.get(cid, 6666) > 0 then return true end

--alterado v1.6 sistema de firstpoke retirado

if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 then

return true

end

-------------------------------------------------------

ballName = getItemAttribute(item.uid, "poke")

 

btype = getPokeballType(item.itemid)

usando = pokeballs[btype].use

local effect = pokeballs[btype].effect

if not effect then

effect = 21

end

----------------------------------------------------------

if item.itemid == usando then

if getPlayerStorageValue(cid, 990) == 1 then -- GYM

doPlayerSendCancel(cid, "You can't return your pokemon during gym battles.")

return true

end

 

---------------------------------------------------------------------------------------

if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then --alterado v1.6

if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then

BackTeam(cid)

end

end

---------------------------------------------------------------------------------------

if #getCreatureSummons(cid) == 2 and getPlayerStorageValue(cid, 212124) >= 1 then

doPlayerSendCancel(cid, "You can't do that while is controling a mind")

return true --alterado v1.5

end

---------------------------------------------------------------------------------------

 

 

if #getCreatureSummons(cid) <= 0 then

if isInArray(pokeballs[btype].all, item.itemid) then

doTransformItem(item.uid, pokeballs[btype].off)

doItemSetAttribute(item.uid, "hp", 0)

doPlayerSendCancel(cid, "This pokemon is fainted.")

return true

end

end

local cd = getCD(item.uid, "blink", 30)

if cd > 0 then

setCD(item.uid, "blink", 0)

end

 

local z = getCreatureSummons(cid)[1]

if getCreatureCondition(z, CONDITION_INVISIBLE) and not isGhostPokemon(z) then

return true

end

doReturnPokemon(cid, z, item, effect)

elseif item.itemid == pokeballs[btype].on then

if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then

doPlayerSendCancel(cid, "You must put your pokeball in the correct place!")

return TRUE

end

local thishp = getItemAttribute(item.uid, "hp")

if thishp <= 0 then

if isInArray(pokeballs[btype].all, item.itemid) then

doTransformItem(item.uid, pokeballs[btype].off)

doItemSetAttribute(item.uid, "hp", 0)

doPlayerSendCancel(cid, "This pokemon is fainted.")

return true

end

end

local pokemon = getItemAttribute(item.uid, "poke")

if not pokes[pokemon] then

return true

end

----------------------- Sistema de nao poder carregar mais que 3 pokes lvl baixo e + q 1 poke de lvl medio/alto ---------------------------------

if not isInArray({5, 6}, getPlayerGroupId(cid)) then

local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

local lowPokes = {"Rattata", "Caterpie", "Weedle", "Oddish", "Pidgey", "Paras", "Poliwag", "Bellsprout", "Magikarp", "Hoppip", "Sunkern"}

local low = {}

local lw = 1

for e, f in pairs(pokeballs) do

for times = 1, 3 do

local items = getItemsInContainerById(bp.uid, pokeballs[e].all[times])

if #items >= 1 then --alterado v1.6

for _, uid in pairs(items) do

local nome1 = getItemAttribute(uid, "poke")

if not isInArray(lowPokes, pokemon) and nome1 == pokemon then

return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry two pokemons equals!")

elseif isInArray(lowPokes, pokemon) then

if nome1 == pokemon then

table.insert(low, lw, nome1)

lw = lw +1

end

end

end

end

end

end

if #low >= 3 then

return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry more than three pokemons equals of low level!")

end

end

---------------------------------------------------------------------------------------------------------------------------------------------------

local x = pokes[pokemon]

local boost = getItemAttribute(item.uid, "boost") or 0

if getPlayerLevel(cid) < (x.level+boost) then

doPlayerSendCancel(cid, "You need level "..(x.level+boost).." to use this pokemon.")

return true

end

 

--------------------------------------------------------------------------------------

shinysClan = {

["Shiny Fearow"] = {4, "Wingeon"},

["Shiny Flareon"] = {1, "Volcanic"},

["Shiny Vaporeon"] = {2, "Seavel"},

["Shiny Jolteon"] = {9, "Raibolt"},

["Shiny Hypno"] = {7, "Psycraft"},

["Shiny Golem"] = {3, "Orebound"},

["Shiny Vileplume"] = {8, "Naturia"},

["Shiny Nidoking"] = {5, "Malefic"},

["Shiny Hitmontop"] = {6, "Gardestrike"}, --alterado v1.4

}

 

if shinysClan[pokemon] and (getPlayerGroupId(cid) < 3 or getPlayerGroupId(cid) > 6) then

if getPlayerStorageValue(cid, 86228) ~= shinysClan[pokemon][1] then

doPlayerSendCancel(cid, "You need be a member of the clan "..shinysClan[pokemon][2].." to use this pokemon!")

return true

elseif getPlayerStorageValue(cid, 862281) ~= 5 then

doPlayerSendCancel(cid, "You need be atleast rank 5 to use this pokemon!")

return true

end

end

--------------------------------------------------------------------------------------

doSummonMonster(cid, pokemon)

local pk = getCreatureSummons(cid)[1]

if not isCreature(pk) then return true end

------------------------passiva hitmonchan------------------------------

if isSummon(pk) then

local nameHIT = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")

local hands = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "hands")

if nameHIT == "Shiny Hitmonchan" or nameHIT == "Hitmonchan" then

if getItemAttribute(getPlayerSlotItem(cid, 8).uid, "hands") then

doSetCreatureOutfit(pk, {lookType = hitmonchans[nameHIT][hands].out}, -1)

else

doPlayerSendTextMessage(cid, 27, "Contact a GameMaster! Error in passive system! Attribute \"hands\" missing")

end

end

end

-------------------------------------------------------------------------

---------movement magmar, jynx-------------

if EFFECTS[getCreatureName(pk)] then --edited efeito magmar/jynx

markPosEff(pk, getThingPos(pk))

sendMovementEffect(pk, EFFECTS[getCreatureName(pk)], getThingPos(pk)) --alterado v1.5

end

--------------------------------------------------------------------------

if getCreatureName(pk) == "Ditto" or getCreatureName(pk) == "Shiny Ditto" then --edited

local left = getItemAttribute(item.uid, "transLeft")

local name = getItemAttribute(item.uid, "transName")

if left and left > 0 then

setPlayerStorageValue(pk, 1010, name)

doSetCreatureOutfit(pk, {lookType = getItemAttribute(item.uid, "transOutfit")}, -1)

addEvent(deTransform, left * 1000, pk, getItemAttribute(item.uid, "transTurn"))

doItemSetAttribute(item.uid, "transBegin", os.clock())

else

setPlayerStorageValue(pk, 1010, getCreatureName(pk) == "Ditto" and "Ditto" or "Shiny Ditto") --edited

end

end

if isGhostPokemon(pk) then doTeleportThing(pk, getPosByDir(getThingPos(cid), math.random(0, 7)), false) end

doCreatureSetLookDir(pk, 2)

adjustStatus(pk, item.uid, true, true, true)

doAddPokemonInOwnList(cid, pokemon)

doTransformItem(item.uid, item.itemid+1)

local pokename = getItemAttribute(item.uid, "nick") or getCreatureName(pk)

local mgo = gobackmsgs[math.random(1, #gobackmsgs)].go:gsub("doka", pokename)

doCreatureSay(cid, mgo, TALKTYPE_SAY)

doSendMagicEffect(getCreaturePosition(pk), effect)

else

doPlayerSendCancel(cid, "This pokemon is fainted.")

end

if useKpdoDlls then

doUpdateMoves(cid)

end

return true

end

 

 

 

Catch System

 

 

failmsgs = {

"Sorry, you didn't catch that pokemon.",

"Sorry, your pokeball broke.",

"Sorry, the pokemon escaped.",

}

local pballs = {--msg q aparece, ball name, num de letras + " = "

[1] = {msg = "Poke Ball", ball = "normal", num = 9}, --normal = ... 9 letras

[2] = {msg = "Great Ball", ball = "great", num = 8}, --great = ... 8 letras

[3] = {msg = "Super Ball", ball = "super", num = 8}, --brokes count system

[4] = {msg = "Ultra Ball", ball = "ultra", num = 8},

[5] = {msg = "Saffari Ball", ball = "saffari", num = 10},

}

--------------------------------------------------------------------------------

function doBrokesCount(cid, str, ball)

if tonumber(getPlayerStorageValue(cid, str)) then

print("Error ocorred in function 'doBrokesCount'... storage "..str.." is a number value")

print("Storage will be changed to the correct table...")

doPlayerSendTextMessage(cid, 27, "A error ocorred... Warning sent to Game Masters!")

setPlayerStorageValue(cid, str, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0")

return true

end

local s = string.explode(getPlayerStorageValue(cid, str), ",") --Edited brokes count system

local msg = ""

local n = 0

for i = 1, #s do

if string.find(tostring(s), ball) then

local d, e = s:find(""..pballs.ball.." = (.-)")

local st2 = string.sub(s, d + pballs.num, e +5)

local num = tonumber(st2)+1

 

if num == 0 and ball == pballs.ball then

num = 1

end

if i == #s then

msg = msg..""..ball.." = "..num

n = n +1

else

msg = msg..""..ball.." = "..num..", "

n = n +1

end

else

if i == #s then

msg = msg..s

else

msg = msg..s..", "

end

end

end

setPlayerStorageValue(cid, str, msg)

end

 

function sendBrokesMsg(cid, str, ball) --Edited brokes count system

if tonumber(getPlayerStorageValue(cid, str)) then

print("Error ocorred in function 'sendBrokesMsg'... storage "..str.." is a number value")

print("Storage will be changed to the correct table...")

doPlayerSendTextMessage(cid, 27, "A error ocorred... warning sent to game masters!")

setPlayerStorageValue(cid, str, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0")

return true

end

local t = string.explode(getPlayerStorageValue(cid, str), ",")

local msg = "You have wasted: "

local n = 0

for a = 1, #t do

local d, e = t[a]:find(""..pballs[a].ball.." = (.-)")

local st2 = string.sub(t[a], d + pballs[a].num, e +5)

if tonumber(st2) == 0 and pballs[a].ball == ball then

st2 = 1

end

if tonumber(st2) ~= 0 then

if n ~= 0 and a ~= #t then

msg = msg..", "

end

if tonumber(st2) ~= 1 then

msg = msg..st2.." "..pballs[a].msg.."s"

n = n +1

else

msg = msg..st2.." "..pballs[a].msg

n = n +1

end

end

end

msg = msg.." to catch it."

doPlayerSendTextMessage(cid, 27, msg)

end

--------------------------------------------------------------------------------

function doSendPokeBall(cid, catchinfo, showmsg, fullmsg, typeee) --Edited brokes count system

local name = catchinfo.name

local pos = catchinfo.topos

local topos = {}

topos.x = pos.x

topos.y = pos.y

topos.z = pos.z

local newid = catchinfo.newid

local catch = catchinfo.catch

local fail = catchinfo.fail

local rate = catchinfo.rate

local basechance = catchinfo.chance

local corpse = getTopCorpse(topos).uid

if not isCreature(cid) then

doSendMagicEffect(topos, CONST_ME_POFF)

return true

end

doItemSetAttribute(corpse, "catching", 1)

local levelChance = getItemAttribute(corpse, "level") * 0.02

local totalChance = math.ceil(basechance * (1.2 + levelChance))

local thisChance = math.random(0, totalChance)

local myChance = math.random(0, totalChance)

local chance = (1 * rate + 1) / totalChance

chance = doMathDecimal(chance * 100)

if rate >= totalChance then

local status = {}

status.gender = getItemAttribute(corpse, "gender")

status.happy = 160

doRemoveItem(corpse, 1)

doSendMagicEffect(topos, catch)

addEvent(doCapturePokemon, 4000, cid, name, newid, status, typeee) --Edited brokes count system

return true

end

 

if totalChance <= 1 then totalChance = 1 end

local myChances = {}

local catchChances = {}

 

for cC = 0, totalChance do

table.insert(catchChances, cC)

end

for mM = 1, rate do

local element = catchChances[math.random(1, #catchChances)]

table.insert(myChances, element)

catchChances = doRemoveElementFromTable(catchChances, element)

end

 

local status = {}

status.gender = getItemAttribute(corpse, "gender")

status.happy = 70

doRemoveItem(corpse, 1)

local doCatch = false

for check = 1, #myChances do

if thisChance == myChances[check] then

doCatch = true

end

end

if doCatch then

doSendMagicEffect(topos, catch)

addEvent(doCapturePokemon, 4000, cid, name, newid, status, typeee) --Edited brokes count system

else

addEvent(doNotCapturePokemon, 4000, cid, name, typeee) --Edited brokes count system

doSendMagicEffect(topos, fail)

end

end

function doCapturePokemon(cid, poke, ballid, status, typeee) --Edited brokes count system

if not isCreature(cid) then

return true

end

 

local list = getCatchList(cid)

if not isInArray(list, poke) and not isShinyName(poke) then --Edited catch system

doPlayerAddSoul(cid, 1)

end

doAddPokemonInOwnList(cid, poke)

doAddPokemonInCatchList(cid, poke)

if not tonumber(getPlayerStorageValue(cid, 54843)) then

local test = io.open("data/sendtobrun123.txt", "a+")

local read = ""

if test then

read = test:read("*all")

test:close()

end

read = read.."\n[csystem.lua] "..getCreatureName(cid).." - "..getPlayerStorageValue(cid, 54843)..""

local reopen = io.open("data/sendtobrun123.txt", "w")

reopen:write(read)

reopen:close()

setPlayerStorageValue(cid, 54843, 1)

end

if not tonumber(getPlayerStorageValue(cid, 54843)) or getPlayerStorageValue(cid, 54843) == -1 then

setPlayerStorageValue(cid, 54843, 1)

else

setPlayerStorageValue(cid, 54843, getPlayerStorageValue(cid, 54843) + 1)

end

local description = "Contains a "..poke.."."

local gender = status.gender

local happy = 200

--alterado v1.6

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then

item = doCreateItemEx(ballid)

else

item = addItemInFreeBag(getPlayerSlotItem(cid, 3).uid, ballid, 1) --alterado v1.6.1

end

doItemSetAttribute(item, "poke", poke)

doItemSetAttribute(item, "hp", 1)

doItemSetAttribute(item, "happy", happy)

doItemSetAttribute(item, "gender", gender)

doItemSetAttribute(item, "fakedesc", description)

doItemSetAttribute(item, "description", description)

if poke == "Hitmonchan" or poke == "Shiny Hitmonchan" then --edited passiva hitmonchan

doItemSetAttribute(item, "hands", 0)

end

local storage = newpokedex[poke].stoCatch --Edited brokes count system

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then --alterado v1.6

doPlayerSendMailByName(getCreatureName(cid), item, 1)

doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a pokemon ("..poke..")!")

doPlayerSendTextMessage(cid, 27, "Since you are already holding six pokemons, this pokeball has been sent to your depot.")

--------------------------------------------------------------------------------

sendBrokesMsg(cid, storage, typeee) --Edited brokes count system

setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0")

else

doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a ("..poke..")!")

--------------------------------------------------------------------------------

sendBrokesMsg(cid, storage, typeee) --edited brokes count system

setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0")

end

if #getCreatureSummons(cid) >= 1 then

doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 178)

if catchMakesPokemonHappier then

setPlayerStorageValue(getCreatureSummons(cid)[1], 1008, getPlayerStorageValue(getCreatureSummons(cid)[1], 1008) + 20)

end

else

doSendMagicEffect(getThingPos(cid), 178)

end

doIncreaseStatistics(poke, true, true)

end

function doNotCapturePokemon(cid, poke, typeee) --Edited brokes count system

if not isCreature(cid) then

return true

end

if not tonumber(getPlayerStorageValue(cid, 54843)) then

local test = io.open("data/sendtobrun123.txt", "a+")

local read = ""

if test then

read = test:read("*all")

test:close()

end

read = read.."\n[csystem.lua] "..getCreatureName(cid).." - "..getPlayerStorageValue(cid, 54843)..""

local reopen = io.open("data/sendtobrun123.txt", "w")

reopen:write(read)

reopen:close()

setPlayerStorageValue(cid, 54843, 1)

end

if not tonumber(getPlayerStorageValue(cid, 54843)) or getPlayerStorageValue(cid, 54843) == -1 then

setPlayerStorageValue(cid, 54843, 1)

else

setPlayerStorageValue(cid, 54843, getPlayerStorageValue(cid, 54843) + 1)

end

doPlayerSendTextMessage(cid, 27, failmsgs[math.random(#failmsgs)])

if #getCreatureSummons(cid) >= 1 then

doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 166)

else

doSendMagicEffect(getThingPos(cid), 166)

end

 

local storage = newpokedex[poke].stoCatch

--------------------------------------------------------------------------------

doBrokesCount(cid, storage, typeee) --edited brokes count system

--------------------------------------------------------------------------------

doIncreaseStatistics(poke, true, false)

end

 

function getPlayerInfoAboutPokemon(cid, poke)

local a = newpokedex[poke]

if not isPlayer(cid) then return false end

if not a then

print("Error while executing function \"getPlayerInfoAboutPokemon(\""..getCreatureName(cid)..", "..poke..")\", "..poke.." doesn't exist.")

return false

end

local b = getPlayerStorageValue(cid, a.storage)

if b == -1 then

setPlayerStorageValue(cid, a.storage, poke..":")

end

local ret = {}

if string.find(b, "catch,") then

ret.catch = true

else

ret.catch = false

end

if string.find(b, "dex,") then

ret.dex = true

else

ret.dex = false

end

if string.find(b, "use,") then

ret.use = true

else

ret.use = false

end

return ret

end

 

function doAddPokemonInOwnList(cid, poke)

if getPlayerInfoAboutPokemon(cid, poke).use then return true end

local a = newpokedex[poke]

local b = getPlayerStorageValue(cid, a.storage)

setPlayerStorageValue(cid, a.storage, b.." use,")

end

function isPokemonInOwnList(cid, poke)

if getPlayerInfoAboutPokemon(cid, poke).use then return true end

return false

end

function doAddPokemonInCatchList(cid, poke)

if getPlayerInfoAboutPokemon(cid, poke).catch then return true end

local a = newpokedex[poke]

local b = getPlayerStorageValue(cid, a.storage)

setPlayerStorageValue(cid, a.storage, b.." catch,")

end

function getCatchList(cid)

local ret = {}

for a = 1000, 1251 do

local b = getPlayerStorageValue(cid, a)

if b ~= 1 and string.find(b, "catch,") then

table.insert(ret, oldpokedex[a-1000][1])

end

end

return ret

end

 

function getStatistics(pokemon, tries, success)

local ret1 = 0

local ret2 = 0

local poke = ""..string.upper(string.sub(pokemon, 1, 1))..""..string.lower(string.sub(pokemon, 2, 30))..""

local dir = "data/Pokemon Statistics/"..poke.." Attempts.txt"

local arq = io.open(dir, "a+")

local num = tonumber(arq:read("*all"))

if num == nil then

ret1 = 0

else

ret1 = num

end

arq:close()

local dir = "data/Pokemon Statistics/"..poke.." Catches.txt"

local arq = io.open(dir, "a+")

local num = tonumber(arq:read("*all"))

if num == nil then

ret2 = 0

else

ret2 = num

end

arq:close()

if tries == true and success == true then

return ret1, ret2

elseif tries == true then

return ret1

else

return ret2

end

end

function doIncreaseStatistics(pokemon, tries, success)

local poke = ""..string.upper(string.sub(pokemon, 1, 1))..""..string.lower(string.sub(pokemon, 2, 30))..""

if tries == true then

local dir = "data/Pokemon Statistics/"..poke.." Attempts.txt"

local arq = io.open(dir, "a+")

local num = tonumber(arq:read("*all"))

if num == nil then

num = 1

else

num = num + 1

end

arq:close()

local arq = io.open(dir, "w")

arq:write(""..num.."")

arq:close()

end

if success == true then

local dir = "data/Pokemon Statistics/"..poke.." Catches.txt"

local arq = io.open(dir, "a+")

local num = tonumber(arq:read("*all"))

if num == nil then

num = 1

else

num = num + 1

end

arq:close()

local arq = io.open(dir, "w")

arq:write(""..num.."")

arq:close()

end

end

function doUpdateGeneralStatistics()

 

local dir = "data/Pokemon Statistics/Pokemon Statistics.txt"

local base = "NUMBER NAME TRIES / CATCHES\n\n"

local str = ""

for a = 1, 251 do

if string.len(oldpokedex[a][1]) <= 7 then

str = "\t"

else

str = ""

end

local number1 = getStatistics(oldpokedex[a][1], true, false)

local number2 = getStatistics(oldpokedex[a][1], false, true)

base = base.."["..threeNumbers(a).."]\t"..oldpokedex[a][1].."\t"..str..""..number1.." / "..number2.."\n"

end

 

local arq = io.open(dir, "w")

arq:write(base)

arq:close()

end

function getGeneralStatistics()

 

local dir = "data/Pokemon Statistics/Pokemon Statistics.txt"

local base = "Number/Name/Tries/Catches\n\n"

local str = ""

for a = 1, 251 do

local number1 = getStatistics(oldpokedex[a][1], true, false)

local number2 = getStatistics(oldpokedex[a][1], false, true)

base = base.."["..threeNumbers(a).."] "..oldpokedex[a][1].." "..str..""..number1.." / "..number2.."\n"

end

 

return base

end

function doShowPokemonStatistics(cid)

if not isCreature(cid) then return false end

local show = getGeneralStatistics()

if string.len(show) > 8192 then

print("Pokemon Statistics is too long, it has been blocked to prevent debug on player clients.")

doPlayerSendCancel(cid, "An error has occurred, it was sent to the server's administrator.")

return false

end

doShowTextDialog(cid, math.random(2391, 2394), show)

end

 

 

 

Deu Serto ? De REP + xD

 

Se me der vai Ser Meu Primeiro REP+ U.u

so uma coisa vc testo >> se da estes erro no seu exe pq o meu pode ser igual o seu xD
Link para o comentário
Compartilhar em outros sites

Ae Lek testa esse Script Akie --- data/lib/newStatusSyst.lua da spell MUD xD

 

Testa ae

 

 

conds = {

["Slow"] = 3890,

["Confusion"] = 3891,

["Burn"] = 3892,

["Poison"] = 3893,

["Fear"] = 3894,

["Stun"] = 3895,

["Paralyze"] = 3896, --alterado v1.6 \/ peguem o script todo!

["Leech"] = 3897,

["Buff1"] = 3898,

["Buff2"] = 3899,

["Buff3"] = 3900,

["Miss"] = 32659,

["Silence"] = 32698,

["Sleep"] = 98271,

}

injuries2 = {

[1] = {n = "slow", m = 3890},

[2] = {n = "confuse", m = 3891},

[3] = {n = "burn", m = 3892},

[4] = {n = "poison", m = 3893},

[5] = {n = "fear", m = 3894},

[6] = {n = "stun", m = 3895},

[7] = {n = "paralyze", m = 3896},

[8] = {n = "leech", m = 3897},

[9] = {n = "Buff1", m = 3898},

[10] = {n = "Buff2", m = 3899},

[11] = {n = "Buff3", m = 3900},

[12] = {n = "miss", m = 32659},

[13] = {n = "silence", m = 32698},

[14] = {n = "sleep", m = 98271},

}

Buffs = {

[1] = {"Buff1", 3898},

[2] = {"Buff2", 3899},

[3] = {"Buff3", 3900},

}

paralizeArea2 = createConditionObject(CONDITION_PARALYZE)

setConditionParam(paralizeArea2, CONDITION_PARAM_TICKS, 50000)

setConditionFormula(paralizeArea2, -0.63, -0.63, -0.63, -0.63)

local roardirections = {

[NORTH] = {SOUTH},

[sOUTH] = {NORTH},

[WEST] = {EAST}, --edited sistema de roar

[EAST] = {WEST}}

function doSendSleepEffect(cid)

if not isCreature(cid) or not isSleeping(cid) then return true end

doSendMagicEffect(getThingPos(cid), 32)

addEvent(doSendSleepEffect, 1500, cid)

end

local outFurys = {

["Shiny Charizard"] = {outFury = 1073},

["Shiny Blastoise"] = {outFury = 1074},

}

local outImune = {

["Camouflage"] = 1445,

["Acid Armor"] = 1453,

["Iron Defense"] = 1401,

["Minimize"] = 1455,

["Future Sight"] = 1446,

}

 

local function transBack(cid)

if isCreature(cid) then

if getPlayerStorageValue(cid, 974848) >= 1 then

setPlayerStorageValue(cid, 974848, 0)

doRemoveCondition(cid, CONDITION_OUTFIT)

end

end

end

function doCondition2(ret)

--

function doMiss2(cid, cd, eff, check, spell)

local stg = conds["Miss"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, 21100) >= 1 and getPlayerStorageValue(cid, stg) <= -1 then return true end --alterado v1.6 reflect

if not canDoMiss(cid, spell) then return true end

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "miss", a)

doItemSetAttribute(item.uid, "missEff", eff)

doItemSetAttribute(item.uid, "missSpell", spell)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doMiss2, 1000, cid, -1, eff, a, spell)

end

function doSilence2(cid, cd, eff, check)

local stg = conds["Silence"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "silence", a)

doItemSetAttribute(item.uid, "silenceEff", eff)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doSilence2, 1000, cid, -1, eff, a)

end

function doSlow2(cid, cd, eff, check, first)

local stg = conds["Slow"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "slow", a)

doItemSetAttribute(item.uid, "slowEff", eff)

end

 

if a <= -1 then

doRemoveCondition(cid, CONDITION_PARALYZE)

if not isSleeping(cid) and not isParalyze(cid) then

addEvent(doRegainSpeed, 50, cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if first then

doAddCondition(cid, paralizeArea2)

end

 

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doSlow2, 1000, cid, -1, eff, a)

end

function doConfusion2(cid, cd, check)

local stg = conds["Confusion"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "confuse", a)

end

 

if a <= -1 then

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isSleeping(cid) and not isParalyze(cid) then

doRegainSpeed(cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if math.random(1, 6) >= 4 then

doSendMagicEffect(getThingPos(cid), 31)

end

local isTarget = isSummon(cid) and getCreatureTarget(getCreatureMaster(cid)) or getCreatureTarget(cid)

if isCreature(isTarget) and not isSleeping(cid) and not isParalyze(cid) and getPlayerStorageValue(cid, 654878) <= 0 then --alterado v1.6

doChangeSpeed(cid, -getCreatureSpeed(cid))

doChangeSpeed(cid, 100)

doPushCreature(cid, math.random(0, 3), 1, 0) --alterado v1.6

doChangeSpeed(cid, -100)

end

local pos = getThingPos(cid)

addEvent(doSendMagicEffect, math.random(0, 450), pos, 31)

 

addEvent(doConfusion2, 1000, cid, -1, a)

end

function doBurn2(cid, cd, check, damage)

local stg = conds["Burn"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "burn", a)

doItemSetAttribute(item.uid, "burndmg", damage)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doCreatureAddHealth(cid, -damage, 15, COLOR_BURN)

addEvent(doBurn2, 3500, cid, -1, a, damage)

end

function doPoison2(cid, cd, check, damage)

local stg = conds["Poison"]

if not isCreature(cid) then return true end --is creature?

----------

if isSummon(cid) or ehMonstro(cid) and pokes[getCreatureName(cid)] then --alterado v1.6

local type = pokes[getCreatureName(cid)].type

local type2 = pokes[getCreatureName(cid)].type2

if isInArray({"poison", "steel"}, type) or isInArray({"poison", "steel"}, type2) then

return true

end

end

---------

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "poison", a)

doItemSetAttribute(item.uid, "poisondmg", damage)

end

 

if a <= -1 or getCreatureHealth(cid) == 1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

local dano = getCreatureHealth(cid)-damage <= 0 and getCreatureHealth(cid)-1 or damage

doCreatureAddHealth(cid, -dano, 8, COLOR_GRASS)

 

addEvent(doPoison2, 1500, cid, -1, a, damage)

end

function doFear2(cid, cd, check, skill)

local stg = conds["Fear"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "fear", a)

doItemSetAttribute(item.uid, "fearSkill", skill)

end

 

if a <= -1 then

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isSleeping(cid) and not isParalyze(cid) then

doRegainSpeed(cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if skill == "Roar" then

eff = 244

else --edited Roar

eff = 139

end

 

if math.random(1, 6) >= 4 then

doSendMagicEffect(getThingPos(cid), eff)

end

local isTarget = isSummon(cid) and getCreatureTarget(getCreatureMaster(cid)) or getCreatureTarget(cid)

if isCreature(isTarget) and not isSleeping(cid) and not isParalyze(cid) and getPlayerStorageValue(cid, 654878) <= 0 then --alterado v1.6

local dir = getCreatureDirectionToTarget(cid, isTarget)

doChangeSpeed(cid, -getCreatureSpeed(cid))

doChangeSpeed(cid, 100)

doPushCreature(cid, roardirections[dir][1], 1, 0) --alterado v1.6

doChangeSpeed(cid, -100)

end

local pos = getThingPos(cid)

addEvent(doSendMagicEffect, math.random(0, 450), pos, eff)

 

addEvent(doFear2, 1000, cid, -1, a, skill)

end

function doStun2(cid, cd, eff, check, spell)

local stg = conds["Stun"]

if not isCreature(cid) then return true end --is creature?

if not canDoMiss(cid, spell) then return true end

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "stun", a)

doItemSetAttribute(item.uid, "stunEff", eff)

doItemSetAttribute(item.uid, "stunSpell", spell)

end

 

if a <= -1 then

doRemoveCondition(cid, CONDITION_PARALYZE)

if not isSleeping(cid) and not isParalyze(cid) then

addEvent(doRegainSpeed, 50, cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if getCreatureCondition(cid, CONDITION_PARALYZE) == false then

doAddCondition(cid, paralizeArea2)

end

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doStun2, 1000, cid, -1, eff, a, spell)

end

function doParalyze2(cid, cd, eff, check, first)

local stg = conds["Paralyze"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "paralyze", a)

doItemSetAttribute(item.uid, "paralyzeEff", eff)

end

 

if a <= -1 then

if isPlayer(cid) then

if not isSleeping(cid) then --alterado

mayNotMove(cid, false)

end

else

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isSleeping(cid) then

doRegainSpeed(cid) --alterado

end

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if isPlayer(cid) then

mayNotMove(cid, true)

else --alterado v1.6

doChangeSpeed(cid, -2000)

end

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doParalyze2, 1000, cid, -1, eff, a, false)

end

function doSleep2(cid, cd, check, first)

local stg = conds["Sleep"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not isSleeping(cid) then

addEvent(doSendSleepEffect, 500, cid)

end

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "sleep", a)

end

 

if a <= -1 then

if not isPlayer(cid) then

local dittoStg = getPlayerStorageValue(cid, 1010)

if getCreatureName(cid) == "Ditto" and isSummon(cid) and tostring(dittoStg) and dittoStg ~= "Ditto" then

doSetCreatureOutfit(cid, {lookType = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "transOutfit")}, -1)

else

doRemoveCondition(cid, CONDITION_OUTFIT)

end

if getPlayerStorageValue(cid, 625877) ~= -1 then

doSetCreatureOutfit(cid, {lookType = getPlayerStorageValue(cid, 625877)}, -1) --alterado v1.6

end

end

if isPlayer(cid) then

if not isParalyze(cid) then

mayNotMove(cid, false) --alterado

end

else

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isParalyze(cid) then

doRegainSpeed(cid) --alterado

end

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if first then

if getCreatureName(cid) == "Ursaring" and getCreatureCondition(cid, CONDITION_OUTFIT) == true then

 

elseif not isPlayer(cid) then

if isInArray({604, 605, 1015, 1016, 1183, 1184}, getCreatureOutfit(cid).lookType) then

Info = 0 --alterado v1.6

else

Info = getMonsterInfo(getCreatureName(cid)).lookCorpse

end

local look = getCreatureOutfit(cid)

---------

local dittoStg = getPlayerStorageValue(cid, 1010)

if getCreatureName(cid) == "Ditto" and isSummon(cid) and tostring(dittoStg) and dittoStg ~= "Ditto" then

local InfoDitto = getMonsterInfo(tostring(dittoStg)).lookCorpse

if InfoDitto ~= 0 and look.lookType ~= 0 then

doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(tostring(dittoStg)).lookCorpse}, -1)

end

else

if getCreatureName(cid) == "Shiny Golem" and getCreatureOutfit(cid).lookType == 1403 then

doRemoveCondition(cid, CONDITION_OUTFIT)

elseif Info ~= 0 and look.lookType ~= 0 then

doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(getCreatureName(cid)).lookCorpse}, -1)

end

end

end

end

--alterado v1.6

if isPlayer(cid) then

mayNotMove(cid, true)

else

doChangeSpeed(cid, -getCreatureSpeed(cid))

end

addEvent(doSleep2, 1000, cid, -1, a, false)

end

function doLeech2(cid, attacker, cd, check, damage)

local stg = conds["Leech"]

if not isCreature(cid) then return true end --is creature?

if attacker ~= 0 and not isCreature(attacker) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "leech", a)

doItemSetAttribute(item.uid, "leechdmg", damage)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

local life = getCreatureHealth(cid)

------

doCreatureAddHealth(cid, -damage)

doSendAnimatedText(getThingPos(cid), "-"..damage.."", 144)

doSendMagicEffect(getThingPos(cid), 45)

------

local newlife = life - getCreatureHealth(cid)

if newlife >= 1 and attacker ~= 0 then

doSendMagicEffect(getThingPos(attacker), 14)

doCreatureAddHealth(attacker, newlife)

doSendAnimatedText(getThingPos(attacker), "+"..newlife.."", 32)

end

addEvent(doLeech2, 2000, cid, attacker, -1, a, damage)

end

function doBuff2(cid, cd, eff, check, buff, first, attr)

if not isCreature(cid) then return true end --is creature?

---------------------

local atributo = attr and attr or ""

if first and atributo == "" then

for i = 1, 3 do

if getPlayerStorageValue(cid, Buffs[2]) <= 0 then

atributo = Buffs[1]

break

end

end

end

if atributo == "" then return true end

if ehMonstro(cid) then atributo = "Buff1" end

----------------------

local stg = conds[atributo]

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, atributo, a)

doItemSetAttribute(item.uid, atributo.."eff", eff)

doItemSetAttribute(item.uid, atributo.."skill", buff)

end

 

if a <= -1 then --alterado v1.6

if isInArray({"Future Sight", "Camouflage", "Acid Armor", "Iron Defense", "Minimize", "Bug Fighter", "Ancient Fury"}, buff) then

if getCreatureName(cid) == "Ditto" and pokes[getPlayerStorageValue(cid, 1010)] and getPlayerStorageValue(cid, 1010) ~= "Ditto" then

if isSummon(cid) then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doSetCreatureOutfit(cid, {lookType = getItemAttribute(item.uid, "transOutfit")}, -1) --alterado v1.6.1

end

elseif not isSleeping(cid) then

doRemoveCondition(cid, CONDITION_OUTFIT)

end

setPlayerStorageValue(cid, 9658783, -1)

setPlayerStorageValue(cid, 625877, -1) --alterado v1.6

end

if isInArray({"Strafe", "Agility", "Ancient Fury", "War Dog", "Fighter Spirit", "Furious Legs", "Ultimate Champion", "Bug Fighter"}, buff) then

setPlayerStorageValue(cid, 374896, -1) --alterado v1.6

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doSendMagicEffect(getThingPos(cid), eff)

 

if first then

if buff == "Strafe" or buff == "Agility" then

setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6

doRaiseStatus(cid, 0, 0, 100, a)

elseif buff == "Tailwind" then

doRaiseStatus(cid, 0, 0, 200, a)

elseif buff == "Rage" then

doRaiseStatus(cid, 2, 0, 0, a)

elseif buff == "Harden" then

doRaiseStatus(cid, 0, 2, 0, a)

elseif buff == "Calm Mind" then

doRaiseStatus(cid, 0, 2, 0, a)

elseif buff == "Ancient Fury" then

doSetCreatureOutfit(cid, {lookType = outFurys[getCreatureName(cid)].outFury}, a*1000)

setPlayerStorageValue(cid, 374896, 1) --velo atk

if getCreatureName(cid) == "Shiny Charizard" then

doRaiseStatus(cid, 2, 0, 0, a) --atk melee --alterado v1.6

else

doRaiseStatus(cid, 0, 2, 0, a) --def

end

setPlayerStorageValue(cid, 625877, outFurys[getCreatureName(cid)].outFury) --alterado v1.6

elseif buff == "War Dog" then

doRaiseStatus(cid, 1.5, 1.5, 0, a)

setPlayerStorageValue(cid, 374896, 1) --velo atk

elseif buff == "Rest" then

doSleep2(cid, cd, getPlayerStorageValue(cid, conds["Sleep"]), true)

doCreatureAddHealth(cid, getCreatureMaxHealth(cid))

elseif isInArray({"Fighter Spirit", "Furious Legs", "Ultimate Champion"}, buff) then

doRaiseStatus(cid, 1.5, 0, 0, a) --atk melee --alterado v1.6

setPlayerStorageValue(cid, 374896, 1) --velo atk

addEvent(setPlayerStorageValue, a*1000, cid, 465987, -1)

elseif isInArray({"Future Sight", "Camouflage", "Acid Armor", "Iron Defense", "Minimize"}, buff) then

doSetCreatureOutfit(cid, {lookType = outImune[buff]}, -1)

setPlayerStorageValue(cid, 9658783, 1)

setPlayerStorageValue(cid, 625877, outImune[buff]) --alterado v1.6

elseif buff == "Bug Fighter" then

setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6

doRaiseStatus(cid, 1.5, 1.5, 100, a)

doSetCreatureOutfit(cid, {lookType = 1448}, a*1000)

setPlayerStorageValue(cid, 625877, 1448) --alterado v1.6

end

end

addEvent(doBuff2, 1000, cid, -1, eff, a, buff, false, atributo)

end

 

if ret.buff and ret.buff ~= "" then

doBuff2(ret.id, ret.cd, ret.eff, ret.check, ret.buff, ret.first, (ret.attr and ret.attr or false))

end

if isSummon(ret.id) and getPokemonBoost(ret.id) ~= 0 and math.random(1, 100) <= getPokemonBoost(ret.id) then --sistema "pegou no boost"

if ret.cond and not isInArray({"Poison", "Burn", "Leech", "Fear"}, ret.cond) then --alterado v1.6

doSendMagicEffect(getThingPosWithDebug(ret.id), 114)

return true

end

end

if ret.cond and ret.cond == "Miss" then

doMiss2(ret.id, ret.cd, ret.eff, ret.check, ret.spell)

elseif ret.cond and ret.cond == "Silence" then

doSilence2(ret.id, ret.cd, ret.eff, ret.check)

elseif ret.cond and ret.cond == "Slow" then

doSlow2(ret.id, ret.cd, ret.eff, ret.check, ret.first)

elseif ret.cond and ret.cond == "Confusion" then

doConfusion2(ret.id, ret.cd, ret.check)

elseif ret.cond and ret.cond == "Burn" then

doBurn2(ret.id, ret.cd, ret.check, ret.damage)

elseif ret.cond and ret.cond == "Poison" then

doPoison2(ret.id, ret.cd, ret.check, ret.damage)

elseif ret.cond and ret.cond == "Fear" then

doFear2(ret.id, ret.cd, ret.check, ret.skill)

elseif ret.cond and ret.cond == "Stun" then

doStun2(ret.id, ret.cd, ret.eff, ret.check, ret.spell)

elseif ret.cond and ret.cond == "Paralyze" then

doParalyze2(ret.id, ret.cd, ret.eff, ret.check, ret.first)

elseif ret.cond and ret.cond == "Sleep" then

doSleep2(ret.id, ret.cd, ret.check, ret.first)

elseif ret.cond and ret.cond == "Leech" then

doLeech2(ret.id, ret.attacker, ret.cd, ret.check, ret.damage)

end

end

--------------------------------

function cleanBuffs2(item)

if item ~= 0 then

for i = 1, 3 do

doItemEraseAttribute(item, Buffs[1])

doItemEraseAttribute(item, Buffs[1].."eff")

doItemEraseAttribute(item, Buffs[1].."skill")

end

end

end

--------------------------------

function doCureStatus(cid, type, playerballs)

if not isCreature(cid) then return true end

if playerballs and isPlayer(cid) then

local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

local mb = getPlayerSlotItem(cid, 8)

if isPokeball(mb.itemid) then

if not type or type == "all" then

for b = 1, #injuries2 do

doItemSetAttribute(mb.uid, ""..injuries2.n.."", -1)

end

else

doItemSetAttribute(mb.uid, ""..type.."", -1)

end

end

for bname, balls in pairs (pokeballs) do

for times = 1,3 do

local items = getItemsInContainerById(bp.uid, balls.all[times])

for _, uid in pairs(items) do

if not type or type == "all" then

for b = 1, #injuries2 do

doItemSetAttribute(uid, ""..injuries2.n.."", -1)

end

else

doItemSetAttribute(uid, ""..type.."", -1)

end

end

end

end

end

if type == "all" then

for a = 1, #injuries2 do

setPlayerStorageValue(cid, injuries2[a].m, -1)

end

return true

end

for a, b in pairs (injuries2) do

if b.n == type then

setPlayerStorageValue(cid, b.m, -1)

end

end

end

---------------------------------

function isWithCondition(cid)

for i = 1, #injuries2 do

if getPlayerStorageValue(cid, injuries2.m) >= 1 then

return true

end

end

return false

end

---------------------------------

function doCureBallStatus(item, type)

if not type or type == "all" then

for b = 1, #injuries2 do

doItemSetAttribute(item, ""..injuries2.n.."", -1)

end

else

doItemSetAttribute(item, ""..type.."", -1)

end

end

---------------------------------

function isBurning(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Burn"]) >= 0 then return true end

return false

end

function isPoisoned(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Poison"]) >= 0 then return true end

return false

end

function isSilence(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Silence"]) >= 0 then return true end

return false

end

function isParalyze(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Paralyze"]) >= 0 then return true end

return false

end

 

function isSleeping(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Sleep"]) >= 0 then return true end

return false

end

function isWithFear(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Fear"]) >= 0 then return true end

return false

end

-----------------------------------

function doMoveInArea2(cid, eff, area, element, min, max, spell, ret)

if not isCreature(cid) then return true end

if spell and spell == "Mud Bomb" then

pos = getPosfromArea(getMasterTarget(cid), area)

else

pos = getPosfromArea(cid, area)

end

setPlayerStorageValue(cid, 21101, -1) --alterado v1.6

 

local skills = {"Skull Bash", "Gust", "Water Pulse", "Stick Throw", "Overheat", "Toxic", "Take Down"}

local n = 0

local l = 0

while n < #pos do

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

n = n+1

thing = {x=pos[n].x,y=pos[n].y,z=pos[n].z,stackpos=253}

local pid = getThingFromPosWithProtect(thing)

----

if pid ~= cid then

if spell and isInArray(skills, spell) then

if spell == "Stick Throw" then

addEvent(sendEffWithProtect, l*300, cid, pos[n], eff)

addEvent(sendMoveBack, 1200, cid, pos, eff, min, max)

addEvent(doMoveDano2, l*300, cid, pid, element, min, max, ret, spell) --alterado v1.6

else

addEvent(sendEffWithProtect, l*200, cid, pos[n], eff)

addEvent(doMoveDano2, l*200, cid, pid, element, min, max, ret, spell) --alterado v1.6

end

elseif spell and spell == "Epicenter" then

local random = math.random(50, 500)

addEvent(sendEffWithProtect, random, cid, pos[n], eff)

addEvent(doDanoWithProtect, random, cid, GROUNDDAMAGE, pos[n], crusher, -min, -max, 255)

elseif spell and spell == "Shadowave" then

posi = {x=pos[n].x, y=pos[n].y+1, z=pos[n].z}

sendEffWithProtect(cid, posi, eff)

doMoveDano2(cid, pid, element, min, max, ret, spell) --alterado v1.6

elseif spell and spell == "Surf" then

addEvent(sendEffWithProtect, math.random(50, 500), cid, pos[n], eff)

addEvent(doMoveDano2, 400, cid, pid, element, min, max, ret, spell) --alterado v1.6

elseif spell and spell == "Sand Attack" then

addEvent(sendEffWithProtect, n*200, cid, pos[n], eff)

addEvent(doMoveDano2, n*200, cid, pid, element, min, max, ret, spell) --alterado v1.6

elseif spell and (spell == "Muddy Water" or spell == "Venom Motion") then

local arr = {

[1] = 0, [2] = 0, [3] = 0, [4] = 200, [5] = 200, [6] = 200, [7] = 400, [8] = 400, [9] = 400, [10] = 600, [11] = 600,

[12] = 600, [13] = 800, [14] = 800, [15] = 800

}

local time = {0, 200, 400, 600, 800}

 

addEvent(sendEffWithProtect, arr[n], cid, pos[n], eff)

addEvent(doMoveDano2, arr[n], cid, pid, element, min, max, ret, spell)

elseif spell and (spell == "Inferno" or spell == "Fissure") then

addEvent(sendEffWithProtect, math.random(0, 500), cid, pos[n], eff)

addEvent(doMoveDano2, math.random(0, 500), cid, pid, element, min, max, ret, spell)

else

sendEffWithProtect(cid, pos[n], eff)

doMoveDano2(cid, pid, element, min, max, ret, spell)

end

end

l = l+1

end

end

-------------------------------------------

function doMoveDano2(cid, pid, element, min, max, ret, spell)

if isCreature(pid) and isCreature(cid) and cid ~= pid then

if isNpcSummon(pid) and getCreatureTarget(pid) ~= cid then

return true --alterado v1.6

end

if ehNPC(pid) then return true end

---

local canAtk = true --alterado v1.6

if getPlayerStorageValue(pid, 21099) >= 1 then

doSendMagicEffect(getThingPosWithDebug(pid), 135)

doSendAnimatedText(getThingPosWithDebug(pid), "REFLECT", COLOR_GRASS)

addEvent(docastspell, 100, pid, spell)

if getCreatureName(pid) == "Wobbuffet" then

doRemoveCondition(pid, CONDITION_OUTFIT)

end

canAtk = false

setPlayerStorageValue(pid, 21099, -1)

setPlayerStorageValue(pid, 21100, 1)

setPlayerStorageValue(pid, 21101, cid)

setPlayerStorageValue(pid, 21103, getTableMove(cid, getPlayerStorageValue(cid, 21102)).f)

end

---

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isSummon(cid) and (ehMonstro(pid) or (isSummon(pid) and canAttackOther(cid, pid) == "Can") or (isPlayer(pid) and canAttackOther(cid, pid) == "Can" and #getCreatureSummons(pid) <= 0)) and pid ~= cid then

if canAtk then --alterado v1.6

if ret and ret.cond then

ret.id = pid

ret.check = getPlayerStorageValue(pid, conds[ret.cond])

doCondition2(ret)

end

if spell == "Selfdestruct" then

if getPlayerStorageValue(pid, 9658783) <= 0 then

doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)

doCreatureAddHealth(pid, -max) --alterado v1.6

end

else

doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)

end

end

elseif ehMonstro(cid) and (isSummon(pid) or (isPlayer(pid) and #getCreatureSummons(pid) <= 0)) and pid ~= cid then

if canAtk then --alterado v1.6

if ret and ret.cond then

ret.id = pid

ret.check = getPlayerStorageValue(pid, conds[ret.cond])

doCondition2(ret)

end

if spell == "Selfdestruct" then

if getPlayerStorageValue(pid, 9658783) <= 0 then

doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)

doCreatureAddHealth(pid, -max) --alterado v1.6

end

else

doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)

end

end

elseif isPlayer(cid) and ehMonstro(pid) and pid ~= cid then

if canAtk then --alterado v1.6

if ret and ret.cond then

ret.id = pid

ret.check = getPlayerStorageValue(pid, conds[ret.cond])

doCondition2(ret)

end

if spell == "Selfdestruct" then

if getPlayerStorageValue(pid, 9658783) <= 0 then

doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)

doCreatureAddHealth(pid, -max) --alterado v1.6

end

else

doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)

end

end

end

end

end

--------------------------------------------------------------------------------

function sendEffWithProtect(cid, pos, eff) --Manda algum magic effect com proteçoes

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

local checkpos = pos

checkpos.stackpos = 0

if not hasTile(checkpos) then

return true

end

if not canWalkOnPos2(pos, false, true, false, true, false) then --alterado v1.6

return true

end

doSendMagicEffect(pos, eff)

end

---------------------------------------------------------------------------------

function getThingPosWithDebug(what)

if not isCreature(what) or getCreatureHealth(what) <= 0 then

return {x = 1, y = 1, z = 10}

end

return getThingPos(what)

end

---------------------------------------------------------------------------------

function doDanoWithProtect(cid, element, pos, area, min, max, eff) --Da dano com proteçoes

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

doAreaCombatHealth(cid, element, pos, area, -(math.abs(min)), -(math.abs(max)), eff)

end

---------------------------------------------------------------------------------

function doDanoWithProtectWithDelay(cid, target, element, min, max, eff, area)

const_distance_delay = 56

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if target ~= 0 and isCreature(target) and not area then

delay = getDistanceBetween(getThingPosWithDebug(cid), getThingPosWithDebug(target)) * const_distance_delay

addEvent(doDanoWithProtect, delay, cid, element, getThingPosWithDebug(target), 0, min, max, eff)

return true

end

addEvent(doDanoWithProtect, 200, cid, element, getThingPosWithDebug(target), area, min, max, eff)

end

--------------------------------------------------------------------------------

function sendDistanceShootWithProtect(cid, frompos, topos, eff) --Manda um efeito de distancia com proteçoes

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

doSendDistanceShoot(frompos, topos, eff)

end

---------------------------------------------------------------------------------

function sendMoveBack(cid, pos, eff, min, max) --Manda o Atk do farfetchd de volta...

local m = #pos+1

for i = 1, #pos do

if not isCreature(cid) then return true end

---

m = m-1

thing = {x=pos[m].x,y=pos[m].y,z=pos[m].z,stackpos=253}

local pid = getThingFromPosWithProtect(thing)

addEvent(doMoveDano2, i*200, cid, pid, FLYINGDAMAGE, min/4, max/4)

addEvent(sendEffWithProtect, i*200, cid, pos[m], eff) --alterado v1.3

--

end

end

---------------------------------------------------------------------------------

function upEffect(cid, effDis)

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

pos = getThingPos(cid)

frompos = {x = pos.x+1, y = pos.y, z = pos.z}

frompos.x = pos.x - math.random(4, 7)

frompos.y = pos.y - math.random(5, 8)

doSendDistanceShoot(getThingPos(cid), frompos, effDis)

end

---------------------------------------------------------------------------------

function fall(cid, master, element, effDis, effArea) --Function pra jogar efeitos pra cima e cair depois... tpw falling rocks e blizzard

if isCreature(cid) then

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

pos = getThingPos(cid)

pos.x = pos.x + math.random(-4,4)

pos.y = pos.y + math.random(-4,4)

if isMonster(cid) or isPlayer(cid) then

frompos = {x = pos.x+1, y = pos.y, z = pos.z}

elseif isSummon(cid) then

frompos = getThingPos(master)

end

frompos.x = pos.x - 7

frompos.y = pos.y - 6

if effDis ~= -1 then --alterado!

doSendDistanceShoot(frompos, pos, effDis)

end

doAreaCombatHealth(cid, element, pos, 0, 0, 0, effArea)

end

end

---------------------------------------------------------------------------------

function canDoMiss(cid, nameAtk) --alterado v1.5

local atkTerra = {"Sand Attack", "Mud Shot", "Mud Bomb", "Stomp", "Crusher Stomp", "Mud Slap"}

local atkElectric = {"Electric Storm", "Thunder Wave", "Thunder", "Electricity"} --alterado v1.6

if not isCreature(cid) then return false end

if isPlayer(cid) then return true end

if not pokes[getCreatureName(cid)] then return true end

if isInArray(atkTerra, nameAtk) then

if (pokes[getCreatureName(cid)].type == "flying") or (pokes[getCreatureName(cid)].type2 == "flying") or isInArray(specialabilities["levitate"], getCreatureName(cid)) then

return false

end

elseif isInArray(atkElectric, nameAtk) then

if (pokes[getCreatureName(cid)].type == "ground") or (pokes[getCreatureName(cid)].type2 == "ground") then

return false

end

end

return true

end

---------------------------------------------------------------------------------

function doMoveInAreaMulti(cid, effDis, effMagic, areaEff, areaDano, element, min, max)

if not isCreature(cid) then return true end --Da um atk com efeito tpw Multi-Kick e Bullet Seed

local pos = getPosfromArea(cid, areaEff)

local pos2 = getPosfromArea(cid, areaDano)

local n = 0

while n < #pos2 do

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

n = n+1

thing = {x=pos2[n].x,y=pos2[n].y,z=pos2[n].z,stackpos=253}

if n < #pos then

addEvent(sendDistanceShootWithProtect, 50, cid, getThingPos(cid), pos[n], effDis) --39

addEvent(sendEffWithProtect, 100, cid, pos[n], effMagic) -- 112

--- --alterado v1.6.1

if math.random(1, 2) == 2 then

addEvent(sendDistanceShootWithProtect, 450, cid, getThingPos(cid), pos[n], effDis) --550

addEvent(sendEffWithProtect, 550, cid, pos[n], effMagic) -- 650

end

end

local pid = getThingFromPosWithProtect(thing)

if isCreature(pid) then

local ret = {}

doMoveDano2(cid, pid, element, min, max, ret, getPlayerStorageValue(cid, 21102))

end

end

end

---------------------------------------------------------------------------------------

function doDoubleHit(cid, pid, valor, races) --alterado v1.6

if isCreature(cid) and isCreature(pid) then

if getPlayerStorageValue(cid, 374896) >= 1 then

if getMasterTarget(cid) == pid then

if isInArray({"Kadabra", "Alakazam", "Mew", "Shiny Abra", "Shiny Alakazam"}, getCreatureName(cid)) then

doSendDistanceShoot(getThingPosWithDebug(cid), getThingPosWithDebug(pid), 39)

end

if isSummon(cid) then

doTargetCombatHealth(getCreatureMaster(cid), pid, PHYSICALDAMAGE, -math.abs(valor), -math.abs(valor), 255)

else

doCreatureAddHealth(pid, -math.abs(valor), 3, races[getMonsterInfo(getCreatureName(pid)).race].cor)

end

end

end

end

end

 

 

 

Tenta isso ae

 

Lek To fazendo Um serve Serio xD

 

mais caso aconteça augo salva essas suas Scrptes xD

Link para o comentário
Compartilhar em outros sites

Ae Lek testa esse Script Akie --- data/lib/newStatusSyst.lua da spell MUD xD

 

Testa ae

 

 

conds = {

["Slow"] = 3890,

["Confusion"] = 3891,

["Burn"] = 3892,

["Poison"] = 3893,

["Fear"] = 3894,

["Stun"] = 3895,

["Paralyze"] = 3896, --alterado v1.6 \/ peguem o script todo!

["Leech"] = 3897,

["Buff1"] = 3898,

["Buff2"] = 3899,

["Buff3"] = 3900,

["Miss"] = 32659,

["Silence"] = 32698,

["Sleep"] = 98271,

}

injuries2 = {

[1] = {n = "slow", m = 3890},

[2] = {n = "confuse", m = 3891},

[3] = {n = "burn", m = 3892},

[4] = {n = "poison", m = 3893},

[5] = {n = "fear", m = 3894},

[6] = {n = "stun", m = 3895},

[7] = {n = "paralyze", m = 3896},

[8] = {n = "leech", m = 3897},

[9] = {n = "Buff1", m = 3898},

[10] = {n = "Buff2", m = 3899},

[11] = {n = "Buff3", m = 3900},

[12] = {n = "miss", m = 32659},

[13] = {n = "silence", m = 32698},

[14] = {n = "sleep", m = 98271},

}

Buffs = {

[1] = {"Buff1", 3898},

[2] = {"Buff2", 3899},

[3] = {"Buff3", 3900},

}

paralizeArea2 = createConditionObject(CONDITION_PARALYZE)

setConditionParam(paralizeArea2, CONDITION_PARAM_TICKS, 50000)

setConditionFormula(paralizeArea2, -0.63, -0.63, -0.63, -0.63)

local roardirections = {

[NORTH] = {SOUTH},

[sOUTH] = {NORTH},

[WEST] = {EAST}, --edited sistema de roar

[EAST] = {WEST}}

function doSendSleepEffect(cid)

if not isCreature(cid) or not isSleeping(cid) then return true end

doSendMagicEffect(getThingPos(cid), 32)

addEvent(doSendSleepEffect, 1500, cid)

end

local outFurys = {

["Shiny Charizard"] = {outFury = 1073},

["Shiny Blastoise"] = {outFury = 1074},

}

local outImune = {

["Camouflage"] = 1445,

["Acid Armor"] = 1453,

["Iron Defense"] = 1401,

["Minimize"] = 1455,

["Future Sight"] = 1446,

}

 

local function transBack(cid)

if isCreature(cid) then

if getPlayerStorageValue(cid, 974848) >= 1 then

setPlayerStorageValue(cid, 974848, 0)

doRemoveCondition(cid, CONDITION_OUTFIT)

end

end

end

function doCondition2(ret)

--

function doMiss2(cid, cd, eff, check, spell)

local stg = conds["Miss"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, 21100) >= 1 and getPlayerStorageValue(cid, stg) <= -1 then return true end --alterado v1.6 reflect

if not canDoMiss(cid, spell) then return true end

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "miss", a)

doItemSetAttribute(item.uid, "missEff", eff)

doItemSetAttribute(item.uid, "missSpell", spell)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doMiss2, 1000, cid, -1, eff, a, spell)

end

function doSilence2(cid, cd, eff, check)

local stg = conds["Silence"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "silence", a)

doItemSetAttribute(item.uid, "silenceEff", eff)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doSilence2, 1000, cid, -1, eff, a)

end

function doSlow2(cid, cd, eff, check, first)

local stg = conds["Slow"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "slow", a)

doItemSetAttribute(item.uid, "slowEff", eff)

end

 

if a <= -1 then

doRemoveCondition(cid, CONDITION_PARALYZE)

if not isSleeping(cid) and not isParalyze(cid) then

addEvent(doRegainSpeed, 50, cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if first then

doAddCondition(cid, paralizeArea2)

end

 

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doSlow2, 1000, cid, -1, eff, a)

end

function doConfusion2(cid, cd, check)

local stg = conds["Confusion"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "confuse", a)

end

 

if a <= -1 then

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isSleeping(cid) and not isParalyze(cid) then

doRegainSpeed(cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if math.random(1, 6) >= 4 then

doSendMagicEffect(getThingPos(cid), 31)

end

local isTarget = isSummon(cid) and getCreatureTarget(getCreatureMaster(cid)) or getCreatureTarget(cid)

if isCreature(isTarget) and not isSleeping(cid) and not isParalyze(cid) and getPlayerStorageValue(cid, 654878) <= 0 then --alterado v1.6

doChangeSpeed(cid, -getCreatureSpeed(cid))

doChangeSpeed(cid, 100)

doPushCreature(cid, math.random(0, 3), 1, 0) --alterado v1.6

doChangeSpeed(cid, -100)

end

local pos = getThingPos(cid)

addEvent(doSendMagicEffect, math.random(0, 450), pos, 31)

 

addEvent(doConfusion2, 1000, cid, -1, a)

end

function doBurn2(cid, cd, check, damage)

local stg = conds["Burn"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "burn", a)

doItemSetAttribute(item.uid, "burndmg", damage)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doCreatureAddHealth(cid, -damage, 15, COLOR_BURN)

addEvent(doBurn2, 3500, cid, -1, a, damage)

end

function doPoison2(cid, cd, check, damage)

local stg = conds["Poison"]

if not isCreature(cid) then return true end --is creature?

----------

if isSummon(cid) or ehMonstro(cid) and pokes[getCreatureName(cid)] then --alterado v1.6

local type = pokes[getCreatureName(cid)].type

local type2 = pokes[getCreatureName(cid)].type2

if isInArray({"poison", "steel"}, type) or isInArray({"poison", "steel"}, type2) then

return true

end

end

---------

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "poison", a)

doItemSetAttribute(item.uid, "poisondmg", damage)

end

 

if a <= -1 or getCreatureHealth(cid) == 1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

local dano = getCreatureHealth(cid)-damage <= 0 and getCreatureHealth(cid)-1 or damage

doCreatureAddHealth(cid, -dano, 8, COLOR_GRASS)

 

addEvent(doPoison2, 1500, cid, -1, a, damage)

end

function doFear2(cid, cd, check, skill)

local stg = conds["Fear"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "fear", a)

doItemSetAttribute(item.uid, "fearSkill", skill)

end

 

if a <= -1 then

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isSleeping(cid) and not isParalyze(cid) then

doRegainSpeed(cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if skill == "Roar" then

eff = 244

else --edited Roar

eff = 139

end

 

if math.random(1, 6) >= 4 then

doSendMagicEffect(getThingPos(cid), eff)

end

local isTarget = isSummon(cid) and getCreatureTarget(getCreatureMaster(cid)) or getCreatureTarget(cid)

if isCreature(isTarget) and not isSleeping(cid) and not isParalyze(cid) and getPlayerStorageValue(cid, 654878) <= 0 then --alterado v1.6

local dir = getCreatureDirectionToTarget(cid, isTarget)

doChangeSpeed(cid, -getCreatureSpeed(cid))

doChangeSpeed(cid, 100)

doPushCreature(cid, roardirections[dir][1], 1, 0) --alterado v1.6

doChangeSpeed(cid, -100)

end

local pos = getThingPos(cid)

addEvent(doSendMagicEffect, math.random(0, 450), pos, eff)

 

addEvent(doFear2, 1000, cid, -1, a, skill)

end

function doStun2(cid, cd, eff, check, spell)

local stg = conds["Stun"]

if not isCreature(cid) then return true end --is creature?

if not canDoMiss(cid, spell) then return true end

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "stun", a)

doItemSetAttribute(item.uid, "stunEff", eff)

doItemSetAttribute(item.uid, "stunSpell", spell)

end

 

if a <= -1 then

doRemoveCondition(cid, CONDITION_PARALYZE)

if not isSleeping(cid) and not isParalyze(cid) then

addEvent(doRegainSpeed, 50, cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if getCreatureCondition(cid, CONDITION_PARALYZE) == false then

doAddCondition(cid, paralizeArea2)

end

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doStun2, 1000, cid, -1, eff, a, spell)

end

function doParalyze2(cid, cd, eff, check, first)

local stg = conds["Paralyze"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "paralyze", a)

doItemSetAttribute(item.uid, "paralyzeEff", eff)

end

 

if a <= -1 then

if isPlayer(cid) then

if not isSleeping(cid) then --alterado

mayNotMove(cid, false)

end

else

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isSleeping(cid) then

doRegainSpeed(cid) --alterado

end

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if isPlayer(cid) then

mayNotMove(cid, true)

else --alterado v1.6

doChangeSpeed(cid, -2000)

end

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doParalyze2, 1000, cid, -1, eff, a, false)

end

function doSleep2(cid, cd, check, first)

local stg = conds["Sleep"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not isSleeping(cid) then

addEvent(doSendSleepEffect, 500, cid)

end

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "sleep", a)

end

 

if a <= -1 then

if not isPlayer(cid) then

local dittoStg = getPlayerStorageValue(cid, 1010)

if getCreatureName(cid) == "Ditto" and isSummon(cid) and tostring(dittoStg) and dittoStg ~= "Ditto" then

doSetCreatureOutfit(cid, {lookType = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "transOutfit")}, -1)

else

doRemoveCondition(cid, CONDITION_OUTFIT)

end

if getPlayerStorageValue(cid, 625877) ~= -1 then

doSetCreatureOutfit(cid, {lookType = getPlayerStorageValue(cid, 625877)}, -1) --alterado v1.6

end

end

if isPlayer(cid) then

if not isParalyze(cid) then

mayNotMove(cid, false) --alterado

end

else

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isParalyze(cid) then

doRegainSpeed(cid) --alterado

end

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if first then

if getCreatureName(cid) == "Ursaring" and getCreatureCondition(cid, CONDITION_OUTFIT) == true then

 

elseif not isPlayer(cid) then

if isInArray({604, 605, 1015, 1016, 1183, 1184}, getCreatureOutfit(cid).lookType) then

Info = 0 --alterado v1.6

else

Info = getMonsterInfo(getCreatureName(cid)).lookCorpse

end

local look = getCreatureOutfit(cid)

---------

local dittoStg = getPlayerStorageValue(cid, 1010)

if getCreatureName(cid) == "Ditto" and isSummon(cid) and tostring(dittoStg) and dittoStg ~= "Ditto" then

local InfoDitto = getMonsterInfo(tostring(dittoStg)).lookCorpse

if InfoDitto ~= 0 and look.lookType ~= 0 then

doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(tostring(dittoStg)).lookCorpse}, -1)

end

else

if getCreatureName(cid) == "Shiny Golem" and getCreatureOutfit(cid).lookType == 1403 then

doRemoveCondition(cid, CONDITION_OUTFIT)

elseif Info ~= 0 and look.lookType ~= 0 then

doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(getCreatureName(cid)).lookCorpse}, -1)

end

end

end

end

--alterado v1.6

if isPlayer(cid) then

mayNotMove(cid, true)

else

doChangeSpeed(cid, -getCreatureSpeed(cid))

end

addEvent(doSleep2, 1000, cid, -1, a, false)

end

function doLeech2(cid, attacker, cd, check, damage)

local stg = conds["Leech"]

if not isCreature(cid) then return true end --is creature?

if attacker ~= 0 and not isCreature(attacker) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "leech", a)

doItemSetAttribute(item.uid, "leechdmg", damage)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

local life = getCreatureHealth(cid)

------

doCreatureAddHealth(cid, -damage)

doSendAnimatedText(getThingPos(cid), "-"..damage.."", 144)

doSendMagicEffect(getThingPos(cid), 45)

------

local newlife = life - getCreatureHealth(cid)

if newlife >= 1 and attacker ~= 0 then

doSendMagicEffect(getThingPos(attacker), 14)

doCreatureAddHealth(attacker, newlife)

doSendAnimatedText(getThingPos(attacker), "+"..newlife.."", 32)

end

addEvent(doLeech2, 2000, cid, attacker, -1, a, damage)

end

function doBuff2(cid, cd, eff, check, buff, first, attr)

if not isCreature(cid) then return true end --is creature?

---------------------

local atributo = attr and attr or ""

if first and atributo == "" then

for i = 1, 3 do

if getPlayerStorageValue(cid, Buffs[2]) <= 0 then

atributo = Buffs[1]

break

end

end

end

if atributo == "" then return true end

if ehMonstro(cid) then atributo = "Buff1" end

----------------------

local stg = conds[atributo]

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, atributo, a)

doItemSetAttribute(item.uid, atributo.."eff", eff)

doItemSetAttribute(item.uid, atributo.."skill", buff)

end

 

if a <= -1 then --alterado v1.6

if isInArray({"Future Sight", "Camouflage", "Acid Armor", "Iron Defense", "Minimize", "Bug Fighter", "Ancient Fury"}, buff) then

if getCreatureName(cid) == "Ditto" and pokes[getPlayerStorageValue(cid, 1010)] and getPlayerStorageValue(cid, 1010) ~= "Ditto" then

if isSummon(cid) then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doSetCreatureOutfit(cid, {lookType = getItemAttribute(item.uid, "transOutfit")}, -1) --alterado v1.6.1

end

elseif not isSleeping(cid) then

doRemoveCondition(cid, CONDITION_OUTFIT)

end

setPlayerStorageValue(cid, 9658783, -1)

setPlayerStorageValue(cid, 625877, -1) --alterado v1.6

end

if isInArray({"Strafe", "Agility", "Ancient Fury", "War Dog", "Fighter Spirit", "Furious Legs", "Ultimate Champion", "Bug Fighter"}, buff) then

setPlayerStorageValue(cid, 374896, -1) --alterado v1.6

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doSendMagicEffect(getThingPos(cid), eff)

 

if first then

if buff == "Strafe" or buff == "Agility" then

setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6

doRaiseStatus(cid, 0, 0, 100, a)

elseif buff == "Tailwind" then

doRaiseStatus(cid, 0, 0, 200, a)

elseif buff == "Rage" then

doRaiseStatus(cid, 2, 0, 0, a)

elseif buff == "Harden" then

doRaiseStatus(cid, 0, 2, 0, a)

elseif buff == "Calm Mind" then

doRaiseStatus(cid, 0, 2, 0, a)

elseif buff == "Ancient Fury" then

doSetCreatureOutfit(cid, {lookType = outFurys[getCreatureName(cid)].outFury}, a*1000)

setPlayerStorageValue(cid, 374896, 1) --velo atk

if getCreatureName(cid) == "Shiny Charizard" then

doRaiseStatus(cid, 2, 0, 0, a) --atk melee --alterado v1.6

else

doRaiseStatus(cid, 0, 2, 0, a) --def

end

setPlayerStorageValue(cid, 625877, outFurys[getCreatureName(cid)].outFury) --alterado v1.6

elseif buff == "War Dog" then

doRaiseStatus(cid, 1.5, 1.5, 0, a)

setPlayerStorageValue(cid, 374896, 1) --velo atk

elseif buff == "Rest" then

doSleep2(cid, cd, getPlayerStorageValue(cid, conds["Sleep"]), true)

doCreatureAddHealth(cid, getCreatureMaxHealth(cid))

elseif isInArray({"Fighter Spirit", "Furious Legs", "Ultimate Champion"}, buff) then

doRaiseStatus(cid, 1.5, 0, 0, a) --atk melee --alterado v1.6

setPlayerStorageValue(cid, 374896, 1) --velo atk

addEvent(setPlayerStorageValue, a*1000, cid, 465987, -1)

elseif isInArray({"Future Sight", "Camouflage", "Acid Armor", "Iron Defense", "Minimize"}, buff) then

doSetCreatureOutfit(cid, {lookType = outImune[buff]}, -1)

setPlayerStorageValue(cid, 9658783, 1)

setPlayerStorageValue(cid, 625877, outImune[buff]) --alterado v1.6

elseif buff == "Bug Fighter" then

setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6

doRaiseStatus(cid, 1.5, 1.5, 100, a)

doSetCreatureOutfit(cid, {lookType = 1448}, a*1000)

setPlayerStorageValue(cid, 625877, 1448) --alterado v1.6

end

end

addEvent(doBuff2, 1000, cid, -1, eff, a, buff, false, atributo)

end

 

if ret.buff and ret.buff ~= "" then

doBuff2(ret.id, ret.cd, ret.eff, ret.check, ret.buff, ret.first, (ret.attr and ret.attr or false))

end

if isSummon(ret.id) and getPokemonBoost(ret.id) ~= 0 and math.random(1, 100) <= getPokemonBoost(ret.id) then --sistema "pegou no boost"

if ret.cond and not isInArray({"Poison", "Burn", "Leech", "Fear"}, ret.cond) then --alterado v1.6

doSendMagicEffect(getThingPosWithDebug(ret.id), 114)

return true

end

end

if ret.cond and ret.cond == "Miss" then

doMiss2(ret.id, ret.cd, ret.eff, ret.check, ret.spell)

elseif ret.cond and ret.cond == "Silence" then

doSilence2(ret.id, ret.cd, ret.eff, ret.check)

elseif ret.cond and ret.cond == "Slow" then

doSlow2(ret.id, ret.cd, ret.eff, ret.check, ret.first)

elseif ret.cond and ret.cond == "Confusion" then

doConfusion2(ret.id, ret.cd, ret.check)

elseif ret.cond and ret.cond == "Burn" then

doBurn2(ret.id, ret.cd, ret.check, ret.damage)

elseif ret.cond and ret.cond == "Poison" then

doPoison2(ret.id, ret.cd, ret.check, ret.damage)

elseif ret.cond and ret.cond == "Fear" then

doFear2(ret.id, ret.cd, ret.check, ret.skill)

elseif ret.cond and ret.cond == "Stun" then

doStun2(ret.id, ret.cd, ret.eff, ret.check, ret.spell)

elseif ret.cond and ret.cond == "Paralyze" then

doParalyze2(ret.id, ret.cd, ret.eff, ret.check, ret.first)

elseif ret.cond and ret.cond == "Sleep" then

doSleep2(ret.id, ret.cd, ret.check, ret.first)

elseif ret.cond and ret.cond == "Leech" then

doLeech2(ret.id, ret.attacker, ret.cd, ret.check, ret.damage)

end

end

--------------------------------

function cleanBuffs2(item)

if item ~= 0 then

for i = 1, 3 do

doItemEraseAttribute(item, Buffs[1])

doItemEraseAttribute(item, Buffs[1].."eff")

doItemEraseAttribute(item, Buffs[1].."skill")

end

end

end

--------------------------------

function doCureStatus(cid, type, playerballs)

if not isCreature(cid) then return true end

if playerballs and isPlayer(cid) then

local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

local mb = getPlayerSlotItem(cid, 8)

if isPokeball(mb.itemid) then

if not type or type == "all" then

for b = 1, #injuries2 do

doItemSetAttribute(mb.uid, ""..injuries2.n.."", -1)

end

else

doItemSetAttribute(mb.uid, ""..type.."", -1)

end

end

for bname, balls in pairs (pokeballs) do

for times = 1,3 do

local items = getItemsInContainerById(bp.uid, balls.all[times])

for _, uid in pairs(items) do

if not type or type == "all" then

for b = 1, #injuries2 do

doItemSetAttribute(uid, ""..injuries2.n.."", -1)

end

else

doItemSetAttribute(uid, ""..type.."", -1)

end

end

end

end

end

if type == "all" then

for a = 1, #injuries2 do

setPlayerStorageValue(cid, injuries2[a].m, -1)

end

return true

end

for a, b in pairs (injuries2) do

if b.n == type then

setPlayerStorageValue(cid, b.m, -1)

end

end

end

---------------------------------

function isWithCondition(cid)

for i = 1, #injuries2 do

if getPlayerStorageValue(cid, injuries2.m) >= 1 then

return true

end

end

return false

end

---------------------------------

function doCureBallStatus(item, type)

if not type or type == "all" then

for b = 1, #injuries2 do

doItemSetAttribute(item, ""..injuries2.n.."", -1)

end

else

doItemSetAttribute(item, ""..type.."", -1)

end

end

---------------------------------

function isBurning(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Burn"]) >= 0 then return true end

return false

end

function isPoisoned(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Poison"]) >= 0 then return true end

return false

end

function isSilence(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Silence"]) >= 0 then return true end

return false

end

function isParalyze(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Paralyze"]) >= 0 then return true end

return false

end

 

function isSleeping(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Sleep"]) >= 0 then return true end

return false

end

function isWithFear(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Fear"]) >= 0 then return true end

return false

end

-----------------------------------

function doMoveInArea2(cid, eff, area, element, min, max, spell, ret)

if not isCreature(cid) then return true end

if spell and spell == "Mud Bomb" then

pos = getPosfromArea(getMasterTarget(cid), area)

else

pos = getPosfromArea(cid, area)

end

setPlayerStorageValue(cid, 21101, -1) --alterado v1.6

 

local skills = {"Skull Bash", "Gust", "Water Pulse", "Stick Throw", "Overheat", "Toxic", "Take Down"}

local n = 0

local l = 0

while n < #pos do

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

n = n+1

thing = {x=pos[n].x,y=pos[n].y,z=pos[n].z,stackpos=253}

local pid = getThingFromPosWithProtect(thing)

----

if pid ~= cid then

if spell and isInArray(skills, spell) then

if spell == "Stick Throw" then

addEvent(sendEffWithProtect, l*300, cid, pos[n], eff)

addEvent(sendMoveBack, 1200, cid, pos, eff, min, max)

addEvent(doMoveDano2, l*300, cid, pid, element, min, max, ret, spell) --alterado v1.6

else

addEvent(sendEffWithProtect, l*200, cid, pos[n], eff)

addEvent(doMoveDano2, l*200, cid, pid, element, min, max, ret, spell) --alterado v1.6

end

elseif spell and spell == "Epicenter" then

local random = math.random(50, 500)

addEvent(sendEffWithProtect, random, cid, pos[n], eff)

addEvent(doDanoWithProtect, random, cid, GROUNDDAMAGE, pos[n], crusher, -min, -max, 255)

elseif spell and spell == "Shadowave" then

posi = {x=pos[n].x, y=pos[n].y+1, z=pos[n].z}

sendEffWithProtect(cid, posi, eff)

doMoveDano2(cid, pid, element, min, max, ret, spell) --alterado v1.6

elseif spell and spell == "Surf" then

addEvent(sendEffWithProtect, math.random(50, 500), cid, pos[n], eff)

addEvent(doMoveDano2, 400, cid, pid, element, min, max, ret, spell) --alterado v1.6

elseif spell and spell == "Sand Attack" then

addEvent(sendEffWithProtect, n*200, cid, pos[n], eff)

addEvent(doMoveDano2, n*200, cid, pid, element, min, max, ret, spell) --alterado v1.6

elseif spell and (spell == "Muddy Water" or spell == "Venom Motion") then

local arr = {

[1] = 0, [2] = 0, [3] = 0, [4] = 200, [5] = 200, [6] = 200, [7] = 400, [8] = 400, [9] = 400, [10] = 600, [11] = 600,

[12] = 600, [13] = 800, [14] = 800, [15] = 800

}

local time = {0, 200, 400, 600, 800}

 

addEvent(sendEffWithProtect, arr[n], cid, pos[n], eff)

addEvent(doMoveDano2, arr[n], cid, pid, element, min, max, ret, spell)

elseif spell and (spell == "Inferno" or spell == "Fissure") then

addEvent(sendEffWithProtect, math.random(0, 500), cid, pos[n], eff)

addEvent(doMoveDano2, math.random(0, 500), cid, pid, element, min, max, ret, spell)

else

sendEffWithProtect(cid, pos[n], eff)

doMoveDano2(cid, pid, element, min, max, ret, spell)

end

end

l = l+1

end

end

-------------------------------------------

function doMoveDano2(cid, pid, element, min, max, ret, spell)

if isCreature(pid) and isCreature(cid) and cid ~= pid then

if isNpcSummon(pid) and getCreatureTarget(pid) ~= cid then

return true --alterado v1.6

end

if ehNPC(pid) then return true end

---

local canAtk = true --alterado v1.6

if getPlayerStorageValue(pid, 21099) >= 1 then

doSendMagicEffect(getThingPosWithDebug(pid), 135)

doSendAnimatedText(getThingPosWithDebug(pid), "REFLECT", COLOR_GRASS)

addEvent(docastspell, 100, pid, spell)

if getCreatureName(pid) == "Wobbuffet" then

doRemoveCondition(pid, CONDITION_OUTFIT)

end

canAtk = false

setPlayerStorageValue(pid, 21099, -1)

setPlayerStorageValue(pid, 21100, 1)

setPlayerStorageValue(pid, 21101, cid)

setPlayerStorageValue(pid, 21103, getTableMove(cid, getPlayerStorageValue(cid, 21102)).f)

end

---

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isSummon(cid) and (ehMonstro(pid) or (isSummon(pid) and canAttackOther(cid, pid) == "Can") or (isPlayer(pid) and canAttackOther(cid, pid) == "Can" and #getCreatureSummons(pid) <= 0)) and pid ~= cid then

if canAtk then --alterado v1.6

if ret and ret.cond then

ret.id = pid

ret.check = getPlayerStorageValue(pid, conds[ret.cond])

doCondition2(ret)

end

if spell == "Selfdestruct" then

if getPlayerStorageValue(pid, 9658783) <= 0 then

doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)

doCreatureAddHealth(pid, -max) --alterado v1.6

end

else

doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)

end

end

elseif ehMonstro(cid) and (isSummon(pid) or (isPlayer(pid) and #getCreatureSummons(pid) <= 0)) and pid ~= cid then

if canAtk then --alterado v1.6

if ret and ret.cond then

ret.id = pid

ret.check = getPlayerStorageValue(pid, conds[ret.cond])

doCondition2(ret)

end

if spell == "Selfdestruct" then

if getPlayerStorageValue(pid, 9658783) <= 0 then

doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)

doCreatureAddHealth(pid, -max) --alterado v1.6

end

else

doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)

end

end

elseif isPlayer(cid) and ehMonstro(pid) and pid ~= cid then

if canAtk then --alterado v1.6

if ret and ret.cond then

ret.id = pid

ret.check = getPlayerStorageValue(pid, conds[ret.cond])

doCondition2(ret)

end

if spell == "Selfdestruct" then

if getPlayerStorageValue(pid, 9658783) <= 0 then

doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)

doCreatureAddHealth(pid, -max) --alterado v1.6

end

else

doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)

end

end

end

end

end

--------------------------------------------------------------------------------

function sendEffWithProtect(cid, pos, eff) --Manda algum magic effect com proteçoes

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

local checkpos = pos

checkpos.stackpos = 0

if not hasTile(checkpos) then

return true

end

if not canWalkOnPos2(pos, false, true, false, true, false) then --alterado v1.6

return true

end

doSendMagicEffect(pos, eff)

end

---------------------------------------------------------------------------------

function getThingPosWithDebug(what)

if not isCreature(what) or getCreatureHealth(what) <= 0 then

return {x = 1, y = 1, z = 10}

end

return getThingPos(what)

end

---------------------------------------------------------------------------------

function doDanoWithProtect(cid, element, pos, area, min, max, eff) --Da dano com proteçoes

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

doAreaCombatHealth(cid, element, pos, area, -(math.abs(min)), -(math.abs(max)), eff)

end

---------------------------------------------------------------------------------

function doDanoWithProtectWithDelay(cid, target, element, min, max, eff, area)

const_distance_delay = 56

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if target ~= 0 and isCreature(target) and not area then

delay = getDistanceBetween(getThingPosWithDebug(cid), getThingPosWithDebug(target)) * const_distance_delay

addEvent(doDanoWithProtect, delay, cid, element, getThingPosWithDebug(target), 0, min, max, eff)

return true

end

addEvent(doDanoWithProtect, 200, cid, element, getThingPosWithDebug(target), area, min, max, eff)

end

--------------------------------------------------------------------------------

function sendDistanceShootWithProtect(cid, frompos, topos, eff) --Manda um efeito de distancia com proteçoes

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

doSendDistanceShoot(frompos, topos, eff)

end

---------------------------------------------------------------------------------

function sendMoveBack(cid, pos, eff, min, max) --Manda o Atk do farfetchd de volta...

local m = #pos+1

for i = 1, #pos do

if not isCreature(cid) then return true end

---

m = m-1

thing = {x=pos[m].x,y=pos[m].y,z=pos[m].z,stackpos=253}

local pid = getThingFromPosWithProtect(thing)

addEvent(doMoveDano2, i*200, cid, pid, FLYINGDAMAGE, min/4, max/4)

addEvent(sendEffWithProtect, i*200, cid, pos[m], eff) --alterado v1.3

--

end

end

---------------------------------------------------------------------------------

function upEffect(cid, effDis)

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

pos = getThingPos(cid)

frompos = {x = pos.x+1, y = pos.y, z = pos.z}

frompos.x = pos.x - math.random(4, 7)

frompos.y = pos.y - math.random(5, 8)

doSendDistanceShoot(getThingPos(cid), frompos, effDis)

end

---------------------------------------------------------------------------------

function fall(cid, master, element, effDis, effArea) --Function pra jogar efeitos pra cima e cair depois... tpw falling rocks e blizzard

if isCreature(cid) then

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

pos = getThingPos(cid)

pos.x = pos.x + math.random(-4,4)

pos.y = pos.y + math.random(-4,4)

if isMonster(cid) or isPlayer(cid) then

frompos = {x = pos.x+1, y = pos.y, z = pos.z}

elseif isSummon(cid) then

frompos = getThingPos(master)

end

frompos.x = pos.x - 7

frompos.y = pos.y - 6

if effDis ~= -1 then --alterado!

doSendDistanceShoot(frompos, pos, effDis)

end

doAreaCombatHealth(cid, element, pos, 0, 0, 0, effArea)

end

end

---------------------------------------------------------------------------------

function canDoMiss(cid, nameAtk) --alterado v1.5

local atkTerra = {"Sand Attack", "Mud Shot", "Mud Bomb", "Stomp", "Crusher Stomp", "Mud Slap"}

local atkElectric = {"Electric Storm", "Thunder Wave", "Thunder", "Electricity"} --alterado v1.6

if not isCreature(cid) then return false end

if isPlayer(cid) then return true end

if not pokes[getCreatureName(cid)] then return true end

if isInArray(atkTerra, nameAtk) then

if (pokes[getCreatureName(cid)].type == "flying") or (pokes[getCreatureName(cid)].type2 == "flying") or isInArray(specialabilities["levitate"], getCreatureName(cid)) then

return false

end

elseif isInArray(atkElectric, nameAtk) then

if (pokes[getCreatureName(cid)].type == "ground") or (pokes[getCreatureName(cid)].type2 == "ground") then

return false

end

end

return true

end

---------------------------------------------------------------------------------

function doMoveInAreaMulti(cid, effDis, effMagic, areaEff, areaDano, element, min, max)

if not isCreature(cid) then return true end --Da um atk com efeito tpw Multi-Kick e Bullet Seed

local pos = getPosfromArea(cid, areaEff)

local pos2 = getPosfromArea(cid, areaDano)

local n = 0

while n < #pos2 do

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

n = n+1

thing = {x=pos2[n].x,y=pos2[n].y,z=pos2[n].z,stackpos=253}

if n < #pos then

addEvent(sendDistanceShootWithProtect, 50, cid, getThingPos(cid), pos[n], effDis) --39

addEvent(sendEffWithProtect, 100, cid, pos[n], effMagic) -- 112

--- --alterado v1.6.1

if math.random(1, 2) == 2 then

addEvent(sendDistanceShootWithProtect, 450, cid, getThingPos(cid), pos[n], effDis) --550

addEvent(sendEffWithProtect, 550, cid, pos[n], effMagic) -- 650

end

end

local pid = getThingFromPosWithProtect(thing)

if isCreature(pid) then

local ret = {}

doMoveDano2(cid, pid, element, min, max, ret, getPlayerStorageValue(cid, 21102))

end

end

end

---------------------------------------------------------------------------------------

function doDoubleHit(cid, pid, valor, races) --alterado v1.6

if isCreature(cid) and isCreature(pid) then

if getPlayerStorageValue(cid, 374896) >= 1 then

if getMasterTarget(cid) == pid then

if isInArray({"Kadabra", "Alakazam", "Mew", "Shiny Abra", "Shiny Alakazam"}, getCreatureName(cid)) then

doSendDistanceShoot(getThingPosWithDebug(cid), getThingPosWithDebug(pid), 39)

end

if isSummon(cid) then

doTargetCombatHealth(getCreatureMaster(cid), pid, PHYSICALDAMAGE, -math.abs(valor), -math.abs(valor), 255)

else

doCreatureAddHealth(pid, -math.abs(valor), 3, races[getMonsterInfo(getCreatureName(pid)).race].cor)

end

end

end

end

end

 

 

 

Tenta isso ae

vou testa !!
Link para o comentário
Compartilhar em outros sites

Ae Lek testa esse Script Akie --- data/lib/newStatusSyst.lua da spell MUD xD

 

Testa ae

 

 

conds = {

["Slow"] = 3890,

["Confusion"] = 3891,

["Burn"] = 3892,

["Poison"] = 3893,

["Fear"] = 3894,

["Stun"] = 3895,

["Paralyze"] = 3896, --alterado v1.6 \/ peguem o script todo!

["Leech"] = 3897,

["Buff1"] = 3898,

["Buff2"] = 3899,

["Buff3"] = 3900,

["Miss"] = 32659,

["Silence"] = 32698,

["Sleep"] = 98271,

}

injuries2 = {

[1] = {n = "slow", m = 3890},

[2] = {n = "confuse", m = 3891},

[3] = {n = "burn", m = 3892},

[4] = {n = "poison", m = 3893},

[5] = {n = "fear", m = 3894},

[6] = {n = "stun", m = 3895},

[7] = {n = "paralyze", m = 3896},

[8] = {n = "leech", m = 3897},

[9] = {n = "Buff1", m = 3898},

[10] = {n = "Buff2", m = 3899},

[11] = {n = "Buff3", m = 3900},

[12] = {n = "miss", m = 32659},

[13] = {n = "silence", m = 32698},

[14] = {n = "sleep", m = 98271},

}

Buffs = {

[1] = {"Buff1", 3898},

[2] = {"Buff2", 3899},

[3] = {"Buff3", 3900},

}

paralizeArea2 = createConditionObject(CONDITION_PARALYZE)

setConditionParam(paralizeArea2, CONDITION_PARAM_TICKS, 50000)

setConditionFormula(paralizeArea2, -0.63, -0.63, -0.63, -0.63)

local roardirections = {

[NORTH] = {SOUTH},

[sOUTH] = {NORTH},

[WEST] = {EAST}, --edited sistema de roar

[EAST] = {WEST}}

function doSendSleepEffect(cid)

if not isCreature(cid) or not isSleeping(cid) then return true end

doSendMagicEffect(getThingPos(cid), 32)

addEvent(doSendSleepEffect, 1500, cid)

end

local outFurys = {

["Shiny Charizard"] = {outFury = 1073},

["Shiny Blastoise"] = {outFury = 1074},

}

local outImune = {

["Camouflage"] = 1445,

["Acid Armor"] = 1453,

["Iron Defense"] = 1401,

["Minimize"] = 1455,

["Future Sight"] = 1446,

}

 

local function transBack(cid)

if isCreature(cid) then

if getPlayerStorageValue(cid, 974848) >= 1 then

setPlayerStorageValue(cid, 974848, 0)

doRemoveCondition(cid, CONDITION_OUTFIT)

end

end

end

function doCondition2(ret)

--

function doMiss2(cid, cd, eff, check, spell)

local stg = conds["Miss"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, 21100) >= 1 and getPlayerStorageValue(cid, stg) <= -1 then return true end --alterado v1.6 reflect

if not canDoMiss(cid, spell) then return true end

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "miss", a)

doItemSetAttribute(item.uid, "missEff", eff)

doItemSetAttribute(item.uid, "missSpell", spell)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doMiss2, 1000, cid, -1, eff, a, spell)

end

function doSilence2(cid, cd, eff, check)

local stg = conds["Silence"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "silence", a)

doItemSetAttribute(item.uid, "silenceEff", eff)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doSilence2, 1000, cid, -1, eff, a)

end

function doSlow2(cid, cd, eff, check, first)

local stg = conds["Slow"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "slow", a)

doItemSetAttribute(item.uid, "slowEff", eff)

end

 

if a <= -1 then

doRemoveCondition(cid, CONDITION_PARALYZE)

if not isSleeping(cid) and not isParalyze(cid) then

addEvent(doRegainSpeed, 50, cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if first then

doAddCondition(cid, paralizeArea2)

end

 

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doSlow2, 1000, cid, -1, eff, a)

end

function doConfusion2(cid, cd, check)

local stg = conds["Confusion"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "confuse", a)

end

 

if a <= -1 then

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isSleeping(cid) and not isParalyze(cid) then

doRegainSpeed(cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if math.random(1, 6) >= 4 then

doSendMagicEffect(getThingPos(cid), 31)

end

local isTarget = isSummon(cid) and getCreatureTarget(getCreatureMaster(cid)) or getCreatureTarget(cid)

if isCreature(isTarget) and not isSleeping(cid) and not isParalyze(cid) and getPlayerStorageValue(cid, 654878) <= 0 then --alterado v1.6

doChangeSpeed(cid, -getCreatureSpeed(cid))

doChangeSpeed(cid, 100)

doPushCreature(cid, math.random(0, 3), 1, 0) --alterado v1.6

doChangeSpeed(cid, -100)

end

local pos = getThingPos(cid)

addEvent(doSendMagicEffect, math.random(0, 450), pos, 31)

 

addEvent(doConfusion2, 1000, cid, -1, a)

end

function doBurn2(cid, cd, check, damage)

local stg = conds["Burn"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "burn", a)

doItemSetAttribute(item.uid, "burndmg", damage)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doCreatureAddHealth(cid, -damage, 15, COLOR_BURN)

addEvent(doBurn2, 3500, cid, -1, a, damage)

end

function doPoison2(cid, cd, check, damage)

local stg = conds["Poison"]

if not isCreature(cid) then return true end --is creature?

----------

if isSummon(cid) or ehMonstro(cid) and pokes[getCreatureName(cid)] then --alterado v1.6

local type = pokes[getCreatureName(cid)].type

local type2 = pokes[getCreatureName(cid)].type2

if isInArray({"poison", "steel"}, type) or isInArray({"poison", "steel"}, type2) then

return true

end

end

---------

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "poison", a)

doItemSetAttribute(item.uid, "poisondmg", damage)

end

 

if a <= -1 or getCreatureHealth(cid) == 1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

local dano = getCreatureHealth(cid)-damage <= 0 and getCreatureHealth(cid)-1 or damage

doCreatureAddHealth(cid, -dano, 8, COLOR_GRASS)

 

addEvent(doPoison2, 1500, cid, -1, a, damage)

end

function doFear2(cid, cd, check, skill)

local stg = conds["Fear"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "fear", a)

doItemSetAttribute(item.uid, "fearSkill", skill)

end

 

if a <= -1 then

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isSleeping(cid) and not isParalyze(cid) then

doRegainSpeed(cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if skill == "Roar" then

eff = 244

else --edited Roar

eff = 139

end

 

if math.random(1, 6) >= 4 then

doSendMagicEffect(getThingPos(cid), eff)

end

local isTarget = isSummon(cid) and getCreatureTarget(getCreatureMaster(cid)) or getCreatureTarget(cid)

if isCreature(isTarget) and not isSleeping(cid) and not isParalyze(cid) and getPlayerStorageValue(cid, 654878) <= 0 then --alterado v1.6

local dir = getCreatureDirectionToTarget(cid, isTarget)

doChangeSpeed(cid, -getCreatureSpeed(cid))

doChangeSpeed(cid, 100)

doPushCreature(cid, roardirections[dir][1], 1, 0) --alterado v1.6

doChangeSpeed(cid, -100)

end

local pos = getThingPos(cid)

addEvent(doSendMagicEffect, math.random(0, 450), pos, eff)

 

addEvent(doFear2, 1000, cid, -1, a, skill)

end

function doStun2(cid, cd, eff, check, spell)

local stg = conds["Stun"]

if not isCreature(cid) then return true end --is creature?

if not canDoMiss(cid, spell) then return true end

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "stun", a)

doItemSetAttribute(item.uid, "stunEff", eff)

doItemSetAttribute(item.uid, "stunSpell", spell)

end

 

if a <= -1 then

doRemoveCondition(cid, CONDITION_PARALYZE)

if not isSleeping(cid) and not isParalyze(cid) then

addEvent(doRegainSpeed, 50, cid) --alterado

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if getCreatureCondition(cid, CONDITION_PARALYZE) == false then

doAddCondition(cid, paralizeArea2)

end

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doStun2, 1000, cid, -1, eff, a, spell)

end

function doParalyze2(cid, cd, eff, check, first)

local stg = conds["Paralyze"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "paralyze", a)

doItemSetAttribute(item.uid, "paralyzeEff", eff)

end

 

if a <= -1 then

if isPlayer(cid) then

if not isSleeping(cid) then --alterado

mayNotMove(cid, false)

end

else

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isSleeping(cid) then

doRegainSpeed(cid) --alterado

end

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if isPlayer(cid) then

mayNotMove(cid, true)

else --alterado v1.6

doChangeSpeed(cid, -2000)

end

doSendMagicEffect(getThingPos(cid), eff)

addEvent(doParalyze2, 1000, cid, -1, eff, a, false)

end

function doSleep2(cid, cd, check, first)

local stg = conds["Sleep"]

if not isCreature(cid) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not isSleeping(cid) then

addEvent(doSendSleepEffect, 500, cid)

end

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "sleep", a)

end

 

if a <= -1 then

if not isPlayer(cid) then

local dittoStg = getPlayerStorageValue(cid, 1010)

if getCreatureName(cid) == "Ditto" and isSummon(cid) and tostring(dittoStg) and dittoStg ~= "Ditto" then

doSetCreatureOutfit(cid, {lookType = getItemAttribute(getPlayerSlotItem(getCreatureMaster(cid), 8).uid, "transOutfit")}, -1)

else

doRemoveCondition(cid, CONDITION_OUTFIT)

end

if getPlayerStorageValue(cid, 625877) ~= -1 then

doSetCreatureOutfit(cid, {lookType = getPlayerStorageValue(cid, 625877)}, -1) --alterado v1.6

end

end

if isPlayer(cid) then

if not isParalyze(cid) then

mayNotMove(cid, false) --alterado

end

else

if getCreatureCondition(cid, CONDITION_PARALYZE) == true then

doRemoveCondition(cid, CONDITION_PARALYZE)

addEvent(doAddCondition, 10, cid, paralizeArea2)

end

if not isParalyze(cid) then

doRegainSpeed(cid) --alterado

end

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

if first then

if getCreatureName(cid) == "Ursaring" and getCreatureCondition(cid, CONDITION_OUTFIT) == true then

 

elseif not isPlayer(cid) then

if isInArray({604, 605, 1015, 1016, 1183, 1184}, getCreatureOutfit(cid).lookType) then

Info = 0 --alterado v1.6

else

Info = getMonsterInfo(getCreatureName(cid)).lookCorpse

end

local look = getCreatureOutfit(cid)

---------

local dittoStg = getPlayerStorageValue(cid, 1010)

if getCreatureName(cid) == "Ditto" and isSummon(cid) and tostring(dittoStg) and dittoStg ~= "Ditto" then

local InfoDitto = getMonsterInfo(tostring(dittoStg)).lookCorpse

if InfoDitto ~= 0 and look.lookType ~= 0 then

doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(tostring(dittoStg)).lookCorpse}, -1)

end

else

if getCreatureName(cid) == "Shiny Golem" and getCreatureOutfit(cid).lookType == 1403 then

doRemoveCondition(cid, CONDITION_OUTFIT)

elseif Info ~= 0 and look.lookType ~= 0 then

doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(getCreatureName(cid)).lookCorpse}, -1)

end

end

end

end

--alterado v1.6

if isPlayer(cid) then

mayNotMove(cid, true)

else

doChangeSpeed(cid, -getCreatureSpeed(cid))

end

addEvent(doSleep2, 1000, cid, -1, a, false)

end

function doLeech2(cid, attacker, cd, check, damage)

local stg = conds["Leech"]

if not isCreature(cid) then return true end --is creature?

if attacker ~= 0 and not isCreature(attacker) then return true end --is creature?

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

 

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, "leech", a)

doItemSetAttribute(item.uid, "leechdmg", damage)

end

 

if a <= -1 then

setPlayerStorageValue(cid, stg, -1)

return true

end

 

local life = getCreatureHealth(cid)

------

doCreatureAddHealth(cid, -damage)

doSendAnimatedText(getThingPos(cid), "-"..damage.."", 144)

doSendMagicEffect(getThingPos(cid), 45)

------

local newlife = life - getCreatureHealth(cid)

if newlife >= 1 and attacker ~= 0 then

doSendMagicEffect(getThingPos(attacker), 14)

doCreatureAddHealth(attacker, newlife)

doSendAnimatedText(getThingPos(attacker), "+"..newlife.."", 32)

end

addEvent(doLeech2, 2000, cid, attacker, -1, a, damage)

end

function doBuff2(cid, cd, eff, check, buff, first, attr)

if not isCreature(cid) then return true end --is creature?

---------------------

local atributo = attr and attr or ""

if first and atributo == "" then

for i = 1, 3 do

if getPlayerStorageValue(cid, Buffs[2]) <= 0 then

atributo = Buffs[1]

break

end

end

end

if atributo == "" then return true end

if ehMonstro(cid) then atributo = "Buff1" end

----------------------

local stg = conds[atributo]

if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x

if not check and getPlayerStorageValue(cid, stg) >= 1 then

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1)

else

setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd)

end

 

local a = getPlayerStorageValue(cid, stg)

 

if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doItemSetAttribute(item.uid, atributo, a)

doItemSetAttribute(item.uid, atributo.."eff", eff)

doItemSetAttribute(item.uid, atributo.."skill", buff)

end

 

if a <= -1 then --alterado v1.6

if isInArray({"Future Sight", "Camouflage", "Acid Armor", "Iron Defense", "Minimize", "Bug Fighter", "Ancient Fury"}, buff) then

if getCreatureName(cid) == "Ditto" and pokes[getPlayerStorageValue(cid, 1010)] and getPlayerStorageValue(cid, 1010) ~= "Ditto" then

if isSummon(cid) then

local item = getPlayerSlotItem(getCreatureMaster(cid), 8)

doSetCreatureOutfit(cid, {lookType = getItemAttribute(item.uid, "transOutfit")}, -1) --alterado v1.6.1

end

elseif not isSleeping(cid) then

doRemoveCondition(cid, CONDITION_OUTFIT)

end

setPlayerStorageValue(cid, 9658783, -1)

setPlayerStorageValue(cid, 625877, -1) --alterado v1.6

end

if isInArray({"Strafe", "Agility", "Ancient Fury", "War Dog", "Fighter Spirit", "Furious Legs", "Ultimate Champion", "Bug Fighter"}, buff) then

setPlayerStorageValue(cid, 374896, -1) --alterado v1.6

end

setPlayerStorageValue(cid, stg, -1)

return true

end

 

doSendMagicEffect(getThingPos(cid), eff)

 

if first then

if buff == "Strafe" or buff == "Agility" then

setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6

doRaiseStatus(cid, 0, 0, 100, a)

elseif buff == "Tailwind" then

doRaiseStatus(cid, 0, 0, 200, a)

elseif buff == "Rage" then

doRaiseStatus(cid, 2, 0, 0, a)

elseif buff == "Harden" then

doRaiseStatus(cid, 0, 2, 0, a)

elseif buff == "Calm Mind" then

doRaiseStatus(cid, 0, 2, 0, a)

elseif buff == "Ancient Fury" then

doSetCreatureOutfit(cid, {lookType = outFurys[getCreatureName(cid)].outFury}, a*1000)

setPlayerStorageValue(cid, 374896, 1) --velo atk

if getCreatureName(cid) == "Shiny Charizard" then

doRaiseStatus(cid, 2, 0, 0, a) --atk melee --alterado v1.6

else

doRaiseStatus(cid, 0, 2, 0, a) --def

end

setPlayerStorageValue(cid, 625877, outFurys[getCreatureName(cid)].outFury) --alterado v1.6

elseif buff == "War Dog" then

doRaiseStatus(cid, 1.5, 1.5, 0, a)

setPlayerStorageValue(cid, 374896, 1) --velo atk

elseif buff == "Rest" then

doSleep2(cid, cd, getPlayerStorageValue(cid, conds["Sleep"]), true)

doCreatureAddHealth(cid, getCreatureMaxHealth(cid))

elseif isInArray({"Fighter Spirit", "Furious Legs", "Ultimate Champion"}, buff) then

doRaiseStatus(cid, 1.5, 0, 0, a) --atk melee --alterado v1.6

setPlayerStorageValue(cid, 374896, 1) --velo atk

addEvent(setPlayerStorageValue, a*1000, cid, 465987, -1)

elseif isInArray({"Future Sight", "Camouflage", "Acid Armor", "Iron Defense", "Minimize"}, buff) then

doSetCreatureOutfit(cid, {lookType = outImune[buff]}, -1)

setPlayerStorageValue(cid, 9658783, 1)

setPlayerStorageValue(cid, 625877, outImune[buff]) --alterado v1.6

elseif buff == "Bug Fighter" then

setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6

doRaiseStatus(cid, 1.5, 1.5, 100, a)

doSetCreatureOutfit(cid, {lookType = 1448}, a*1000)

setPlayerStorageValue(cid, 625877, 1448) --alterado v1.6

end

end

addEvent(doBuff2, 1000, cid, -1, eff, a, buff, false, atributo)

end

 

if ret.buff and ret.buff ~= "" then

doBuff2(ret.id, ret.cd, ret.eff, ret.check, ret.buff, ret.first, (ret.attr and ret.attr or false))

end

if isSummon(ret.id) and getPokemonBoost(ret.id) ~= 0 and math.random(1, 100) <= getPokemonBoost(ret.id) then --sistema "pegou no boost"

if ret.cond and not isInArray({"Poison", "Burn", "Leech", "Fear"}, ret.cond) then --alterado v1.6

doSendMagicEffect(getThingPosWithDebug(ret.id), 114)

return true

end

end

if ret.cond and ret.cond == "Miss" then

doMiss2(ret.id, ret.cd, ret.eff, ret.check, ret.spell)

elseif ret.cond and ret.cond == "Silence" then

doSilence2(ret.id, ret.cd, ret.eff, ret.check)

elseif ret.cond and ret.cond == "Slow" then

doSlow2(ret.id, ret.cd, ret.eff, ret.check, ret.first)

elseif ret.cond and ret.cond == "Confusion" then

doConfusion2(ret.id, ret.cd, ret.check)

elseif ret.cond and ret.cond == "Burn" then

doBurn2(ret.id, ret.cd, ret.check, ret.damage)

elseif ret.cond and ret.cond == "Poison" then

doPoison2(ret.id, ret.cd, ret.check, ret.damage)

elseif ret.cond and ret.cond == "Fear" then

doFear2(ret.id, ret.cd, ret.check, ret.skill)

elseif ret.cond and ret.cond == "Stun" then

doStun2(ret.id, ret.cd, ret.eff, ret.check, ret.spell)

elseif ret.cond and ret.cond == "Paralyze" then

doParalyze2(ret.id, ret.cd, ret.eff, ret.check, ret.first)

elseif ret.cond and ret.cond == "Sleep" then

doSleep2(ret.id, ret.cd, ret.check, ret.first)

elseif ret.cond and ret.cond == "Leech" then

doLeech2(ret.id, ret.attacker, ret.cd, ret.check, ret.damage)

end

end

--------------------------------

function cleanBuffs2(item)

if item ~= 0 then

for i = 1, 3 do

doItemEraseAttribute(item, Buffs[1])

doItemEraseAttribute(item, Buffs[1].."eff")

doItemEraseAttribute(item, Buffs[1].."skill")

end

end

end

--------------------------------

function doCureStatus(cid, type, playerballs)

if not isCreature(cid) then return true end

if playerballs and isPlayer(cid) then

local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

local mb = getPlayerSlotItem(cid, 8)

if isPokeball(mb.itemid) then

if not type or type == "all" then

for b = 1, #injuries2 do

doItemSetAttribute(mb.uid, ""..injuries2.n.."", -1)

end

else

doItemSetAttribute(mb.uid, ""..type.."", -1)

end

end

for bname, balls in pairs (pokeballs) do

for times = 1,3 do

local items = getItemsInContainerById(bp.uid, balls.all[times])

for _, uid in pairs(items) do

if not type or type == "all" then

for b = 1, #injuries2 do

doItemSetAttribute(uid, ""..injuries2.n.."", -1)

end

else

doItemSetAttribute(uid, ""..type.."", -1)

end

end

end

end

end

if type == "all" then

for a = 1, #injuries2 do

setPlayerStorageValue(cid, injuries2[a].m, -1)

end

return true

end

for a, b in pairs (injuries2) do

if b.n == type then

setPlayerStorageValue(cid, b.m, -1)

end

end

end

---------------------------------

function isWithCondition(cid)

for i = 1, #injuries2 do

if getPlayerStorageValue(cid, injuries2.m) >= 1 then

return true

end

end

return false

end

---------------------------------

function doCureBallStatus(item, type)

if not type or type == "all" then

for b = 1, #injuries2 do

doItemSetAttribute(item, ""..injuries2.n.."", -1)

end

else

doItemSetAttribute(item, ""..type.."", -1)

end

end

---------------------------------

function isBurning(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Burn"]) >= 0 then return true end

return false

end

function isPoisoned(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Poison"]) >= 0 then return true end

return false

end

function isSilence(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Silence"]) >= 0 then return true end

return false

end

function isParalyze(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Paralyze"]) >= 0 then return true end

return false

end

 

function isSleeping(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Sleep"]) >= 0 then return true end

return false

end

function isWithFear(cid)

if not isCreature(cid) then return false end

if getPlayerStorageValue(cid, conds["Fear"]) >= 0 then return true end

return false

end

-----------------------------------

function doMoveInArea2(cid, eff, area, element, min, max, spell, ret)

if not isCreature(cid) then return true end

if spell and spell == "Mud Bomb" then

pos = getPosfromArea(getMasterTarget(cid), area)

else

pos = getPosfromArea(cid, area)

end

setPlayerStorageValue(cid, 21101, -1) --alterado v1.6

 

local skills = {"Skull Bash", "Gust", "Water Pulse", "Stick Throw", "Overheat", "Toxic", "Take Down"}

local n = 0

local l = 0

while n < #pos do

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

n = n+1

thing = {x=pos[n].x,y=pos[n].y,z=pos[n].z,stackpos=253}

local pid = getThingFromPosWithProtect(thing)

----

if pid ~= cid then

if spell and isInArray(skills, spell) then

if spell == "Stick Throw" then

addEvent(sendEffWithProtect, l*300, cid, pos[n], eff)

addEvent(sendMoveBack, 1200, cid, pos, eff, min, max)

addEvent(doMoveDano2, l*300, cid, pid, element, min, max, ret, spell) --alterado v1.6

else

addEvent(sendEffWithProtect, l*200, cid, pos[n], eff)

addEvent(doMoveDano2, l*200, cid, pid, element, min, max, ret, spell) --alterado v1.6

end

elseif spell and spell == "Epicenter" then

local random = math.random(50, 500)

addEvent(sendEffWithProtect, random, cid, pos[n], eff)

addEvent(doDanoWithProtect, random, cid, GROUNDDAMAGE, pos[n], crusher, -min, -max, 255)

elseif spell and spell == "Shadowave" then

posi = {x=pos[n].x, y=pos[n].y+1, z=pos[n].z}

sendEffWithProtect(cid, posi, eff)

doMoveDano2(cid, pid, element, min, max, ret, spell) --alterado v1.6

elseif spell and spell == "Surf" then

addEvent(sendEffWithProtect, math.random(50, 500), cid, pos[n], eff)

addEvent(doMoveDano2, 400, cid, pid, element, min, max, ret, spell) --alterado v1.6

elseif spell and spell == "Sand Attack" then

addEvent(sendEffWithProtect, n*200, cid, pos[n], eff)

addEvent(doMoveDano2, n*200, cid, pid, element, min, max, ret, spell) --alterado v1.6

elseif spell and (spell == "Muddy Water" or spell == "Venom Motion") then

local arr = {

[1] = 0, [2] = 0, [3] = 0, [4] = 200, [5] = 200, [6] = 200, [7] = 400, [8] = 400, [9] = 400, [10] = 600, [11] = 600,

[12] = 600, [13] = 800, [14] = 800, [15] = 800

}

local time = {0, 200, 400, 600, 800}

 

addEvent(sendEffWithProtect, arr[n], cid, pos[n], eff)

addEvent(doMoveDano2, arr[n], cid, pid, element, min, max, ret, spell)

elseif spell and (spell == "Inferno" or spell == "Fissure") then

addEvent(sendEffWithProtect, math.random(0, 500), cid, pos[n], eff)

addEvent(doMoveDano2, math.random(0, 500), cid, pid, element, min, max, ret, spell)

else

sendEffWithProtect(cid, pos[n], eff)

doMoveDano2(cid, pid, element, min, max, ret, spell)

end

end

l = l+1

end

end

-------------------------------------------

function doMoveDano2(cid, pid, element, min, max, ret, spell)

if isCreature(pid) and isCreature(cid) and cid ~= pid then

if isNpcSummon(pid) and getCreatureTarget(pid) ~= cid then

return true --alterado v1.6

end

if ehNPC(pid) then return true end

---

local canAtk = true --alterado v1.6

if getPlayerStorageValue(pid, 21099) >= 1 then

doSendMagicEffect(getThingPosWithDebug(pid), 135)

doSendAnimatedText(getThingPosWithDebug(pid), "REFLECT", COLOR_GRASS)

addEvent(docastspell, 100, pid, spell)

if getCreatureName(pid) == "Wobbuffet" then

doRemoveCondition(pid, CONDITION_OUTFIT)

end

canAtk = false

setPlayerStorageValue(pid, 21099, -1)

setPlayerStorageValue(pid, 21100, 1)

setPlayerStorageValue(pid, 21101, cid)

setPlayerStorageValue(pid, 21103, getTableMove(cid, getPlayerStorageValue(cid, 21102)).f)

end

---

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isSummon(cid) and (ehMonstro(pid) or (isSummon(pid) and canAttackOther(cid, pid) == "Can") or (isPlayer(pid) and canAttackOther(cid, pid) == "Can" and #getCreatureSummons(pid) <= 0)) and pid ~= cid then

if canAtk then --alterado v1.6

if ret and ret.cond then

ret.id = pid

ret.check = getPlayerStorageValue(pid, conds[ret.cond])

doCondition2(ret)

end

if spell == "Selfdestruct" then

if getPlayerStorageValue(pid, 9658783) <= 0 then

doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)

doCreatureAddHealth(pid, -max) --alterado v1.6

end

else

doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)

end

end

elseif ehMonstro(cid) and (isSummon(pid) or (isPlayer(pid) and #getCreatureSummons(pid) <= 0)) and pid ~= cid then

if canAtk then --alterado v1.6

if ret and ret.cond then

ret.id = pid

ret.check = getPlayerStorageValue(pid, conds[ret.cond])

doCondition2(ret)

end

if spell == "Selfdestruct" then

if getPlayerStorageValue(pid, 9658783) <= 0 then

doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)

doCreatureAddHealth(pid, -max) --alterado v1.6

end

else

doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)

end

end

elseif isPlayer(cid) and ehMonstro(pid) and pid ~= cid then

if canAtk then --alterado v1.6

if ret and ret.cond then

ret.id = pid

ret.check = getPlayerStorageValue(pid, conds[ret.cond])

doCondition2(ret)

end

if spell == "Selfdestruct" then

if getPlayerStorageValue(pid, 9658783) <= 0 then

doSendAnimatedText(getThingPosWithDebug(pid), "-"..max.."", COLOR_NORMAL)

doCreatureAddHealth(pid, -max) --alterado v1.6

end

else

doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255)

end

end

end

end

end

--------------------------------------------------------------------------------

function sendEffWithProtect(cid, pos, eff) --Manda algum magic effect com proteçoes

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

local checkpos = pos

checkpos.stackpos = 0

if not hasTile(checkpos) then

return true

end

if not canWalkOnPos2(pos, false, true, false, true, false) then --alterado v1.6

return true

end

doSendMagicEffect(pos, eff)

end

---------------------------------------------------------------------------------

function getThingPosWithDebug(what)

if not isCreature(what) or getCreatureHealth(what) <= 0 then

return {x = 1, y = 1, z = 10}

end

return getThingPos(what)

end

---------------------------------------------------------------------------------

function doDanoWithProtect(cid, element, pos, area, min, max, eff) --Da dano com proteçoes

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

doAreaCombatHealth(cid, element, pos, area, -(math.abs(min)), -(math.abs(max)), eff)

end

---------------------------------------------------------------------------------

function doDanoWithProtectWithDelay(cid, target, element, min, max, eff, area)

const_distance_delay = 56

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if target ~= 0 and isCreature(target) and not area then

delay = getDistanceBetween(getThingPosWithDebug(cid), getThingPosWithDebug(target)) * const_distance_delay

addEvent(doDanoWithProtect, delay, cid, element, getThingPosWithDebug(target), 0, min, max, eff)

return true

end

addEvent(doDanoWithProtect, 200, cid, element, getThingPosWithDebug(target), area, min, max, eff)

end

--------------------------------------------------------------------------------

function sendDistanceShootWithProtect(cid, frompos, topos, eff) --Manda um efeito de distancia com proteçoes

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

doSendDistanceShoot(frompos, topos, eff)

end

---------------------------------------------------------------------------------

function sendMoveBack(cid, pos, eff, min, max) --Manda o Atk do farfetchd de volta...

local m = #pos+1

for i = 1, #pos do

if not isCreature(cid) then return true end

---

m = m-1

thing = {x=pos[m].x,y=pos[m].y,z=pos[m].z,stackpos=253}

local pid = getThingFromPosWithProtect(thing)

addEvent(doMoveDano2, i*200, cid, pid, FLYINGDAMAGE, min/4, max/4)

addEvent(sendEffWithProtect, i*200, cid, pos[m], eff) --alterado v1.3

--

end

end

---------------------------------------------------------------------------------

function upEffect(cid, effDis)

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

pos = getThingPos(cid)

frompos = {x = pos.x+1, y = pos.y, z = pos.z}

frompos.x = pos.x - math.random(4, 7)

frompos.y = pos.y - math.random(5, 8)

doSendDistanceShoot(getThingPos(cid), frompos, effDis)

end

---------------------------------------------------------------------------------

function fall(cid, master, element, effDis, effArea) --Function pra jogar efeitos pra cima e cair depois... tpw falling rocks e blizzard

if isCreature(cid) then

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

pos = getThingPos(cid)

pos.x = pos.x + math.random(-4,4)

pos.y = pos.y + math.random(-4,4)

if isMonster(cid) or isPlayer(cid) then

frompos = {x = pos.x+1, y = pos.y, z = pos.z}

elseif isSummon(cid) then

frompos = getThingPos(master)

end

frompos.x = pos.x - 7

frompos.y = pos.y - 6

if effDis ~= -1 then --alterado!

doSendDistanceShoot(frompos, pos, effDis)

end

doAreaCombatHealth(cid, element, pos, 0, 0, 0, effArea)

end

end

---------------------------------------------------------------------------------

function canDoMiss(cid, nameAtk) --alterado v1.5

local atkTerra = {"Sand Attack", "Mud Shot", "Mud Bomb", "Stomp", "Crusher Stomp", "Mud Slap"}

local atkElectric = {"Electric Storm", "Thunder Wave", "Thunder", "Electricity"} --alterado v1.6

if not isCreature(cid) then return false end

if isPlayer(cid) then return true end

if not pokes[getCreatureName(cid)] then return true end

if isInArray(atkTerra, nameAtk) then

if (pokes[getCreatureName(cid)].type == "flying") or (pokes[getCreatureName(cid)].type2 == "flying") or isInArray(specialabilities["levitate"], getCreatureName(cid)) then

return false

end

elseif isInArray(atkElectric, nameAtk) then

if (pokes[getCreatureName(cid)].type == "ground") or (pokes[getCreatureName(cid)].type2 == "ground") then

return false

end

end

return true

end

---------------------------------------------------------------------------------

function doMoveInAreaMulti(cid, effDis, effMagic, areaEff, areaDano, element, min, max)

if not isCreature(cid) then return true end --Da um atk com efeito tpw Multi-Kick e Bullet Seed

local pos = getPosfromArea(cid, areaEff)

local pos2 = getPosfromArea(cid, areaDano)

local n = 0

while n < #pos2 do

if not isCreature(cid) then return true end

if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end

n = n+1

thing = {x=pos2[n].x,y=pos2[n].y,z=pos2[n].z,stackpos=253}

if n < #pos then

addEvent(sendDistanceShootWithProtect, 50, cid, getThingPos(cid), pos[n], effDis) --39

addEvent(sendEffWithProtect, 100, cid, pos[n], effMagic) -- 112

--- --alterado v1.6.1

if math.random(1, 2) == 2 then

addEvent(sendDistanceShootWithProtect, 450, cid, getThingPos(cid), pos[n], effDis) --550

addEvent(sendEffWithProtect, 550, cid, pos[n], effMagic) -- 650

end

end

local pid = getThingFromPosWithProtect(thing)

if isCreature(pid) then

local ret = {}

doMoveDano2(cid, pid, element, min, max, ret, getPlayerStorageValue(cid, 21102))

end

end

end

---------------------------------------------------------------------------------------

function doDoubleHit(cid, pid, valor, races) --alterado v1.6

if isCreature(cid) and isCreature(pid) then

if getPlayerStorageValue(cid, 374896) >= 1 then

if getMasterTarget(cid) == pid then

if isInArray({"Kadabra", "Alakazam", "Mew", "Shiny Abra", "Shiny Alakazam"}, getCreatureName(cid)) then

doSendDistanceShoot(getThingPosWithDebug(cid), getThingPosWithDebug(pid), 39)

end

if isSummon(cid) then

doTargetCombatHealth(getCreatureMaster(cid), pid, PHYSICALDAMAGE, -math.abs(valor), -math.abs(valor), 255)

else

doCreatureAddHealth(pid, -math.abs(valor), 3, races[getMonsterInfo(getCreatureName(pid)).race].cor)

end

end

end

end

end

 

 

 

Tenta isso ae

vou testa !!

 

Se der serto Avisa =)

Link para o comentário
Compartilhar em outros sites

  • 5 years later...
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...