POREM DA CONFLITO COM ATK BOOST
local lvlcrit = 48913 -- storage para criticos normais local lvlcritDanger = 48904 -- storage para criticos perigosos local multiplier = 1.5 -- multiplicador de dano function onCombat(cid, target) if isPlayer(cid) and isCreature(target) then local criticalChance = getPlayerStorageValue(cid, lvlcrit) or 0 local criticalDangerChance = getPlayerStorageValue(cid, lvlcritDanger) or 0 local chance = math.random(1, 1000) -- Mantém um intervalo razoável -- Verifica se a chance de crítico BOOSTER é atingida if chance <= (criticalChance * 1) then local damage = 1000000000 -- Valor do dano crítico BOOSTER (ajuste conforme necessário) doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -damage, -damage, 255) doSendAnimatedText(getCreaturePosition(target), "+DANGER!", 35) doSendMagicEffect(getCreaturePosition(cid), 54) return true end -- Verifica se a chance de crítico DANGER é atingida if chance <= (criticalDangerChance * 2) then local damage = 100000000000 -- Valor do dano crítico DANGER (ajuste conforme necessário) doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -damage, -damage, 255) doSendAnimatedText(getCreaturePosition(target), "FATALITY!", 190) doSendMagicEffect(getCreaturePosition(cid), 52) return true end end return true end
local UPGRADE_ITEM_ID = 5902 -- The upgrade item, e.g., "spooky blue eye" local LIFE_LEECH_INCREMENT = 1 -- Percentage to be added to Life Leech local MANA_LEECH_INCREMENT = 1 -- Percentage to be added to Mana Leech local MAX_LEECH_PERCENT = 100 -- Maximum limit for Life Leech and Mana Leech local LEACH_WEAPON_STORAGE = 47892 -- Replace with the real storage ID of the leech weapon local FIXED_DAMAGE = 100000000000 -- Fixed damage that will be dealt to the creature local EFFECT_ON_USE = 23 -- Visual effect to be applied (adjust as necessary) function onUse(cid, item, fromPosition, itemEx, toPosition) -- Check if the player is valid if not isPlayer(cid) then return false end -- Get the weapon the player is holding (left or right hand) local weapon = getPlayerSlotItem(cid, CONST_SLOT_LEFT) if weapon.itemid == 0 then weapon = getPlayerSlotItem(cid, CONST_SLOT_RIGHT) end -- Check if the player is holding a weapon if weapon.itemid == 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You need to be holding a weapon to upgrade it.") return false end -- Get current values of Life Leech and Mana Leech (if any) local currentLifeLeech = tonumber(getItemAttribute(weapon.uid, "lifeLeech")) or 0 local currentManaLeech = tonumber(getItemAttribute(weapon.uid, "manaLeech")) or 0 -- Accumulate new leech values local newLifeLeech = math.min(currentLifeLeech + LIFE_LEECH_INCREMENT, MAX_LEECH_PERCENT) local newManaLeech = math.min(currentManaLeech + MANA_LEECH_INCREMENT, MAX_LEECH_PERCENT) -- Apply new Life Leech and Mana Leech values to the weapon doItemSetAttribute(weapon.uid, "lifeLeech", newLifeLeech) doItemSetAttribute(weapon.uid, "manaLeech", newManaLeech) -- Modify the weapon description to show the new leech values local description = getItemAttribute(weapon.uid, "description") or "" description = "This weapon now has " .. newLifeLeech .. "% Life Leech and " .. newManaLeech .. "% Mana Leech." doItemSetAttribute(weapon.uid, "description", description) -- Messages and effects doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your weapon has been upgraded! It now has " .. newLifeLeech .. "% Life Leech and " .. newManaLeech .. "% Mana Leech.") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREATTACK) -- Show animated text local position = getCreaturePosition(cid) -- Define the position for animated text doSendAnimatedText(position, "+Leech", 35) -- Display animated text with color 35 (green) -- Remove the upgrade item doRemoveItem(item.uid, 1) -- Combat logic: use all mana local maxMana = getCreatureMaxMana(cid) -- Check if the player has enough mana if getCreatureMana(cid) >= maxMana then -- Deal fixed damage to the creature local target = getCreatureTarget(cid) -- Get the target of the creature if isCreature(target) then -- Deal fixed damage to the creature doTargetCombatHealth(cid, target, COMBAT_UNDEFINEDDAMAGE, -FIXED_DAMAGE, -FIXED_DAMAGE, CONST_ME_SOUND_WHITE) -- Reduce the target's mana by the fixed damage amount local targetMana = getCreatureMana(target) local newTargetMana = math.max(0, targetMana - FIXED_DAMAGE) -- Ensure mana doesn't go below 0 doCreatureAddMana(target, -newTargetMana) -- Reduce the player's mana doCreatureAddMana(cid, -maxMana) -- Send a message about the attack doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You used all your mana to attack! Damage dealt: " .. FIXED_DAMAGE .. " and drained " .. newTargetMana .. " mana from the target.") -- Apply effect to the target doSendMagicEffect(getCreaturePosition(target), EFFECT_ON_USE) -- Apply effect to the target else doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You do not have a valid target to attack.") end else -- Message if there is not enough mana doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have enough mana to perform the attack!") end return true end
local LEACH_WEAPON_STORAGE = 47892 -- Storage for the leech weapon local FIXED_DAMAGE = 100000000000 -- A reasonable damage value local LEECH_PERCENT = 100 -- 10% leech for life and mana local MAX_LEECH = 100 -- Max 50% leech to avoid overpowering -- Function to calculate and apply leech local function applyLeech(cid, target, damage) -- Check if target is a valid creature and if player has leech ability if not isCreature(target) or getPlayerStorageValue(cid, LEACH_WEAPON_STORAGE) <= 0 then return end -- Ensure the damage value is reasonable if damage <= 0 then return end -- Calculate the leech amounts local lifeLeech = math.floor(damage * math.min(LEECH_PERCENT, MAX_LEECH) / 100) local manaLeech = math.floor(damage * math.min(LEECH_PERCENT, MAX_LEECH) / 100) -- Apply leech to player's health and mana doCreatureAddHealth(cid, lifeLeech) doCreatureAddMana(cid, manaLeech) -- Send effect and feedback to the player doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You leeched " .. lifeLeech .. " health and " .. manaLeech .. " mana.") end -- Hook into the combat system (use this function in combat scripts) function onCombat(cid, target) -- Apply a fixed damage value local fixedDamage = FIXED_DAMAGE -- Deal fixed damage to the target (adjust this as needed) doTargetCombatHealth(cid, target, COMBAT_UNDEFINEDDAMAGE, -fixedDamage, -fixedDamage, CONST_ME_FIREATTACK) -- Apply leech based on the fixed damage dealt applyLeech(cid, target, fixedDamage) return true end