Apesar de ter feito este código faz um tempo, suponho que ainda esteja funcionando como deve.
Para base PDA:
if valor >= getCreatureHealth(cid) then
if isInArray(cannotKill, combat) and isPlayer(cid) then
valor = getCreatureHealth(cid) - 1
else
valor = getCreatureHealth(cid)
end
endlocal config = {
sturdy = { --Pokémons que possuem a habilidade Sturdy. Configuração: ["nome_do_pokemon"] = lookType,
["Aggron"] = lookType,
},
cd = 30, --Cooldown da habilidade.
duration = 8, --Duração, em segundos, do Sturdy.
storage = 8402,
}
if getPlayerStorageValue(cid, config.storage) > -1 then
return false
end
local hp = getCreatureHealth(cid) - valor
if not isPlayer(cid) and hp <= 1 and config.sturdy[getCreatureName(cid)] then
local b = true
if isSummon(cid) then
local ball = getPlayerSlotItem(getCreatureMaster(cid), 8)
if ball and getCD(ball.uid, "sturdy") > 0 then
b = false
end
end
if b then
if hp < 1 then
doCreatureAddHealth(cid, hp < 0 and (hp * -1) + 1 or 1)
end
setPlayerStorageValue(cid, config.storage, 1)
if isSummon(cid) then
local ball = getPlayerSlotItem(getCreatureMaster(cid), 8)
if ball then
setCD(ball.uid, "sturdy", config.duration + config.cd)
end
end
doSetCreatureOutfit(cid, {lookType = config.sturdy[getCreatureName(cid)]}, config.duration * 1000)
addEvent(function()
if isCreature(cid) and getPlayerStorageValue(cid, config.storage) > -1 then
setPlayerStorageValue(cid, config.storage, -1)
doCreatureAddHealth(cid, -getCreatureHealth(cid))
end
end, config.duration * 1000)
end
end
if valor >= getCreatureHealth(cid) then
if isInArray(cannotKill, combat) and isPlayer(cid) then
valor = getCreatureHealth(cid) - 1
else
valor = getCreatureHealth(cid)
end
enddoCreatureAddHealth(cid, -damage, 15, COLOR_BURN)
if getPlayerStorageValue(cid, 8402) == -1 then
doCreatureAddHealth(cid, -damage, 15, COLOR_BURN)
enddoCreatureAddHealth(cid, -dano, 8, COLOR_GRASS)
if getPlayerStorageValue(cid, 8402) == -1 then
doCreatureAddHealth(cid, -dano, 8, COLOR_GRASS)
enddoCreatureAddHealth(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)
endif getPlayerStorageValue(cid, 8402) == -1 then
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
end









info
Grupo: Conde
Registrado: 15/06/15
Posts: 729
Reputação: +200
Explicação da spell: Sturdy: É uma passive muito interessante, Aggron resiste até o ultimo momento por seu treinador, quando ele ficar com 1 de vida, sua coloração muda, e ele resiste por 8 segundos antes de ser derrotado. Essa habilidade pode ser muito util, onde Aggron resiste a combos muito poderosos, ou até mesmo para carregar algum cd e finalizar o inimigo.