Module:CharacterStat: Difference between revisions

no edit summary
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1:
local p = {}
 
-- Cumulative rarity bonus per stat.
local STAT_RARITY_BONUS = {
["attack"] = { 0, 1000, 2200, 3600, 5300 },
["defense"] = { 0, 0, 0, 0, 0 },
["heal"] = { 0, 750, 1750, 2950, 4450 },
["hp"] = { 0, 500, 1200, 2100, 3500 }
Line 12 ⟶ 14:
 
function p.calculate( frame )
local lvl = tonumber( frame.args.lvl )
local rarity = tonumber ( frame.args.rarity )
local stat = frame.args.stat
local val1 = tonumber( frame.args.val1 )
local val100 = tonumber( frame.args.val100 )
return math.ceil(lerp(lvl, 1, 100, val1, val100) * (10000 + STAT_RARITY_BONUS[stat][rarity]) / 10000)