Module:Sandbox/LVL: Difference between revisionsGive feedback
No edit summary |
No edit summary |
||
| Line 703: | Line 703: | ||
spirit_scale = 1.0 | spirit_scale = 1.0 | ||
stat_value = stat_value + (spirit_power * spirit_scale) | stat_value = stat_value + (spirit_power * spirit_scale) | ||
end | |||
-- Calculate innate TechPower scaling for this hero | |||
local innate_spirit_scale = 1.1 -- Default for most heroes | |||
if hero_data["LevelScaling"] and hero_data["LevelScaling"]["TechPower"] then | |||
innate_spirit_scale = hero_data["LevelScaling"]["TechPower"] | |||
elseif hero_data["Spirit"] and hero_data["Spirit"]["LevelScaling"] then | |||
innate_spirit_scale = hero_data["Spirit"]["LevelScaling"] | |||
end | end | ||
| Line 710: | Line 718: | ||
-- Convert from boolean to string, or round it | -- Convert from boolean to string, or round it | ||
if (type(stat_value)) == 'boolean' then | if (type(stat_value)) == 'boolean' then | ||
stat_value = tostring(stat_value) | |||
else | else | ||
stat_value = util_module.round_to_sig_fig(stat_value, 3) | |||
end | end | ||
-- Build data attributes for JavaScript manipulation | -- Build data attributes for JavaScript manipulation (ONLY ONCE) | ||
local data_attrs = string.format( | local data_attrs = string.format( | ||
'data-base="%s" data-spirit-scale="%s" data-level-scale="%s"%s', | 'data-base="%s" data-spirit-scale="%s" data-level-scale="%s" data-innate-spirit-scale="%s"%s', | ||
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, | ||
tonumber(level_scale) or 0, | tonumber(level_scale) or 0, | ||
innate_spirit_scale, -- Pass the scale (e.g., 1.1), not calculated value | |||
is_resist and ' data-is-resist="true"' or '' | is_resist and ' data-is-resist="true"' or '' | ||
) | ) | ||
| Line 726: | Line 735: | ||
-- Add it to the row with data attributes and span wrapper | -- Add it to the row with data attributes and span wrapper | ||
row_str = row_str .. string.format( | row_str = row_str .. string.format( | ||
'<td %s><span class="stat-num">%s</span>%s</td>', | |||
data_attrs, | |||
stat_value, | |||
scaling_strs | |||
) | ) | ||
end | end | ||