local PASSIVE_LEVEL = 00 local COMBAT_TYPES = { [COMBAT_ENERGYDAMAGE] = COMBAT_ENERGYDAMAGE, [COMBAT_EARTHDAMAGE] = COMBAT_EARTHDAMAGE, [COMBAT_FIREDAMAGE] = COMBAT_FIREDAMAGE, [COMBAT_ICEDAMAGE] = COMBAT_ICEDAMAGE, [COMBAT_HOLYDAMAGE] = COMBAT_HOLYDAMAGE, [COMBAT_DEATHDAMAGE] = COMBAT_DEATHDAMAGE } local function isWalkable(item) if item then if item.uid > 0 and item.uid <= 65535 then return false end end return true end local function onGetPassivas(player, id) if player:getStorageValue(_SYSTEM.POINTS_ATR[01]) == id then PASSIVE_LEVEL = player:getStorageValue(_SYSTEM.POINTS_ATR[08]) return true elseif player:getStorageValue(_SYSTEM.POINTS_ATR[02]) == id then PASSIVE_LEVEL = player:getStorageValue(_SYSTEM.POINTS_ATR[09]) return true elseif player:getStorageValue(_SYSTEM.POINTS_ATR[03]) == id then PASSIVE_LEVEL = player:getStorageValue(_SYSTEM.POINTS_ATR[10]) return true elseif player:getStorageValue(_SYSTEM.POINTS_ATR[04]) == id then PASSIVE_LEVEL = player:getStorageValue(_SYSTEM.POINTS_ATR[11]) return true elseif player:getStorageValue(_SYSTEM.POINTS_ATR[05]) == id then PASSIVE_LEVEL = player:getStorageValue(_SYSTEM.POINTS_ATR[12]) return true elseif player:getStorageValue(_SYSTEM.POINTS_ATR[06]) == id then PASSIVE_LEVEL = player:getStorageValue(_SYSTEM.POINTS_ATR[13]) return true else PASSIVE_LEVEL = 00 return false end end function BombAround(cid, attacker, effect, combat) local creature = Player(cid) local min = creature:getLevel() / 3 local max = creature:getLevel() / 2 creature:setStorageValue(_PLAYER_INFO.DELAY, _PLAYER_INFO.SECONDS_DELAY) local POS = creature:getPosition() local POS1 = Position(POS.x, POS.y + 1, POS.z) POS1:sendMagicEffect(effect) local tile_1 = Tile(POS.x, POS.y + 1, POS.z) if tile_1 then if isWalkable(tile_1.uid) then local Target_1 = tile_1:getTopCreature() if Target_1 then if Target_1:isPlayer() then if creature:hasSecureMode() == true or Tile(Target_1:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_1:getStorageValue(_PVP_ROOM[00].TIME_ID) then else doTargetCombat(creature, Target_1, combat, -min, -max, effect) end else doTargetCombat(creature, Target_1, combat, -min, -max, effect) end end end end local POS2 = Position(POS.x - 1, POS.y + 1, POS.z) POS2:sendMagicEffect(effect) local tile_2 = Tile(POS.x - 1, POS.y + 1, POS.z) if tile_2 then if isWalkable(tile_2.uid) then local Target_2 = tile_2:getTopCreature() if Target_2 then if Target_2:isPlayer() then if creature:hasSecureMode() == true or Tile(Target_2:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_2:getStorageValue(_PVP_ROOM[00].TIME_ID) then else doTargetCombat(creature, Target_2, combat, -min, -max, effect) end else doTargetCombat(creature, Target_2, combat, -min, -max, effect) end end end end local POS3 = Position(POS.x - 1, POS.y, POS.z) POS3:sendMagicEffect(effect) local tile_3 = Tile(POS.x - 1, POS.y, POS.z) if tile_3 then if isWalkable(tile_3.uid) then local Target_3 = tile_3:getTopCreature() if Target_3 then if Target_3:isPlayer() then if creature:hasSecureMode() == true or Tile(Target_3:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_3:getStorageValue(_PVP_ROOM[00].TIME_ID) then else doTargetCombat(creature, Target_3, combat, -min, -max, effect) end else doTargetCombat(creature, Target_3, combat, -min, -max, effect) end end end end local POS4 = Position(POS.x - 1, POS.y - 1, POS.z) POS4:sendMagicEffect(effect) local tile_4 = Tile(POS.x - 1, POS.y - 1, POS.z) if tile_4 then if isWalkable(tile_4.uid) then local Target_4 = tile_4:getTopCreature() if Target_4 then if Target_4:isPlayer() then if creature:hasSecureMode() == true or Tile(Target_4:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_4:getStorageValue(_PVP_ROOM[00].TIME_ID) then else doTargetCombat(creature, Target_4, combat, -min, -max, effect) end else doTargetCombat(creature, Target_4, combat, -min, -max, effect) end end end end local POS5 = Position(POS.x, POS.y - 1, POS.z) POS5:sendMagicEffect(effect) local tile_5 = Tile(POS.x, POS.y - 1, POS.z) if tile_5 then if isWalkable(tile_5.uid) then local Target_5 = tile_5:getTopCreature() if Target_5 then if Target_5:isPlayer() then if creature:hasSecureMode() == true or Tile(Target_5:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_5:getStorageValue(_PVP_ROOM[00].TIME_ID) then else doTargetCombat(creature, Target_5, combat, -min, -max, effect) end else doTargetCombat(creature, Target_5, combat, -min, -max, effect) end end end end local POS6 = Position(POS.x + 1, POS.y - 1, POS.z) POS6:sendMagicEffect(effect) local tile_6 = Tile(POS.x + 1, POS.y - 1, POS.z) if tile_6 then if isWalkable(tile_6.uid) then local Target_6 = tile_6:getTopCreature() if Target_6 then if Target_6:isPlayer() then if creature:hasSecureMode() == true or Tile(Target_6:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_6:getStorageValue(_PVP_ROOM[00].TIME_ID) then else doTargetCombat(creature, Target_6, combat, -min, -max, effect) end else doTargetCombat(creature, Target_6, combat, -min, -max, effect) end end end end local POS7 = Position(POS.x + 1, POS.y, POS.z) POS7:sendMagicEffect(effect) local tile_7 = Tile(POS.x + 1, POS.y, POS.z) if tile_7 then if isWalkable(tile_7.uid) then local Target_7 = tile_7:getTopCreature() if Target_7 then if Target_7:isPlayer() then if creature:hasSecureMode() == true or Tile(Target_7:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_7:getStorageValue(_PVP_ROOM[00].TIME_ID) then else doTargetCombat(creature, Target_7, combat, -min, -max, effect) end else doTargetCombat(creature, Target_7, combat, -min, -max, effect) end end end end local POS8 = Position(POS.x + 1, POS.y + 1, POS.z) POS8:sendMagicEffect(effect) local tile_8 = Tile(POS.x + 1, POS.y + 1, POS.z) if tile_8 then if isWalkable(tile_8.uid) then local Target_8 = tile_8:getTopCreature() if Target_8 then if Target_8:isPlayer() then if creature:hasSecureMode() == true or Tile(Target_8:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_8:getStorageValue(_PVP_ROOM[00].TIME_ID) then else doTargetCombat(creature, Target_8, combat, -min, -max, effect) end else doTargetCombat(creature, Target_8, combat, -min, -max, effect) end end end end end function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) if _CHEATS.IMORTAL_MODE then creature:getPosition():sendMagicEffect(03) return false end if creature:getStorageValue(_SYSTEM.MAESTRIA[01]) == 02 then if creature:getStorageValue(_SYSTEM.MAESTRIA[04]) > 0 then if primaryType ~= 128 then if creature:isPlayer() then --local position = Position(creature:getPosition().x + 1, creature:getPosition().y + 1, creature:getPosition().z) creature:getPosition():sendMagicEffect(195) return false end end end end if creature:isPlayer() then if primaryType ~= 128 then -- Ignore health potions local DEF = creature:getStorageValue(_PLAYER_INFO.DEF) or 0 local ESQ = creature:getStorageValue(_PLAYER_INFO.ESQ) or 0 local FIRE = creature:getStorageValue(_PLAYER_INFO.FIRE) or 0 local ICE = creature:getStorageValue(_PLAYER_INFO.ICE) or 0 local ENERGY = creature:getStorageValue(_PLAYER_INFO.ENERGY) or 0 local EARTH = creature:getStorageValue(_PLAYER_INFO.EARTH) or 0 local DEATH = creature:getStorageValue(_PLAYER_INFO.DEATH) or 0 local ResPlayer = creature:getStorageValue(_PLAYER_INFO.RES_PLAYER) or 0 local ExtraDef = creature:getStorageValue(_PLAYER_INFO.EXTRA_DEF) or 0 local ExtraESQ = creature:getStorageValue(_PLAYER_INFO.EXTRA_ESQ) or 0 local ExtraMAG = creature:getStorageValue(_PLAYER_INFO.EXTRA_MAG) or 0 local CuraESQ = creature:getStorageValue(_PLAYER_INFO.CURA_ESQ) or 0 local FearPara = creature:getStorageValue(_PLAYER_INFO.FEAR_PARA) or 0 local BombFire = creature:getStorageValue(_PLAYER_INFO.BOMB_FIRE) or 0 local BombEnergy = creature:getStorageValue(_PLAYER_INFO.BOMB_ENERGY) or 0 local BombIce = creature:getStorageValue(_PLAYER_INFO.BOMB_ICE) or 0 local BombEarth = creature:getStorageValue(_PLAYER_INFO.BOMB_EARTH) or 0 local BombDeath = creature:getStorageValue(_PLAYER_INFO.BOMB_DEATH) or 0 local BombHoly = creature:getStorageValue(_PLAYER_INFO.BOMB_HOLY) or 0 local BombPhysical = creature:getStorageValue(_PLAYER_INFO.BOMB_PHYSICAL) or 0 local CancelInv = creature:getStorageValue(_PLAYER_INFO.CANCEL_INV) or 0 local CanPara = creature:getStorageValue(_PLAYER_INFO.CAN_PARA) or 0 local DmgHalf = creature:getStorageValue(_PLAYER_INFO.DMG_HALF) or 0 local ProtectPercent = 0 if onGetPassivas(creature, 62) then local HP_HIGH = 70 * (creature:getBaseMaxHealth() / 100) if creature:getHealth() > HP_HIGH then local Percent = _PASSIVES[62].POWER_BASE + (_PASSIVES[62].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[62].CATEGORY then Percent = Percent + _PASSIVES[62].BOOST end end DEF = DEF + Percent end end if onGetPassivas(creature, 50) then local HP_HIGH = 70 * (creature:getBaseMaxHealth() / 100) if creature:getHealth() > HP_HIGH then local Percent = _PASSIVES[50].POWER_BASE + (_PASSIVES[50].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[50].CATEGORY then Percent = Percent + _PASSIVES[50].BOOST end end ESQ = ESQ + Percent end end if creature:getStorageValue(_SYSTEM.PASSIVA[01]) > 00 then if onGetPassivas(creature, 09) then local Percent = _PASSIVES[09].POWER_BASE + (_PASSIVES[09].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[09].CATEGORY then Percent = Percent + _PASSIVES[09].BOOST end end ESQ = ESQ + Percent end end if creature:getStorageValue(_SYSTEM.PASSIVA[02]) > 00 then if onGetPassivas(creature, 19) then local Percent = _PASSIVES[19].POWER_BASE + (_PASSIVES[19].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[19].CATEGORY then Percent = Percent + _PASSIVES[19].BOOST end end DEF = DEF + Percent end end if creature:getStorageValue(_PLAYER_INFO.DELAY) <= 0 then if BombFire > 0 then if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then if attacker then if math.random(00, 150) <= BombFire then BombAround(creature, attacker, 16, COMBAT_FIREDAMAGE) end end end end if BombEnergy > 0 then if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then if attacker then if math.random(00, 150) <= BombEnergy then BombAround(creature, attacker, 12, COMBAT_ENERGYDAMAGE) end end end end if BombIce > 0 then if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then if attacker then if math.random(00, 150) <= BombIce then BombAround(creature, attacker, 43, COMBAT_ICEDAMAGE) end end end end if BombDeath > 0 then if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then if attacker then if math.random(00, 150) <= BombDeath then BombAround(creature, attacker, 18, COMBAT_DEATHDAMAGE) end end end end if BombEarth > 0 then if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then if attacker then if math.random(00, 150) <= BombEarth then BombAround(creature, attacker, 46, COMBAT_EARTHDAMAGE) end end end end if BombHoly > 0 then if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then if attacker then if math.random(00, 150) <= BombHoly then BombAround(creature, attacker, 40, COMBAT_HOLYDAMAGE) end end end end if BombPhysical > 0 then if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then if attacker then if math.random(00, 150) <= BombPhysical then BombAround(creature, attacker, 10, COMBAT_PHYSICALDAMAGE) end end end end if CanPara > 0 then if creature:getCondition(CONDITION_PARALYZE) then creature:setStorageValue(_PLAYER_INFO.DELAY, _PLAYER_INFO.SECONDS_DELAY) creature:removeCondition(CONDITION_PARALYZE) end end if CancelInv > 0 then if attacker then if attacker:getCondition(CONDITION_INVISIBLE) then creature:setStorageValue(_PLAYER_INFO.DELAY, _PLAYER_INFO.SECONDS_DELAY) attacker:removeCondition(CONDITION_INVISIBLE) end end end end local cid = creature:getId() if _BONUS_EXTRA_TABLE[cid] then local ID_BONUS = 32 if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then DEF = DEF + _BONUS_EXTRA_TABLE[cid][ID_BONUS] end ID_BONUS = 34 if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then FIRE = FIRE + _BONUS_EXTRA_TABLE[cid][ID_BONUS] end ID_BONUS = 35 if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then ICE = ICE + _BONUS_EXTRA_TABLE[cid][ID_BONUS] end ID_BONUS = 36 if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then EARTH = EARTH + _BONUS_EXTRA_TABLE[cid][ID_BONUS] end ID_BONUS = 37 if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then ENERGY = ENERGY + _BONUS_EXTRA_TABLE[cid][ID_BONUS] end ID_BONUS = 38 if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then DEATH = DEATH + _BONUS_EXTRA_TABLE[cid][ID_BONUS] end ID_BONUS = 44 if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then ESQ = ESQ + _BONUS_EXTRA_TABLE[cid][ID_BONUS] end end -- POWER MONSTER DG if attacker then if attacker:isMonster() then if attacker:getStorageValue(29937) > 00 then primaryDamage = primaryDamage * attacker:getStorageValue(29937) end end end -- POWER PLAYER VS PLAYER if attacker then if attacker:isPlayer() then DEF = 00 ESQ = ESQ / 02 end end -- CALCULANDO ESQUIVA local chanceESQ = math.random(1, 1000) if chanceESQ <= ESQ and primaryDamage > 0 and primaryType == 1 and creature:getStorageValue(_PLAYER_INFO.DELAY) <= 0 then if attacker then creature:getPosition():sendMagicEffect(4) creature:say("MISS", TALKTYPE_MONSTER_SAY) creature:setStorageValue(_SYSTEM.ATR_VALUES[01], 01) creature:setStorageValue(_PLAYER_INFO.DELAY, _PLAYER_INFO.SECONDS_DELAY) if CuraESQ > 0 then local HPCrit = math.floor(CuraESQ * (creature:getBaseMaxHealth() / 100)) doTargetCombat(0, creature, COMBAT_HEALING, HPCrit, HPCrit) end return false end else if attacker then if attacker:isMonster() then local master = attacker:getMaster() if master and master:isPlayer() then return false end end end -- ABSORVENDO DANO PHYSICAL if primaryType == 1 then if attacker then if attacker:isPlayer() then if creature:getStorageValue(_SYSTEM.POINTS_ATR[04]) > 0 then ResPlayer = ResPlayer + math.floor(creature:getStorageValue(_SYSTEM.POINTS_ATR[04]) / 5) end if primaryDamage <= ResPlayer then primaryDamage = 0 creature:getPosition():sendMagicEffect(CONST_ME_POFF) else primaryDamage = primaryDamage - ResPlayer end end end if primaryDamage <= DEF then primaryDamage = 0 creature:getPosition():sendMagicEffect(CONST_ME_POFF) else -- Passiva Menor Dano [Monster Classe] & Refletir if attacker then if attacker:isMonster() then if onGetPassivas(creature, 03) then local Percent = _PASSIVES[03].POWER_BASE + (_PASSIVES[03].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[03].CATEGORY then Percent = Percent + _PASSIVES[03].BOOST end end local Reflect = math.floor(Percent * (primaryDamage / 100)) if Reflect < 01 then Reflect = 01 end doTargetCombat(creature, attacker, 01, -Reflect, -Reflect, 01) end if _MONSTER_LOOT[attacker:getName()] then if _MONSTER_LOOT[attacker:getName()][00].Type == "Constructos" then local PID = 18 if onGetPassivas(creature, PID) then local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then Percent = Percent + _PASSIVES[PID].BOOST end end ProtectPercent = ProtectPercent + Percent end end if _MONSTER_LOOT[attacker:getName()][00].Type == "Dimensionais" then local PID = 47 if onGetPassivas(creature, PID) then local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then Percent = Percent + _PASSIVES[PID].BOOST end end ProtectPercent = ProtectPercent + Percent end end if _MONSTER_LOOT[attacker:getName()][00].Type == "Gigantes" then local PID = 33 if onGetPassivas(creature, PID) then local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then Percent = Percent + _PASSIVES[PID].BOOST end end ProtectPercent = ProtectPercent + Percent end end if _MONSTER_LOOT[attacker:getName()][00].Type == "Dragon" then local PID = 34 if onGetPassivas(creature, PID) then local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then Percent = Percent + _PASSIVES[PID].BOOST end end ProtectPercent = ProtectPercent + Percent end end if _MONSTER_LOOT[attacker:getName()][00].Type == "Demon" then local PID = 15 if onGetPassivas(creature, PID) then local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then Percent = Percent + _PASSIVES[PID].BOOST end end ProtectPercent = ProtectPercent + Percent end end if _MONSTER_LOOT[attacker:getName()][00].Type == "Humanoide" then local PID = 06 if onGetPassivas(creature, PID) then local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then Percent = Percent + _PASSIVES[PID].BOOST end end ProtectPercent = ProtectPercent + Percent end end if _MONSTER_LOOT[attacker:getName()][00].Type == "Magica" then local PID = 27 if onGetPassivas(creature, PID) then local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then Percent = Percent + _PASSIVES[PID].BOOST end end ProtectPercent = ProtectPercent + Percent end end if _MONSTER_LOOT[attacker:getName()][00].Type == "Repteis" then local PID = 36 if onGetPassivas(creature, PID) then local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then Percent = Percent + _PASSIVES[PID].BOOST end end ProtectPercent = ProtectPercent + Percent end end if _MONSTER_LOOT[attacker:getName()][00].Type == "Vermes" then local PID = 21 if onGetPassivas(creature, PID) then local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then Percent = Percent + _PASSIVES[PID].BOOST end end ProtectPercent = ProtectPercent + Percent end end if _MONSTER_LOOT[attacker:getName()][00].Type == "Boss" then local PID = 43 if onGetPassivas(creature, PID) then local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then Percent = Percent + _PASSIVES[PID].BOOST end end ProtectPercent = ProtectPercent + Percent end end if _MONSTER_LOOT[attacker:getName()][00].Type == "Aquaticos" then local PID = 14 if onGetPassivas(creature, PID) then local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then Percent = Percent + _PASSIVES[PID].BOOST end end ProtectPercent = ProtectPercent + Percent end end if _MONSTER_LOOT[attacker:getName()][00].Type == "Morto-Vivo" then local PID = 28 if onGetPassivas(creature, PID) then local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then Percent = Percent + _PASSIVES[PID].BOOST end end ProtectPercent = ProtectPercent + Percent end end end end end -- ATR: Paralizia do Medo (12) if FearPara > 0 then if attacker then local CriticalHealth = 80 * (creature:getBaseMaxHealth() / 100) if creature:getHealth() <= CriticalHealth then local ChanceParalyze = math.random(00, 100) if ChanceParalyze <= FearPara then local condition = Condition(CONDITION_PARALYZE) condition:setParameter(CONDITION_PARAM_TICKS, 10000) condition:setFormula(-5, 100, -5, 150) attacker:addCondition(condition) attacker:getPosition():sendMagicEffect(11) end end end end -- Amuletos if creature:getStorageValue(_SYSTEM.INVENTARIO[01].UID_01) > 0 and creature:getStorageValue(_PLAYER_INFO.DELAY) <= 0 then if creature:getStorageValue(_SYSTEM.AMULET_VALUES[00][01]) < 1 then local AmuletID = creature:getStorageValue(_SYSTEM.INVENTARIO[01].UID_01) local Effect = _SYSTEM.AMULET_VALUES[AmuletID] local RareAmulet = creature:getStorageValue(_SYSTEM.INVENTARIO[01].UID_02) local StarAmulet = creature:getStorageValue(_SYSTEM.INVENTARIO[01].UID_03) local LevelAmulet = creature:getStorageValue(_SYSTEM.INVENTARIO[01].UID_05) local BUFF_TIME = 0 local ChanceRandom = math.random(200) if RareAmulet < 0 then RareAmulet = 0 end if StarAmulet < 0 then StarAmulet = 0 end if LevelAmulet < 0 then LevelAmulet = 0 end if creature:getStorageValue(_SYSTEM.MAESTRIA[01]) == 05 then if creature:getStorageValue(_SYSTEM.MAESTRIA[04]) > 0 then ChanceRandom = 00 end end if ChanceRandom <= _AMULET_CHANCE_MODE[RareAmulet] then local Timer_Left = (LevelAmulet + (StarAmulet * 10) + 5) if Effect ~= 10 then if Effect == 01 then local CritValue = creature:getStorageValue(_SYSTEM.CRITICAL_VALUES[02]) if CritValue < 0 then CritValue = 0 end creature:setStorageValue(_SYSTEM.CRITICAL_VALUES[02], (CritValue + 05)) elseif Effect == 04 then local CritValue = creature:getStorageValue(_SYSTEM.CRITICAL_VALUES[01]) if CritValue < 0 then CritValue = 0 end creature:setStorageValue(_SYSTEM.CRITICAL_VALUES[01], (CritValue + 50)) elseif Effect == 05 or Effect == 06 or Effect == 08 then creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][03], 25) elseif Effect == 07 then creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][03], 15) elseif Effect == 09 then local condition = Condition(CONDITION_INVISIBLE) condition:setParameter(CONDITION_PARAM_TICKS, (Timer_Left + StarAmulet) * 1000) creature:addCondition(condition) elseif Effect == 17 then creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][03], 30) elseif Effect == 18 or Effect == 19 or Effect == 20 or Effect == 21 or Effect == 22 then creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][03], 20) end -- DESAFIO if creature:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then onPlayerDesafios(creature, 20, 01) end creature:getPosition():sendMagicEffect(13) creature:setStorageValue(_PLAYER_INFO.DELAY, _PLAYER_INFO.SECONDS_DELAY) creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][02], Effect) creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][01], Timer_Left) if creature:getStorageValue(_QUESTLOG[101].UID_01) == 01 then if creature:getStorageValue(10919) == 04 then creature:setStorageValue(_QUESTLOG[101].UID_01, 100) creature:setStorageValue(10919, nil) creature:sendCancelMessage("@LoadQuestWindows") creature:addExperience(20000, true, true) creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") else if creature:getStorageValue(10919) < 00 then creature:setStorageValue(10919, 01) else creature:setStorageValue(10919, (creature:getStorageValue(10919) + 01)) end doBackpack(creature, 12) end end end end end end if ProtectPercent > 00 then local NewDmgProtect = math.floor(ProtectPercent * (primaryDamage / 100)) primaryDamage = primaryDamage - NewDmgProtect end primaryDamage = primaryDamage - DEF -- ATR: Resistencia a Combate (14) if DmgHalf > 0 then if attacker then if primaryDamage <= _ATRIBUTOS[14].PERCENT then doTargetCombat(attacker, attacker, primaryType, -primaryDamage, -primaryDamage, 01) end end end end end if COMBAT_TYPES[primaryType] then if COMBAT_TYPES[primaryType] == 08 then local PercentFire = math.floor(FIRE * (primaryDamage / 100)) if FIRE >= primaryDamage then primaryDamage = 0 creature:getPosition():sendMagicEffect(CONST_ME_POFF) elseif primaryDamage <= PercentFire then primaryDamage = 0 creature:getPosition():sendMagicEffect(CONST_ME_POFF) else primaryDamage = primaryDamage - PercentFire end elseif COMBAT_TYPES[primaryType] == 512 then local PercentIce = math.floor(ICE * (primaryDamage / 100)) if ICE >= primaryDamage then primaryDamage = 0 creature:getPosition():sendMagicEffect(CONST_ME_POFF) elseif primaryDamage <= PercentIce then primaryDamage = 0 creature:getPosition():sendMagicEffect(CONST_ME_POFF) else primaryDamage = primaryDamage - PercentIce end elseif COMBAT_TYPES[primaryType] == 02 then local PercentEnergy = math.floor(ENERGY * (primaryDamage / 100)) if ENERGY >= primaryDamage then primaryDamage = 0 creature:getPosition():sendMagicEffect(CONST_ME_POFF) elseif primaryDamage <= PercentEnergy then primaryDamage = 0 creature:getPosition():sendMagicEffect(CONST_ME_POFF) else primaryDamage = primaryDamage - PercentEnergy end elseif COMBAT_TYPES[primaryType] == 04 then local PercentEarth = math.floor(EARTH * (primaryDamage / 100)) if EARTH >= primaryDamage then primaryDamage = 0 creature:getPosition():sendMagicEffect(CONST_ME_POFF) elseif primaryDamage <= PercentEarth then primaryDamage = 0 creature:getPosition():sendMagicEffect(CONST_ME_POFF) else primaryDamage = primaryDamage - PercentEarth end elseif COMBAT_TYPES[primaryType] == 2048 then local PercentDeath = math.floor(DEATH * (primaryDamage / 100)) if DEATH >= primaryDamage then primaryDamage = 0 creature:getPosition():sendMagicEffect(CONST_ME_POFF) elseif primaryDamage <= PercentDeath then primaryDamage = 0 creature:getPosition():sendMagicEffect(CONST_ME_POFF) else primaryDamage = primaryDamage - PercentDeath end end end end end end return primaryDamage, primaryType, secondaryDamage, secondaryType, origin end