Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onStatsChange(cid, attacker, type, combat, value)
- local attackername = getPokemonName(attacker)
- local hit = 1
- --// Edited pvp system
- if not canAttackOther(attacker, cid) and (isSummon(cid) or isPlayer(cid)) then -- parte do duel e qualquer outra coisa q tenha pvp
- return true -- aqui acho q vou ter q rever
- end
- --// Edited pvp system
- if isCreature(cid) then
- if (isSummon(cid) and isPlayer(getCreatureMaster(cid)) and isWild(attacker)) or (isSummon(attacker) and isPlayer(getCreatureMaster(attacker)) and isWild(cid)) or (isPlayer(cid) and isWild(attacker)) then
- if(getPlayerStorageValue(attacker, storages.GRRRRSto) <= 0) and isPlayer(cid) then return false end
- --// Edited pvp system
- if not canAttackOther(attacker, cid) and isSummon(attacker) and (isSummon(cid) or isPlayer(cid)) then -- parte do duel e qualquer outra coisa q tenha pvp
- return true
- end
- --// Edited pvp system
- if combat == STATUS_SLEEP then
- setPokemonStatus(cid, "sleep", value, 0, true, attacker)
- return true
- elseif combat == STATUS_STUN then
- setPokemonStatus(cid, "stun", value, 0, true, attacker)
- return true
- elseif combat == STATUS_STRING then
- setPokemonStatus(cid, "string", value, 0, true, attacker)
- return true
- elseif combat == STATUS_BLIND then
- setPokemonStatus(cid, "blind", value, 0, true, attacker)
- return true
- elseif combat == STATUS_CONFUSION10 or combat == STATUS_CONFUSION7 then
- setPokemonStatus(cid, "confusion", (combat == STATUS_CONFUSION10 and 10 or 7), value, true, attacker)
- return true
- elseif combat == STATUS_POISON20 or combat == STATUS_POISON10 or combat == STATUS_POISON5 then
- setPokemonStatus(cid, "poison", (combat == STATUS_POISON5 and 5 or combat == STATUS_POISON10 and 10 or 20), value, true, attacker)
- return true
- elseif combat == STATUS_BURN5 or combat == STATUS_BURN10 then
- setPokemonStatus(cid, "burn", (combat == STATUS_BURN5 and 5 or 10), value, true, attacker)
- return true
- elseif combat == STATUS_LEECHSEED then
- setPokemonStatus(cid, "leechSeed", 20, value, true, attacker)
- return true
- elseif combat == STATUS_FEAR then
- setPokemonStatus(cid, "fear", value, 0, true, attacker)
- return true
- elseif combat == STATUS_SLOW then
- setPokemonStatus(cid, "speedDown", value, 0, true, attacker)
- return true
- elseif combat == STATUS_SILENCE then
- setPokemonStatus(cid, "silence", 8, value, true, attacker)
- return true
- end
- end
- if ((isSummon(cid) or isPlayer(cid))) or (isWild(cid) and isWild(attacker)) then
- if combat == COMBAT_HEAL then
- local heal = value
- if getCreatureHealth(cid) + value > getCreatureMaxHealth(cid) then
- heal = getCreatureMaxHealth(cid) - getCreatureHealth(cid)
- end
- if heal > 0 then
- doSendAnimatedText(getThingPos(cid), "+"..heal, 35)
- doCreatureAddHealth(cid, heal)
- end
- if isSummon(cid) then
- doOTCSendPokemonHealth(getCreatureMaster(cid))
- end
- return true
- end
- end
- end
- if isSummon(cid) and isPlayer(getCreatureMaster(cid)) and (isWild(attacker) or isSummon(attacker)) then --- Wild poke ataca
- local master = getCreatureMaster(cid)
- for i = 1, #silenceStatus do
- if getPokemonStatus(attacker, silenceStatus[i]) then return true end
- end
- if getCreatureCondition(cid, CONDITION_INVISIBLE) then return true end
- local modifier = 1.2 * getMultiplier(COMBAT_NAMES[combat], cid)
- local defPercent = 1 - (getPokemonDefense(getCreatureName(cid))/255)
- hit = math.ceil((value * defPercent) * modifier)
- if getPokemonStatus(cid, "harden") then
- hit = math.ceil(hit * 0.75)
- end
- if isCreature(cid) and tonumber(getCreatureHealth(cid)) - hit <= 0 then
- hit = getCreatureHealth(cid)
- end
- doSendMagicEffect(getThingPos(cid), COMBAT_EFFECTS[combat])
- if combat == ABSORB_GRASS or combat == ABSORB_POISON or combat == ABSORB_NORMAL or combat == ABSORB_BUG then
- doSendAnimatedText(getThingPos(cid), "-"..hit, 180)
- doSendAnimatedText(getThingPos(attacker), "+"..hit, 35)
- doCreatureAddHealth(cid, -hit, 255, 255, attacker)
- doCreatureAddHealth(attacker, hit)
- else
- doCreatureAddHealth(cid, -hit, 2, COMBAT_COLORS[combat], attacker)
- end
- doPlayerSendCancel(master, "Seu pokemon perdeu "..hit.." pontos de vida devido a um ataque de um "..attackername..".")
- if isCreature(cid) and isUsingPotion(cid) then
- setPlayerStorageValue(cid, storages.potion, -1)
- doSendAnimatedText(getThingPos(cid), "LOST HEAL", COLOR_RED)
- end
- if isCreature(cid) and tonumber(getCreatureHealth(cid)) - hit > 0 then
- doOTCSendPokemonHealth(master)
- end
- return true
- elseif isSummon(attacker) and isPlayer(getCreatureMaster(attacker)) and (isWild(cid)) then --- Poke summon ataca
- local master = getCreatureMaster(attacker)
- for i = 1, #silenceStatus do
- if getPokemonStatus(attacker, silenceStatus[i]) then return true end
- end
- if getCreatureCondition(cid, CONDITION_INVISIBLE) then return true end
- local modifier = tableFome[getFeedStatus(attacker)].hitMultiplier * getMultiplier(COMBAT_NAMES[combat], cid) * getPlayerFightModeOffense(master)
- local defPercent = 1 - (getPokemonDefense(getCreatureName(cid))/255)
- hit = math.ceil((value * defPercent) * modifier)
- if getPokemonStatus(cid, "harden") then
- hit = math.ceil(hit * 0.75)
- end
- if isCreature(cid) and tonumber(getCreatureHealth(cid)) - hit <= 0 then
- hit = getCreatureHealth(cid)
- end
- doSendMagicEffect(getThingPos(cid), COMBAT_EFFECTS[combat])
- if combat == ABSORB_GRASS or combat == ABSORB_POISON or combat == ABSORB_NORMAL or combat == ABSORB_BUG then
- doSendAnimatedText(getThingPos(cid), "-"..hit, 180)
- doSendAnimatedText(getThingPos(attacker), "+"..hit, 35)
- doCreatureAddHealth(cid, -hit, 255, 255, attacker)
- doCreatureAddHealth(attacker, hit)
- doOTCSendPokemonHealth(master)
- else
- doCreatureAddHealth(cid, -hit, 2, COMBAT_COLORS[combat], attacker)
- end
- return true
- elseif isPlayer(cid) then
- if getPlayerStorageValue(attacker, storages.GRRRRSto) <= 0 then return true end
- for i = 1, #silenceStatus do
- if getPokemonStatus(attacker, silenceStatus[i]) then return true end
- end
- if getCreatureCondition(cid, CONDITION_INVISIBLE) then return true end
- hit = math.ceil((value/2) * 1.2)
- if isCreature(cid) and tonumber(getCreatureHealth(cid)) - hit <= 0 then
- hit = getCreatureHealth(cid)
- end
- doSendMagicEffect(getThingPos(cid), COMBAT_EFFECTS[combat])
- if combat == ABSORB_GRASS or combat == ABSORB_POISON or combat == ABSORB_NORMAL or combat == ABSORB_BUG then
- doSendAnimatedText(getThingPos(cid), "-"..hit, 180)
- doSendAnimatedText(getThingPos(attacker), "+"..hit, 35)
- doCreatureAddHealth(cid, -hit, 255, 255, attacker)
- doCreatureAddHealth(attacker, hit)
- else
- doCreatureAddHealth(cid, -hit, 2, COMBAT_COLORS[combat], attacker)
- end
- doPlayerSendCancel(cid, "VocĂȘ perdeu "..hit.." pontos de vida devido a um ataque de um "..attackername..".")
- return true
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment