• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Dodge system for TFS 1.3

Icaraii

Well-Known Member
Joined
Jan 5, 2020
Messages
469
Solutions
1
Reaction score
58
Hello guys,

Can anyone make a dodge system with this things:

  • Dodge means miss damage
  • Dodge will work with % of happening or not
  • The chance for the dodge happening will vary from item to item and not every item will have a % of dodge, that means the script need to be structured in a way that it's something like this:
Item id = 1111 = 30% chance of dodge happen
item id = 2222 = 5% chance of dodge happen
That means that all itens id 1111 will have a chance of 30% of dodge happening when they are equipped.

It can be lua or revscript.

I did found a lot of dodge system, but they did not miss damage, they just reduce the amount of damage the player received. Also I found dodge systems that the player needed to use a stone at the item to apply dodge by lvl, varing from 1 to 100 and those dodge systems ain't what I need.
 
Solution
Seems to pop up every once in awhile, so figured I'd post all of the fixes and updates in 1 spot.

Lua:
local dodgeStorage = 45001
local config = {
 -- [itemid] -- Dodge must be a whole number out of 10000. | 1000 = 10.00% | 2 = 00.02% 
    [111111] = {dodgePercent = 5, slot = "head"},
    [111111] = {dodgePercent = 5, slot = "necklace"},
    [111111] = {dodgePercent = 5, slot = "backpack"},
    [111111] = {dodgePercent = 5, slot = "armor"},
    [111111] = {dodgePercent = 5, slot = "hand"}, -- weapon or shield is 'hand'
    [111111] = {dodgePercent = 5, slot = "legs"},
    [111111] = {dodgePercent = 5, slot = "feet"},
    [111111] = {dodgePercent = 5, slot = "ring"},
    [111111] = {dodgePercent = 5, slot = "ammo"}
}

-- Don't touch under here.

-- Equip...
Thank you, I have a question why if I give a chance for 100% dodge appears and so very rarely?

Line 3 from the script shows
Code:
 -- Dodge must be a whole number out of 10000. | 1000 = 10.00% | 2 = 00.02%

100 dodge is only 1%

You need to give them 10000 dodge to get 100%
 
Any tutorial on how to install this script in tfs 1.5?
You just need to create a .lua file in the data/scripts/ folder and place the code in that file.
That's it, the rest is just configuring it.
 
Seems to pop up every once in awhile, so figured I'd post all of the fixes and updates in 1 spot.

Lua:
local dodgeStorage = 45001
local config = {
 -- [itemid] -- Dodge must be a whole number out of 10000. | 1000 = 10.00% | 2 = 00.02% 
    [111111] = {dodgePercent = 5, slot = "head"},
    [111111] = {dodgePercent = 5, slot = "necklace"},
    [111111] = {dodgePercent = 5, slot = "backpack"},
    [111111] = {dodgePercent = 5, slot = "armor"},
    [111111] = {dodgePercent = 5, slot = "hand"}, -- weapon or shield is 'hand'
    [111111] = {dodgePercent = 5, slot = "legs"},
    [111111] = {dodgePercent = 5, slot = "feet"},
    [111111] = {dodgePercent = 5, slot = "ring"},
    [111111] = {dodgePercent = 5, slot = "ammo"}
}

-- Don't touch under here.

-- Equip ------------------------------------------------------------------------------
for itemId, _ in pairs(config) do
    local dodgeOnEquip = MoveEvent()
    
    function dodgeOnEquip.onEquip(player, item, slot, isCheck)
        if not isCheck then
            local itemId = item:getId()
            if config[itemId] then
                local newValue = player:getStorageValue(dodgeStorage) + config[itemId].dodgePercent
                player:setStorageValue(dodgeStorage, newValue)
            end
        end
        return true
    end

    dodgeOnEquip:slot(config[itemId].slot)
    dodgeOnEquip:id(itemId)
    dodgeOnEquip:register()
end


-- DeEquip ----------------------------------------------------------------------------
for itemId, _ in pairs(config) do
    local dodgeOnDeEquip = MoveEvent()
    
    function dodgeOnDeEquip.onDeEquip(player, item, slot, isCheck)
        if not isCheck then
            local itemId = item:getId()
            if config[itemId] then
                local newValue = player:getStorageValue(dodgeStorage) - config[itemId].dodgePercent
                player:setStorageValue(dodgeStorage, newValue)
            end
        end
        return true
    end

    dodgeOnDeEquip:slot(config[itemId].slot)
    dodgeOnDeEquip:id(itemId)
    dodgeOnDeEquip:register()
