Ir para conteúdo

Featured Replies

Postado

 

Este script é baseado em 'increassemagicpercent', que aumenta o dano mágico em uma porcentagem específica. Se alguém puder testá-lo e fornecer feedback aqui, seria muito apreciado!

data/scripts/file.lua

local COMBAT_ELEMENTAL = 10000
local COMBAT_ALL = 10001

local elementalDamageTypes = {
    COMBAT_ENERGYDAMAGE,
    COMBAT_EARTHDAMAGE,
    COMBAT_FIREDAMAGE,
    COMBAT_ICEDAMAGE,
    COMBAT_HOLYDAMAGE,
    COMBAT_DEATHDAMAGE
}

local buff_items = {
    --[itemid] = {damageType, damagePercentage}
    [1111] = {damageType = COMBAT_PHYSICALDAMAGE, damagePercentage = 0.5}, -- 50% extra damage
    [2222] = {damageType = COMBAT_ENERGYDAMAGE,   damagePercentage = 1}, -- 100% extra damage
    [3333] = {damageType = COMBAT_EARTHDAMAGE,    damagePercentage = 1},
    [4444] = {damageType = COMBAT_FIREDAMAGE,     damagePercentage = 1},
    [5555] = {damageType = COMBAT_ICEDAMAGE,      damagePercentage = 1},
    [6666] = {damageType = COMBAT_HOLYDAMAGE,     damagePercentage = 1},
    [7777] = {damageType = COMBAT_DEATHDAMAGE,    damagePercentage = 1},
    [8888] = {damageType = COMBAT_ELEMENTAL,      damagePercentage = 1}, -- elemental types
    [9999] = {damageType = COMBAT_ALL,            damagePercentage = 1}  -- all damage types
}



local function damageCalculator(primaryDamage, primaryType, secondaryDamage, secondaryType, playerid)
    local player = Player(playerid)
 
    for slot = CONST_SLOT_FIRST, CONST_SLOT_LAST do
        local slotItem = player:getSlotItem(slot)
        if slotItem then
            local slotItemId = slotItem:getId()
            local index = buff_items[slotItemId]
            if index then
                local primaryIncrease = false
                local secondaryIncrease = false
             
                -- primary damage checks
                if index.damageType == COMBAT_ALL and (primaryType == COMBAT_PHYSICALDAMAGE or table.contains(elementalDamageTypes, primaryType)) then
                    primaryIncrease = true
                end
                if index.damageType == COMBAT_ELEMENTAL and table.contains(elementalDamageTypes, primaryType) then
                    primaryIncrease = true
                end
                if index.damageType == primaryType then
                    primaryIncrease = true
                end
             
                -- secondary damage checks
                if index.damageType == COMBAT_ALL and (secondaryType == COMBAT_PHYSICALDAMAGE or table.contains(elementalDamageTypes, secondaryType)) then
                    secondaryIncrease = true
                end
                if index.damageType == COMBAT_ELEMENTAL and table.contains(elementalDamageTypes, secondaryType) then
                    secondaryIncrease = true
                end
                if index.damageType == secondaryType then
                    secondaryIncrease = true
                end
             
                -- damage calculation
                if primaryIncrease then
                    primaryDamage = primaryDamage * (index.damagePercentage + 1)
                end
                if secondaryIncrease then
                    secondaryDamage = secondaryDamage * (index.damagePercentage + 1)
                end
            end
        end
    end
 
    return primaryDamage, secondaryDamage
end

@Movie @Underewar @Vodkart

Se vocês puderem testar e confirmar se o script está funcionando corretamente, por favor, avisem aqui. Agradeço desde já pela colaboração

 

Estou lutando incansavelmente para fazer esse script ou sistema de dano mágico em percentual funcionar. É de extrema importância para o meu servidor. Se alguém puder ajudar ou oferecer qualquer orientação, seria de imensa ajuda e gratidão.

 

Resolvido por Mateus Robeerto

Ir para solução
  • Respostas 5
  • Visualizações 493
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Mateus Robeerto
    Mateus Robeerto

    Vou postar aqui para vocês, é baseado no 7.92 e se chama 'IncreaseMagicPercent". Acabei de postar aqui. Dê uma olhada para que você possa adicionar à sua source https://tibiaking.com/forum

Postado
  • Autor
  • Solução

O problema já está resolvido! Estive tentando resolver essa função por mais de 3 meses, mas finalmente consegui ontem, através da source!!

 

Eu sei que há pessoas interessadas nessa função de 'dano mágico em %'. Vou verificar com a pessoa que me passou os códigos pela source se ela me autoriza a compartilhá-los com vocês. :)

Editado por sverkoa (veja o histórico de edições)

  • 2 months later...

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo