erratum/bestiaire/libs/boosts.lua
Kazhnuz 5e8d7a19e1
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
feat: adaptation des boost d'armes
2024-09-02 16:29:27 +02:00

39 lines
No EOL
807 B
Lua

local boost = {}
local BOOST_ARM_CREATURE = {
{lvl = 0, value = 1},
{lvl = 2, value = 1.5},
{lvl = 3, value = 2},
{lvl = 5, value = 3},
{lvl = 6, value = 3.5},
{lvl = 7, value = 4}
}
local BOOST_ARM_PNJ = {
{lvl = 0, value = 1},
{lvl = 2, value = 1.5},
{lvl = 4, value = 2},
{lvl = 6, value = 3}
}
local function getBoost(level, table)
local bestBoost = {lvl = -1, value = 1}
for _, boost in ipairs(table) do
if (level >= boost.lvl and boost.lvl > bestBoost.lvl) then
bestBoost = boost
end
end
return bestBoost.value
end
function boost.getBoost(level, mode)
if (mode == "pnj") then
return getBoost(level, BOOST_ARM_PNJ)
else
return getBoost(level, BOOST_ARM_CREATURE)
end
end
return boost