Module:Sandbox/LVL: Difference between revisions

LVL (talk | contribs)
No edit summary
LVL (talk | contribs)
No edit summary
Line 184: Line 184:
             elseif hero_key == "hero_shiv" and attr_key == "BulletDamage" then
             elseif hero_key == "hero_shiv" and attr_key == "BulletDamage" then
                 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)
            -- NEW: compute DPS scaling if missing
             elseif (attr_key == "DPS" or attr_key == "SustainedDPS")
             elseif (attr_key == "DPS" or attr_key == "SustainedDPS")
                 and hero_data.Weapon and hero_data.Weapon.AltFire then
                 and hero_data.Weapon and hero_data.Weapon.AltFire then
                 -- try direct scaling key first
                 -- try direct scaling key (e.g., SustainedDPSAltFire)
                 local direct_scaling = hero_data_module.get_hero_scaling_data(hero_data, attr_key .. "AltFire")
                 local direct_scaling = hero_data_module.get_hero_scaling_data(hero_data, attr_key .. "AltFire")
                 if direct_scaling ~= nil then
                 if direct_scaling and next(direct_scaling) ~= nil then
                     scaling_data = direct_scaling
                     scaling_data = direct_scaling
                 else
                 else
Line 197: Line 196:
                     local level_scale = compute_dps_scaling(hero_data, alt_stats, dps_type, "Level")
                     local level_scale = compute_dps_scaling(hero_data, alt_stats, dps_type, "Level")
                     local spirit_scale = compute_dps_scaling(hero_data, alt_stats, dps_type, "Spirit")
                     local spirit_scale = compute_dps_scaling(hero_data, alt_stats, dps_type, "Spirit")
                    -- build scaling_data table like get_hero_scaling_data returns: { [scale_val] = "Level"/"Spirit" }
                     scaling_data = {}
                     scaling_data = {}
                     if level_scale ~= 0 then scaling_data[level_scale] = "Level" end
                     if level_scale ~= 0 then scaling_data[level_scale] = "Level" end
Line 346: Line 344:
                     end
                     end
                     -- alt-fire checks (unchanged, but now DPS/SustainedDPS might be computed and should be caught)
                     -- alt-fire checks (unchanged, but now DPS/SustainedDPS might be computed and should be caught)
                     if hero_data.Weapon and hero_data.Weapon.AltFire and hero_data.Weapon.AltFire[attr_key] ~= nil then
                     if hero_data.Weapon
                        and hero_data.Weapon.AltFire
                        and hero_data.Weapon.AltFire[attr_key] ~= nil
                    then
                         if attr_key ~= "ClipSize" then
                         if attr_key ~= "ClipSize" then
                             local alt_scaling = hero_data_module.get_hero_scaling_data(hero_data, attr_key .. "AltFire")
                             local alt_scaling = hero_data_module.get_hero_scaling_data(hero_data, attr_key .. "AltFire")
                             if alt_scaling and next(alt_scaling) then
                            -- Check if it's a non-empty table
                             if alt_scaling and next(alt_scaling) ~= nil then
                                 if not (hero_entry.key == "hero_shiv" and attr_key == "BulletDamage") then
                                 if not (hero_entry.key == "hero_shiv" and attr_key == "BulletDamage") then
                                     stats_with_any_scaling[attr_key] = true
                                     stats_with_any_scaling[attr_key] = true
Line 360: Line 362:
                                 end
                                 end
                             else
                             else
                                 -- check computed scaling (for DPS/SustainedDPS)
                                 -- Compute DPS scaling if direct key is missing/empty
                                 if attr_key == "DPS" or attr_key == "SustainedDPS" then
                                 if attr_key == "DPS" or attr_key == "SustainedDPS" then
                                     local alt_stats = hero_data.Weapon.AltFire
                                     local alt_stats = hero_data.Weapon.AltFire