Module:HeroData: Difference between revisionsGive feedback
Jump to navigation
Jump to search
m get_hero_scalar_str split into it and get_hero_scalar |
m write_hero_comparison_table complete, now uses level/spirit scaling params |
||
| Line 89: | Line 89: | ||
-- Retrieve scaling string of a hero's given stat, if it has scaling, else return blank | -- Retrieve scaling string of a hero's given stat, if it has scaling, else return blank | ||
-- Scaling string meaning the expanded template {{Ss|scalar}} or {{Ls|scalar}} | -- Scaling string meaning the expanded template {{Ss|scalar}} or {{Ls|scalar}} | ||
function p.get_hero_scalar_str( | function p.get_hero_scalar_str(scaling_value, scaling_type) | ||
local scaling_abbrevs = {Spirit = "Ss", Level = "Ls"} | local scaling_abbrevs = {Spirit = "Ss", Level = "Ls"} | ||
-- Return blank if it doesnt scale | -- Return blank if it doesnt scale | ||
| Line 335: | Line 333: | ||
-- Add the scaling str if it scales | -- Add the scaling str if it scales | ||
local scalar_str = p.get_hero_scalar_str( | local scaling_value, scaling_type = p.get_hero_scalar(hero_data, hero_stat_key) | ||
local scalar_str = p.get_hero_scalar_str(scaling_value, scaling_type) | |||
if (scalar_str ~= "") then scalar_str = " " .. scalar_str end | if (scalar_str ~= "") then scalar_str = " " .. scalar_str end | ||
| Line 444: | Line 443: | ||
stat_value = hero_data[attr_key] | stat_value = hero_data[attr_key] | ||
if (stat_value == nil) then stat_value = 0 end | if (stat_value == nil) then stat_value = 0 end | ||
-- Retrieve scaling val and str if it scales | |||
local scaling_value, scaling_type = p.get_hero_scalar(hero_data, attr_key) | |||
local scalar_str = p.get_hero_scalar_str(scaling_value, scaling_type) | |||
if (scalar_str ~= "") then scalar_str = " " .. scalar_str end | |||
if (not display_scaling_icons) then scalar_str = "" end | |||
-- Scale the stat value | |||
if (scaling_type == "Spirit") then | |||
stat_value = stat_value + (spirit_power * scaling_value) | |||
elseif (scaling_type == "Level") then | |||
stat_value = stat_value + (power_increases * scaling_value) | |||
end | |||
-- Round it | -- Round it | ||
stat_value = util_module.round_to_sig_fig(stat_value, 3) | stat_value = util_module.round_to_sig_fig(stat_value, 3) | ||
-- Add it to the row | -- Add it to the row | ||