locallvlcrit = 48913-- storage para criticos normaislocallvlcritDanger = 48904-- storage para criticos perigososlocalmultiplier = 1.5-- multiplicador de danofunctiononCombat(cid, target)ifisPlayer(cid) andisCreature(target) thenlocalcriticalChance = getPlayerStorageValue(cid, lvlcrit) or0localcriticalDangerChance = getPlayerStorageValue(cid, lvlcritDanger) or0localchance = math.random(1, 1000) -- Mantém um intervalo razoável-- Verifica se a chance de crítico BOOSTER é atingidaifchance <= (criticalChance * 1) thenlocaldamage = 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)returntrueend-- Verifica se a chance de crítico DANGER é atingidaifchance <= (criticalDangerChance * 2) thenlocaldamage = 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)returntrueendendreturntrueend
localUPGRADE_ITEM_ID = 5902-- The upgrade item, e.g., "spooky blue eye"localLIFE_LEECH_INCREMENT = 1-- Percentage to be added to Life LeechlocalMANA_LEECH_INCREMENT = 1-- Percentage to be added to Mana LeechlocalMAX_LEECH_PERCENT = 100-- Maximum limit for Life Leech and Mana LeechlocalLEACH_WEAPON_STORAGE = 47892-- Replace with the real storage ID of the leech weaponlocalFIXED_DAMAGE = 100000000000-- Fixed damage that will be dealt to the creaturelocalEFFECT_ON_USE = 23-- Visual effect to be applied (adjust as necessary)functiononUse(cid, item, fromPosition, itemEx, toPosition)-- Check if the player is validifnotisPlayer(cid) thenreturnfalseend-- Get the weapon the player is holding (left or right hand)localweapon = getPlayerSlotItem(cid, CONST_SLOT_LEFT)ifweapon.itemid == 0then
weapon = getPlayerSlotItem(cid, CONST_SLOT_RIGHT)end-- Check if the player is holding a weaponifweapon.itemid == 0then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You need to be holding a weapon to upgrade it.")returnfalseend-- Get current values of Life Leech and Mana Leech (if any)localcurrentLifeLeech = tonumber(getItemAttribute(weapon.uid, "lifeLeech")) or0localcurrentManaLeech = tonumber(getItemAttribute(weapon.uid, "manaLeech")) or0-- Accumulate new leech valueslocalnewLifeLeech = math.min(currentLifeLeech + LIFE_LEECH_INCREMENT, MAX_LEECH_PERCENT)localnewManaLeech = 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 valueslocaldescription = 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 textlocalposition = 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 manalocalmaxMana = getCreatureMaxMana(cid)-- Check if the player has enough manaifgetCreatureMana(cid) >= maxManathen-- Deal fixed damage to the creaturelocaltarget = getCreatureTarget(cid) -- Get the target of the creatureifisCreature(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 amountlocaltargetMana = getCreatureMana(target)localnewTargetMana = 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 targetelse
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You do not have a valid target to attack.")endelse-- Message if there is not enough mana
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have enough mana to perform the attack!")endreturntrueend
localLEACH_WEAPON_STORAGE = 47892-- Storage for the leech weaponlocalFIXED_DAMAGE = 100000000000-- A reasonable damage valuelocalLEECH_PERCENT = 100-- 10% leech for life and manalocalMAX_LEECH = 100-- Max 50% leech to avoid overpowering-- Function to calculate and apply leechlocalfunctionapplyLeech(cid, target, damage)-- Check if target is a valid creature and if player has leech abilityifnotisCreature(target) orgetPlayerStorageValue(cid, LEACH_WEAPON_STORAGE) <= 0thenreturnend-- Ensure the damage value is reasonableifdamage <= 0thenreturnend-- Calculate the leech amountslocallifeLeech = math.floor(damage * math.min(LEECH_PERCENT, MAX_LEECH) / 100)localmanaLeech = 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)functiononCombat(cid, target)-- Apply a fixed damage valuelocalfixedDamage = 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)returntrueend
Pergunta
Muvuka 1
POREM DA CONFLITO COM ATK BOOST
Link para o comentário
Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados