Module:HeroData: Difference between revisions

Jump to navigation Jump to search
Sur (talk | contribs)
m bugfix for in develop/disabled
Sur (talk | contribs)
m hero comp; hide icons if PI/SS are 0/nil
Line 346: Line 346:


--writes the massive hero comparison table for a specific PI and SP
--writes the massive hero comparison table for a specific PI and SP
-- scaling icons are shown only if PI and SP are both 0 or both not provided
--{{#invoke:HeroData|write_hero_comparison_table|POWER_INCREASES|SPIRIT_POWER}}
--{{#invoke:HeroData|write_hero_comparison_table|POWER_INCREASES|SPIRIT_POWER}}
p.write_hero_comparison_table = function(frame)
p.write_hero_comparison_table = function(frame)
Line 353: Line 354:
local spirit_power = frame.args[2]
local spirit_power = frame.args[2]
if (spirit_power == nil) then spirit_power = 0 end
if (spirit_power == nil) then spirit_power = 0 end
-- Show scaling icons if power/increases/spirit power are 0/not specified
local display_scaling_icons = false
if (power_increases == 0 and spirit_power == 0) then
display_scaling_icons = true
end
-- Initializations and declarations
-- Initializations and declarations
Line 366: Line 373:
-- Exclude some specific stats which are currently constant for all heroes at a negligible value
-- Exclude some specific stats which are currently constant for all heroes at a negligible value
-- TODO extract from data directly
local stats_to_exclude = {
local stats_to_exclude = {
BaseWeaponDamageIncrease = true,
BaseWeaponDamageIncrease = true,
Line 431: Line 439:
scalar_str = p.get_hero_scalar_str(hero_data, attr_key)
scalar_str = p.get_hero_scalar_str(hero_data, attr_key)
if (scalar_str ~= "") then scalar_str = " " .. scalar_str end
if (scalar_str ~= "") then scalar_str = " " .. scalar_str end
if (not display_scaling_icons) then scalar_str = "" end
-- Add it to the row
-- Add it to the row