Module:Sandbox/LVL: Difference between revisionsGive feedback
No edit summary |
Resist scaling fix |
||
| Line 442: | Line 442: | ||
local spirit_scale = 0 | local spirit_scale = 0 | ||
local level_scale = 0 | local level_scale = 0 | ||
if (scaling_data ~= nil) then | if (scaling_data ~= nil) then | ||
for scaling_val, scaling_type in pairs(scaling_data) do | for scaling_val, scaling_type in pairs(scaling_data) do | ||
| Line 453: | Line 452: | ||
-- Track scaling values for data attributes | -- Track scaling values for data attributes | ||
if (scaling_type == "Spirit") then | |||
spirit_scale = scaling_val | |||
stat_value = stat_value + (spirit_power * scaling_val) | |||
elseif (scaling_type == "Level") then | |||
level_scale = scaling_val | |||
stat_value = stat_value + (power_increases * scaling_val) | |||
end | |||
end | end | ||
end | end | ||
| Line 501: | Line 495: | ||
-- Build data attributes for JavaScript manipulation | -- Build data attributes for JavaScript manipulation | ||
local data_attrs = string.format( | local data_attrs = string.format( | ||
'data-base="%s" data-spirit-scale="%s" data-level-scale="%s" data-innate-spirit-scale="%s"%s', | 'data-base="%s" data-spirit-scale="%s" data-level-scale="%s" data-innate-spirit-scale="%s" data-sort-value="%s"', | ||
tostring(type(base_value) == "number" and util_module.round_to_sig_fig(base_value, 3) or base_value), | tostring(type(base_value) == "number" and util_module.round_to_sig_fig(base_value, 3) or base_value), | ||
tonumber(spirit_scale) or 0, | tonumber(spirit_scale) or 0, | ||
(attr_key == "TechPower") and "0" or (tonumber(level_scale) or 0), | (attr_key == "TechPower") and "0" or (tonumber(level_scale) or 0), -- Keep this TechPower check to prevent double-scaling | ||
innate_spirit_scale or 0, | innate_spirit_scale or 0, | ||
stat_value | |||
) | ) | ||