Condition não pegar em determinados "types" de pokemon

jeanflamengo
em Programação

jeanflamengo

[> ObservandU essa bagaÇa <]
avatar
Barão
Barão

INFOS

Grupo: BarãoRegistrado: 31/07/09Posts: 205Gênero: Masculino

Bnoite eu estava tentando fazer uma determinada spell não "dar" o disable caso o target seja de determinado elemento (type) porém não consegui fazer tem hora que pega em todos e tem hora que não pega em nenhum. Deixarei o código abaixo e gostaria da ajuda de alguma boa alma

 



    doSendDistanceShoot(getThingPosWithDebug(cid), getThingPosWithDebug(target), 32)
    
    if isSummon(target) or ehMonstro(target) and pokes[getCreatureName(target)] then --alterado v1.6
       local type = pokes[getCreatureName(target)].type
       local type2 = pokes[getCreatureName(target)].type2
       if isInArray({"ghost"}, type) or isInArray({"ghost"}, type2) then
        local ret = {}
        ret.id = target
        ret.cd = 0
        ret.check = 0
        ret.spell = spell
        ret.cond = ""    
    else
        local ret = {}
        ret.id = target
        ret.cd = 5
        ret.check = 0
        ret.spell = spell
        ret.cond = "Confusion"
        end    
    end
    
    addEvent(doMoveDano2, 100, cid, target, NORMALDAMAGE, 0, 0, ret, spell)

nociam

avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 04/02/13Posts: 541Gênero: Masculino
    doSendDistanceShoot(getThingPosWithDebug(cid), getThingPosWithDebug(target), 32)
    local type = isInArray({"ghost"}, pokes[getCreatureName(target)].type) 
    local type2 = isInArray({"ghost"}, pokes[getCreatureName(target)].type2)
    local retConf = {}

    if  not type or not type2 then
        retConf = {id = target, cd = 5, check = 0, spell = spell, cond = "Confusion"}
    end 

    addEvent(doMoveDano2, 100, cid, target, NORMALDAMAGE, 0, 0, retConf, spell) 

 

jeanflamengo

[> ObservandU essa bagaÇa <]
avatar
Barão
Barão

INFOS

Grupo: BarãoRegistrado: 31/07/09Posts: 205Gênero: Masculino
Em 11/04/2020 em 22:43, nociam disse:
    doSendDistanceShoot(getThingPosWithDebug(cid), getThingPosWithDebug(target), 32)
    local type = isInArray({"ghost"}, pokes[getCreatureName(target)].type) 
    local type2 = isInArray({"ghost"}, pokes[getCreatureName(target)].type2)
    local retConf = {}

    if  not type or not type2 then
        retConf = {id = target, cd = 5, check = 0, spell = spell, cond = "Confusion"}
    end 

    addEvent(doMoveDano2, 100, cid, target, NORMALDAMAGE, 0, 0, retConf, spell) 

 

agradeço a ajuda porém os pokemons ghost e não ghosts continuam tomando o "confusion".

 

#edit

 

ambos abaixo funcionaram, deixarei em spoiler para caso alguem queira. Obg mano pela ajuda


    doSendDistanceShoot(getThingPosWithDebug(cid), getThingPosWithDebug(target), 32)
    local retConf = {}
    
    if isGhostPokemon(target) then
        retConf = {id = target, cd = 5, check = 0, spell = spell, cond = ""}
    else
        retConf = {id = target, cd = 5, check = 0, spell = spell, cond = "Confusion"}
    end

    addEvent(doMoveDano2, 100, cid, target, NORMALDAMAGE, 0, 0, retConf, spell) 

 


        doSendDistanceShoot(getThingPosWithDebug(cid), getThingPosWithDebug(target), 32)
    local retConf = {}
    if (pokes[getCreatureName(target)].type == "ghost") or (pokes[getCreatureName(target)].type2 == "ghost") then
        return false
    else
        retConf = {id = target, cd = 5, check = 0, spell = spell, cond = "Confusion"}
    end

    addEvent(doMoveDano2, 100, cid, target, NORMALDAMAGE, 0, 0, retConf, spell)