Ir para conteúdo
  • 0

Magia Confusion by Slicer


nociam

Pergunta

Bom depois de muito tempo um amigo arrumo o meu orden pelas souces, ai vem minha duvida quem tem pda pode me ajudar se souber

como funciona exatamente a magia do confusion pois quanto o pokemon fica confuso ele fica com o mesmo problema do orden travando, gostaria de saber como funciona e aonde devo mexer pra resolver isso.

Antes que perguntem nao e pda, mas com as mesmas magias do pda.

 

video pra mostrar melhor

 

 

pokemon move

 

elseif spell == "Confusion" or spell == "Night Shade" then

local rounds = math.random(4, 7)
rounds = rounds + math.floor(getPokemonLevel(cid) / 35)

if spell == "Confusion" then
dano = psyDmg
effConfusion = 136
else
dano = ghostDmg
effConfusion = 182
end

local ret = {}
ret.id = 0
ret.check = 0
ret.cd = rounds
ret.cond = "Confusion"

doMoveInArea2(cid, effConfusion, selfArea1, dano, min, max, spell, ret)

 

 

domoveinarea2

 

function doMoveInArea2(cid, eff, area, element, min, max, spell, ret)
if not isCreature(cid) then return true end

local pos = getPosfromArea(cid, area) --alterado v1.8
setPlayerStorageValue(cid, 21101, -1)

local skills = {"Skull Bash", "Gust", "Water Pulse", "Stick Throw", "Overheat", "Toxic", "Take Down", "Gyro Ball"}
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, 0)
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" or spell == "Volcano Burst") 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

 

 

domovedano2

 

 

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
end
if ehNPC(pid) then return true end
--------------------REFLECT-----------------------
local canAtk = true
if getPlayerStorageValue(pid, 21099) >= 1 then
if isInArray({223, 331, 502, 219, 1183, 1184}, getCreatureOutfit(cid).lookType) then return true end
Wobbuffet2(pid)
doSendMagicEffect(getThingPosWithDebug(pid), WobbuEff)
doSendAnimatedText(getThingPosWithDebug(pid), "REFLECT", 215)
addEvent(docastspell, 100, pid, spell)
addEvent(Wobbuffet1, 550, pid)
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)
end
else
doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 0)
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)
end
else
doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 0)
end
end
elseif isPlayer(cid) and ehMonstro(pid) and pid ~= cid then
if canAtk then
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)
end
else
doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 0)
end
end
end
end
end

 

 

getThingFromPosWithProtect

 

 

function getThingFromPosWithProtect(pos) --Pega uma creatura numa posiçao com proteçoes
if hasTile(pos) then
if isCreature(getRecorderCreature(pos)) then
return getRecorderCreature(pos)
else
pos.stackpos = 253
pid = getThingfromPos(pos).uid
end
else
pid = getThingfromPos({x=1,y=1,z=10,stackpos=253}).uid
end
return pid
end

 

 

getRecorderCreature

 

 

function getRecorderCreature(pos, cid)
local ret = 0
if cid and isPosEqual(getThingPos(cid), pos) then --alterado v1.9
return cid
end
local s = {}
s.x = pos.x
s.y = pos.y
s.z = pos.z
for a = 0, 255 do
s.stackpos = a
local b = getTileThingByPos(s).uid
if b > 1 and isCreature(b) and getCreatureOutfit(b).lookType ~= 814 then
ret = b
end
end
return ret
end

 

 

getPosfromArea

 

 

------------------ Function getPosfromArea(cid,area) by Dokmos ------------------
function getPosfromArea(cid,area)
icenter = math.floor(table.getn(area)/2)+1
jcenter = math.floor(table.getn(area[1])/2)+1
center = area[icenter]
ivar = table.getn(area)
jvar = table.getn(area[1])
i = table.getn(area)^2
j = table.getn(area[1])^2

local mydir = isCreature(getMasterTarget(cid)) and getCreatureDirectionToTarget(cid, getMasterTarget(cid)) or getCreatureLookDir(cid)
setPlayerStorageValue(cid, 21101, -1) --alterado v1.6

if center[jcenter] == 3 then
if mydir == 0 then
signal = {-1,1,1,2}
elseif mydir == 1 then
signal = {1,-1,2,1}
elseif mydir == 2 then
signal = {1,-1,1,2}
elseif mydir == 3 then
signal = {-1,1,2,1}
end
else
signal = {-1,1,1,2}
end

POSITIONS = {}
P = 0

repeat
pvar = {0,0}
I = area[ivar]
J = I[jvar]
i = i-1
j = j-1
if J == 1 then
if jvar < jcenter then
pvar[signal[3]] = signal[1]*math.abs((jcenter-jvar))
elseif jvar > jcenter then
pvar[signal[3]] = signal[2]*math.abs((jcenter-jvar))
end

if ivar < icenter then
pvar[signal[4]] = signal[1]*math.abs((icenter-ivar))
elseif ivar > icenter then
pvar[signal[4]] = signal[2]*math.abs((icenter-ivar))
end
end
if jvar > 1 then
jvar = (jvar-1)
elseif ivar > 1 then
jvar = table.getn(area[1])
ivar = (ivar-1)
end
local pos = getThingPos(cid)
local areapos = {x=pos.x+(pvar[1]),y=pos.y+(pvar[2]),z=pos.z}

if pos.x ~= areapos.x or pos.y ~= areapos.y then
P = P+1
POSITIONS[P] = areapos
end

until i <= 0 and j <= 0

return POSITIONS
end

 

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

5 respostass a esta questão

Posts Recomendados

  • 0

hã... na funçao q acabei de te flar? u,U

 

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
Link para o comentário
Compartilhar em outros sites

  • 0

 

a funçao q executa o confusion esta em lib/newStatusSyst.lua e eh a funçao:

function doConfusion2(cid, cd, check)

Mas aonde faz ele se teleportar daquele jeito.

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...