end


-- Health Change ----------------------------------------------------------------------
local dodgeHealthChange = CreatureEvent("onHealthChange_dodgeChance")

function dodgeHealthChange.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not creature:isPlayer() then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    local storageValue = creature:getStorageValue(dodgeStorage)
    local rand = math.random(10000)
    if rand <= storageValue then
        primaryDamage = 0
        secondaryDamage = 0
        creature:say("Dodged!", TALKTYPE_MONSTER_SAY)
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

dodgeHealthChange:register()


-- Mana Change ------------------------------------------------------------------------
local dodgeManaChange = CreatureEvent("onManaChange_dodgeChance")

function dodgeManaChange.onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not creature:isPlayer() then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    local storageValue = creature:getStorageValue(dodgeStorage)
    local rand = math.random(10000)
    if rand <= storageValue then
        primaryDamage = 0
        secondaryDamage = 0
        creature:say("Dodged!", TALKTYPE_MONSTER_SAY)
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

dodgeManaChange:register()


-- Login ------------------------------------------------------------------------------
local function updateDodgeStorage(playerId)
    local player = Player(playerId)
    if player then
        local storageValue = 0
        local slotItem
        for i = 1, 10 do
            slotItem = player:getSlotItem(i)
            if slotItem then
                slotItem = slotItem:getId()
                if config[slotItem] then
                    storageValue = storageValue + config[slotItem].dodgePercent
                end
            end
        end        
        player:setStorageValue(dodgeStorage, storageValue)
    end
end

local loginEvent = CreatureEvent("onLogin_updateDodgeStorage")
loginEvent:type("login")

function loginEvent.onLogin(player)
    player:registerEvent("onHealthChange_dodgeChance")
    player:registerEvent("onManaChange_dodgeChance")
    addEvent(updateDodgeStorage, 100, player:getId()) -- slight delay, cuz of login jank
    return true
end

loginEvent:register()
 
Solution
@Xikini did one more update to this system, cause of potential duplicate move event warning for majority of equipment, where onEquip and onDeEquip is removed

Lua:
local dodgeStorage = 45001
local config = {
 -- [itemid] -- Dodge must be a whole number out of 10000. | 1000 = 10.00% | 2 = 00.02%
    [111111] = {dodgePercent = 5, slot = "head"},
    [111111] = {dodgePercent = 5, slot = "necklace"},
    [111111] = {dodgePercent = 5, slot = "backpack"},
    [111111] = {dodgePercent = 5, slot = "armor"},
    [111111] = {dodgePercent = 5, slot = "hand"}, -- weapon or shield is 'hand'
    [111111] = {dodgePercent = 5, slot = "legs"},
    [111111] = {dodgePercent = 5, slot = "feet"},
    [111111] = {dodgePercent = 5, slot = "ring"},
    [111111] = {dodgePercent = 5, slot = "ammo"}
}

-- Don't touch under here.


-- Health Change ----------------------------------------------------------------------
local dodgeHealthChange = CreatureEvent("onHealthChange_dodgeChance")

function dodgeHealthChange.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not creature:isPlayer() then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    if primaryType == COMBAT_HEALING then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    local storageValue = creature:getStorageValue(dodgeStorage)
    local rand = math.random(10000)
    if rand <= storageValue then
        primaryDamage = 0
        secondaryDamage = 0
        creature:say("Dodged!", TALKTYPE_MONSTER_SAY)
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

dodgeHealthChange:register()


-- Mana Change ------------------------------------------------------------------------
local dodgeManaChange = CreatureEvent("onManaChange_dodgeChance")

function dodgeManaChange.onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not creature:isPlayer() then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
     if primaryType == COMBAT_MANADRAIN and primaryDamage > 0 then
         return primaryDamage, primaryType, secondaryDamage, secondaryType
     end
    local storageValue = creature:getStorageValue(dodgeStorage)
    local rand = math.random(10000)
    if rand <= storageValue then
        primaryDamage = 0
        secondaryDamage = 0
        creature:say("Dodged!", TALKTYPE_MONSTER_SAY)
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

dodgeManaChange:register()


-- Login ------------------------------------------------------------------------------
local function updateDodgeStorage(playerId)
    local player = Player(playerId)
    if not player then
        return
    end
    local storageValue = 0
    local slotItem
    for i = 1, 10 do
        slotItem = player:getSlotItem(i)
        if slotItem then
            slotItem = slotItem:getId()
            if config[slotItem] then
                storageValue = storageValue + config[slotItem].dodgePercent
            end
        end
    end     
    player:setStorageValue(dodgeStorage, storageValue)
    addEvent(updateDodgeStorage, 1000, playerId)
