Module:Sandbox/LVL: Difference between revisionsGive feedback
Jump to navigation
Jump to search
No edit summary |
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: | -- Base value: special cases for alt-fire row | ||
local base_value | local base_value | ||
if is_alt_fire | if is_alt_fire then | ||
-- ClipSize always uses primary | |||
if attr_key == "ClipSize" then | |||
base_value = get_nested_stat_value(hero_data, attr_key) | |||
elseif hero_data.Weapon and hero_data.Weapon.AltFire | |||
and hero_data.Weapon.AltFire[attr_key] ~= nil then | |||
base_value = hero_data.Weapon.AltFire[attr_key] | |||
else | |||
base_value = get_nested_stat_value(hero_data, attr_key) | |||
end | |||
else | else | ||
base_value = get_nested_stat_value(hero_data, attr_key) | base_value = get_nested_stat_value(hero_data, attr_key) | ||
| Line 133: | Line 140: | ||
local stat_value = base_value | local stat_value = base_value | ||
-- Scaling: | -- Scaling: special cases for alt-fire row | ||
local scaling_data | local scaling_data | ||
if is_alt_fire and hero_data.Weapon and hero_data.Weapon.AltFire | if is_alt_fire then | ||
-- ClipSize always uses primary scaling | |||
if attr_key == "ClipSize" then | |||
scaling_data = hero_data_module.get_hero_scaling_data(hero_data, attr_key) | |||
-- Shiv's alt‑fire BulletDamage uses primary scaling | |||
elseif hero_key == "hero_shiv" and attr_key == "BulletDamage" then | |||
scaling_data = hero_data_module.get_hero_scaling_data(hero_data, attr_key) | |||
elseif 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") | |||
else | |||
scaling_data = hero_data_module.get_hero_scaling_data(hero_data, attr_key) | |||
end | |||
else | else | ||
scaling_data = hero_data_module.get_hero_scaling_data(hero_data, attr_key) | scaling_data = hero_data_module.get_hero_scaling_data(hero_data, attr_key) | ||
| Line 253: | Line 270: | ||
end | end | ||
-- | -- Alt-fire scaling (only for stats that truly appear in AltFire) | ||
if hero_data.Weapon | if hero_data.Weapon | ||
and hero_data.Weapon.AltFire | and hero_data.Weapon.AltFire | ||
and hero_data.Weapon.AltFire[attr_key] ~= nil | and hero_data.Weapon.AltFire[attr_key] ~= nil | ||
then | then | ||
local alt_scaling = hero_data_module.get_hero_scaling_data(hero_data, attr_key .. "AltFire") | -- Skip ClipSize (we always use primary scaling, no alt column needed) | ||
if attr_key == "ClipSize" then | |||
-- do nothing | |||
elseif hero_entry.key == "hero_shiv" and attr_key == "BulletDamage" then | |||
-- Shiv's alt‑fire BulletDamage uses primary scaling; already counted | |||
else | |||
local alt_scaling = hero_data_module.get_hero_scaling_data(hero_data, attr_key .. "AltFire") | |||
if alt_scaling ~= nil and next(alt_scaling) ~= nil then | |||
stats_with_any_scaling[attr_key] = true | |||
local has_spirit_alt = false | |||
local has_level_alt = false | |||
for _, scaling_type in pairs(alt_scaling) do | |||
if scaling_type == "Spirit" then has_spirit_alt = true end | |||
if scaling_type == "Level" then has_level_alt = true end | |||
end | |||
if has_spirit_alt and has_level_alt then | |||
stats_with_both_scaling[attr_key] = true | |||
end | |||
end | end | ||
end | end | ||