Module:Sandbox/LVL: Difference between revisions

Jump to navigation Jump to search
LVL (talk | contribs)
No edit summary
LVL (talk | contribs)
No edit summary
Line 122: Line 122:
             if stats_to_include[category] ~= nil then
             if stats_to_include[category] ~= nil then
                 for _, attr_key in ipairs(stats_to_include[category]) do
                 for _, attr_key in ipairs(stats_to_include[category]) do
                     -- Base value: alt-fire weapon stats from AltFire table, else normal lookup
                     -- Base value: only use AltFire if the stat actually exists there
                     local base_value
                     local base_value
                     if is_alt_fire and category == "Weapon" then
                     if is_alt_fire and hero_data.Weapon and hero_data.Weapon.AltFire
                         base_value = (hero_data.Weapon.AltFire and hero_data.Weapon.AltFire[attr_key]) or 0
                         and hero_data.Weapon.AltFire[attr_key] ~= nil then
                        base_value = hero_data.Weapon.AltFire[attr_key]
                     else
                     else
                         base_value = get_nested_stat_value(hero_data, attr_key)
                         base_value = get_nested_stat_value(hero_data, attr_key)
Line 132: Line 133:
                     local stat_value = base_value
                     local stat_value = base_value


                     -- FIX 1: Scale using AltFire key only if the stat actually exists in AltFire
                     -- Scaling: only look for AltFire scaling if the stat exists in AltFire
                     local scaling_data
                     local scaling_data
                     if is_alt_fire and hero_data.Weapon and hero_data.Weapon.AltFire and hero_data.Weapon.AltFire[attr_key] ~= nil then
                     if is_alt_fire and hero_data.Weapon and hero_data.Weapon.AltFire
                        and hero_data.Weapon.AltFire[attr_key] ~= nil then
                         scaling_data = hero_data_module.get_hero_scaling_data(hero_data, attr_key .. "AltFire")
                         scaling_data = hero_data_module.get_hero_scaling_data(hero_data, attr_key .. "AltFire")
                     else
                     else