end

local loginEvent = CreatureEvent("onLogin_updateDodgeStorage")
loginEvent:type("login")

function loginEvent.onLogin(player)
    player:registerEvent("onHealthChange_dodgeChance")
    player:registerEvent("onManaChange_dodgeChance")
    addEvent(updateDodgeStorage, 100, player:getId())
    return true
end

loginEvent:register()
 
Seems to pop up every once in awhile, so figured I'd post all of the fixes and updates in 1 spot.

Lua:
local dodgeStorage = 45001
local config = {
 -- [itemid] -- Dodge must be a whole number out of 10000. | 1000 = 10.00% | 2 = 00.02%
    [111111] = {dodgePercent = 5, slot = "head"},
    [111111] = {dodgePercent = 5, slot = "necklace"},
    [111111] = {dodgePercent = 5, slot = "backpack"},
    [111111] = {dodgePercent = 5, slot = "armor"},
    [111111] = {dodgePercent = 5, slot = "hand"}, -- weapon or shield is 'hand'
    [111111] = {dodgePercent = 5, slot = "legs"},
    [111111] = {dodgePercent = 5, slot = "feet"},
    [111111] = {dodgePercent = 5, slot = "ring"},
    [111111] = {dodgePercent = 5, slot = "ammo"}
}

-- Don't touch under here.

-- Equip ------------------------------------------------------------------------------
for itemId, _ in pairs(config) do
    local dodgeOnEquip = MoveEvent()
   
    function dodgeOnEquip.onEquip(player, item, slot, isCheck)
        if not isCheck then
            local itemId = item:getId()
            if config[itemId] then
                local newValue = player:getStorageValue(dodgeStorage) + config[itemId].dodgePercent
                player:setStorageValue(dodgeStorage, newValue)
            end
        end
        return true
    end

    dodgeOnEquip:slot(config[itemId].slot)
    dodgeOnEquip:id(itemId)
    dodgeOnEquip:register()
end


-- DeEquip ----------------------------------------------------------------------------
for itemId, _ in pairs(config) do
    local dodgeOnDeEquip = MoveEvent()
   
    function dodgeOnDeEquip.onDeEquip(player, item, slot, isCheck)
        if not isCheck then
            local itemId = item:getId()
            if config[itemId] then
                local newValue = player:getStorageValue(dodgeStorage) - config[itemId].dodgePercent
                player:setStorageValue(dodgeStorage, newValue)
            end
        end
        return true
    end

    dodgeOnDeEquip:slot(config[itemId].slot)
    dodgeOnDeEquip:id(itemId)
    dodgeOnDeEquip:register()
end


-- Health Change ----------------------------------------------------------------------
local dodgeHealthChange = CreatureEvent("onHealthChange_dodgeChance")

function dodgeHealthChange.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not creature:isPlayer() then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    local storageValue = creature:getStorageValue(dodgeStorage)
    local rand = math.random(10000)
    if rand <= storageValue then
        primaryDamage = 0
        secondaryDamage = 0
        creature:say("Dodged!", TALKTYPE_MONSTER_SAY)
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

dodgeHealthChange:register()


-- Mana Change ------------------------------------------------------------------------
local dodgeManaChange = CreatureEvent("onManaChange_dodgeChance")

function dodgeManaChange.onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not creature:isPlayer() then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    local storageValue = creature:getStorageValue(dodgeStorage)
    local rand = math.random(10000)
    if rand <= storageValue then
        primaryDamage = 0
        secondaryDamage = 0
        creature:say("Dodged!", TALKTYPE_MONSTER_SAY)
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

dodgeManaChange:register()


-- Login ------------------------------------------------------------------------------
local function updateDodgeStorage(playerId)
    local player = Player(playerId)
    if player then
        local storageValue = 0
        local slotItem
        for i = 1, 10 do
            slotItem = player:getSlotItem(i)
            if slotItem then
                slotItem = slotItem:getId()
                if config[slotItem] then
                    storageValue = storageValue + config[slotItem].dodgePercent
                end
            end
        end       
        player:setStorageValue(dodgeStorage, storageValue)
    end
end

local loginEvent = CreatureEvent("onLogin_updateDodgeStorage")
loginEvent:type("login")

function loginEvent.onLogin(player)
    player:registerEvent("onHealthChange_dodgeChance")
    player:registerEvent("onManaChange_dodgeChance")
    addEvent(updateDodgeStorage, 100, player:getId()) -- slight delay, cuz of login jank
    return true
