Module:WeaponStat: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(Created page with "local p = {} local function lerp( x, x0, x1, y0, y1 ) return y0 + (y1 - y0) * (x - x0) / (x1 - x0) end function p.calculate( frame ) local lvl = tonumber(frame.args.lvl)...") |
mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 7:
function p.calculate( frame )
local lvl = tonumber(frame.args.lvl)
local val1 = tonumber(frame.args.val1)
local val100 = tonumber(frame.args.val100)
return math.
end
|
Latest revision as of 02:21, 26 November 2021
Module for interpolating weapon stats given their values at levels 1 and 100.
Example usage: {{#invoke:WeaponStat|calculate|lvl=30|val1=162|val100=1621}}
local p = {}
local function lerp( x, x0, x1, y0, y1 )
return y0 + (y1 - y0) * (x - x0) / (x1 - x0)
end
function p.calculate( frame )
local lvl = tonumber(frame.args.lvl)
local val1 = tonumber(frame.args.val1)
local val100 = tonumber(frame.args.val100)
return math.floor(lerp(lvl, 1, 100, val1, val100))
end
return p