Module:Experience
From Melvor Idle
Documentation for this module may be created at Module:Experience/doc
--
-- Helper module to make Experience-related calculations
--
local p = {}
function p.expForLevel(targetLevel)
local result = 0.0
for l = 1, targetLevel - 1 do
local term = l + 300 * 2 ^ (l / 7)
result = result + math.floor(term)
end
result = result / 4.0
result = math.floor(result)
return result
end
function p.remainingExp(targetLevel, currentExp)
local targetExp = p.expForLevel(targetLevel)
return math.max(targetExp - currentExp, 0)
end
return p