end

loginEvent:register()
tfs 1.5 please xD
 
Seems to pop up every once in awhile, so figured I'd post all of the fixes and updates in 1 spot.

Lua:
local dodgeStorage = 45001
local config = {
 -- [itemid] -- Dodge must be a whole number out of 10000. | 1000 = 10.00% | 2 = 00.02%
    [111111] = {dodgePercent = 5, slot = "head"},
    [111111] = {dodgePercent = 5, slot = "necklace"},
    [111111] = {dodgePercent = 5, slot = "backpack"},
    [111111] = {dodgePercent = 5, slot = "armor"},
    [111111] = {dodgePercent = 5, slot = "hand"}, -- weapon or shield is 'hand'
    [111111] = {dodgePercent = 5, slot = "legs"},
    [111111] = {dodgePercent = 5, slot = "feet"},
    [111111] = {dodgePercent = 5, slot = "ring"},
    [111111] = {dodgePercent = 5, slot = "ammo"}
}

-- Don't touch under here.

-- Equip ------------------------------------------------------------------------------
for itemId, _ in pairs(config) do
    local dodgeOnEquip = MoveEvent()
   
    function dodgeOnEquip.onEquip(player, item, slot, isCheck)
        if not isCheck then
            local itemId = item:getId()
            if config[itemId] then
                local newValue = player:getStorageValue(dodgeStorage) + config[itemId].dodgePercent
                player:setStorageValue(dodgeStorage, newValue)
            end
        end
        return true
    end

    dodgeOnEquip:slot(config[itemId].slot)
    dodgeOnEquip:id(itemId)
    dodgeOnEquip:register()
end


-- DeEquip ----------------------------------------------------------------------------
for itemId, _ in pairs(config) do
    local dodgeOnDeEquip = MoveEvent()
   
    function dodgeOnDeEquip.onDeEquip(player, item, slot, isCheck)
        if not isCheck then
            local itemId = item:getId()
            if config[itemId] then
                local newValue = player:getStorageValue(dodgeStorage) - config[itemId].dodgePercent
                player:setStorageValue(dodgeStorage, newValue)
            end
        end
        return true
    end

    dodgeOnDeEquip:slot(config[itemId].slot)
    dodgeOnDeEquip:id(itemId)
    dodgeOnDeEquip:register()
end


-- Health Change ----------------------------------------------------------------------
local dodgeHealthChange = CreatureEvent("onHealthChange_dodgeChance")

function dodgeHealthChange.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not creature:isPlayer() then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    local storageValue = creature:getStorageValue(dodgeStorage)
    local rand = math.random(10000)
    if rand <= storageValue then
        primaryDamage = 0
        secondaryDamage = 0
        creature:say("Dodged!", TALKTYPE_MONSTER_SAY)
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

dodgeHealthChange:register()


-- Mana Change ------------------------------------------------------------------------
local dodgeManaChange = CreatureEvent("onManaChange_dodgeChance")

function dodgeManaChange.onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not creature:isPlayer() then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    local storageValue = creature:getStorageValue(dodgeStorage)
    local rand = math.random(10000)
    if rand <= storageValue then
        primaryDamage = 0
        secondaryDamage = 0
        creature:say("Dodged!", TALKTYPE_MONSTER_SAY)
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

dodgeManaChange:register()


-- Login ------------------------------------------------------------------------------
local function updateDodgeStorage(playerId)
    local player = Player(playerId)
    if player then
        local storageValue = 0
        local slotItem
        for i = 1, 10 do
            slotItem = player:getSlotItem(i)
            if slotItem then
                slotItem = slotItem:getId()
                if config[slotItem] then
                    storageValue = storageValue + config[slotItem].dodgePercent
                end
            end
        end       
        player:setStorageValue(dodgeStorage, storageValue)
    end
end

local loginEvent = CreatureEvent("onLogin_updateDodgeStorage")
loginEvent:type("login")

function loginEvent.onLogin(player)
    player:registerEvent("onHealthChange_dodgeChance")
    player:registerEvent("onManaChange_dodgeChance")
    addEvent(updateDodgeStorage, 100, player:getId()) -- slight delay, cuz of login jank
    return true
end

loginEvent:register()
There is a quick question: what is the difference between the two systems and which is better and more secure? If I use a stone to evolve at 100/100, will that give me a 30% dodge chance? This script does not use items, just a dodge percentage. In this case, your script is for using items and has a chance to activate the dodge. Which one is the best? I would like to understand and have your opinion. I need a good system for my server with a medium to low experience. Thanks.

Lua:
--[[
    Dodge & Critical fixado por Movie (Movie#4361)
    Disponibilizado para o TibiaKing e não autorizo outras reproduções
    Mantenha os créditos <3
--]]

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)

    if (not attacker or not creature) then 
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end

    if primaryType == COMBAT_HEALING then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end

    if ((creature:getDodgeLevel() * 3) >= math.random (0, 1000) and creature:isPlayer()) then
        primaryDamage = 0
        secondaryDamage = 0
        creature:say("DODGE!", TALKTYPE_MONSTER_SAY)
        creature:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT)
    end

    if (attacker:isPlayer() and (attacker:getCriticalLevel() * 3) >= math.random (0, 1000)) then
        primaryDamage = primaryDamage + math.ceil(primaryDamage * CRITICAL.PERCENT)
        attacker:say("CRITICAL!", TALKTYPE_MONSTER_SAY)
        creature:getPosition():sendMagicEffect(CONST_ME_EXPLOSIONHIT)
    end

    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

DODGE = {
LEVEL_MAX = 100, -- maximum level that the dodge will be
PERCENT = 0.2 -- percentage that will defend the attack
}
 
There is a quick question: what is the difference between the two systems and which is better and more secure? If I use a stone to evolve at 100/100, will that give me a 30% dodge chance? This script does not use items, just a dodge percentage. In this case, your script is for using items and has a chance to activate the dodge. Which one is the best? I would like to understand and have your opinion. I need a good system for my server with a medium to low experience. Thanks.

Lua:
--[[
    Dodge & Critical fixado por Movie (Movie#4361)
    Disponibilizado para o TibiaKing e não autorizo outras reproduções
    Mantenha os créditos <3
--]]

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)

    if (not attacker or not creature) then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end

    if primaryType == COMBAT_HEALING then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end

    if ((creature:getDodgeLevel() * 3) >= math.random (0, 1000) and creature:isPlayer()) then
        primaryDamage = 0
        secondaryDamage = 0
        creature:say("DODGE!", TALKTYPE_MONSTER_SAY)
        creature:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT)
    end

    if (attacker:isPlayer() and (attacker:getCriticalLevel() * 3) >= math.random (0, 1000)) then
        primaryDamage = primaryDamage + math.ceil(primaryDamage * CRITICAL.PERCENT)
        attacker:say("CRITICAL!", TALKTYPE_MONSTER_SAY)
        creature:getPosition():sendMagicEffect(CONST_ME_EXPLOSIONHIT)
    end

    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

DODGE = {
LEVEL_MAX = 100, -- maximum level that the dodge will be
PERCENT = 0.2 -- percentage that will defend the attack
}
basically comparing red apples to green apples.

Use whichever you prefer.
 
There is a quick question: what is the difference between the two systems and which is better and more secure? If I use a stone to evolve at 100/100, will that give me a 30% dodge chance? This script does not use items, just a dodge percentage. In this case, your script is for using items and has a chance to activate the dodge. Which one is the best? I would like to understand and have your opinion. I need a good system for my server with a medium to low experience. Thanks.

Lua:
--[[
    Dodge & Critical fixado por Movie (Movie#4361)
    Disponibilizado para o TibiaKing e não autorizo outras reproduções
    Mantenha os créditos <3
--]]

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)

    if (not attacker or not creature) then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end

    if primaryType == COMBAT_HEALING then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end

    if ((creature:getDodgeLevel() * 3) >= math.random (0, 1000) and creature:isPlayer()) then
        primaryDamage = 0
        secondaryDamage = 0
        creature:say("DODGE!", TALKTYPE_MONSTER_SAY)
        creature:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT)
    end

    if (attacker:isPlayer() and (attacker:getCriticalLevel() * 3) >= math.random (0, 1000)) then
        primaryDamage = primaryDamage + math.ceil(primaryDamage * CRITICAL.PERCENT)
        attacker:say("CRITICAL!", TALKTYPE_MONSTER_SAY)
        creature:getPosition():sendMagicEffect(CONST_ME_EXPLOSIONHIT)
    end

    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

DODGE = {
LEVEL_MAX = 100, -- maximum level that the dodge will be
PERCENT = 0.2 -- percentage that will defend the attack
}
Kinda late answer but there is one difference worth to mention: First system doesn't take HEALING into consideration during dodge (missing condition). You will dodge drinking health potions or healing by 'exura gran mas res' spell.

With that correction both are fine and answer will depend on your personal preference what is easier to adapt for your needs.
 
Back
Top