Module:Abilities/card: Difference between revisions

LVL (talk | contribs)
Fix Fire Scarabs T3 upgrade description: suppress "0 DPS" and show "Increased Spirit scaling". Refactor create_description to handle scaling‑only properties
weapon power scaling value
Line 317: Line 317:
local hero = get_hero_data(hero_key)
local hero = get_hero_data(hero_key)
value = prop.Value + hero.HeavyMeleeDamage * prop.Scale.Value
value = prop.Value + hero.HeavyMeleeDamage * prop.Scale.Value
elseif prop.Scale and prop.Scale.Type == 'weapon_power' then
local hero = get_hero_data(hero_key)
value = hero.Weapon.BulletDamage * hero.Weapon.BulletsPerBurst * (prop.Scale.Value + 100) / 100
end
end
Line 388: Line 391:
local alt_boxes = {}
local alt_boxes = {}
for k, prop in pairs(props) do
    for k, prop in pairs(props) do
-- Some props don't have values, as those come from upgrades
    -- Some props don't have values, as those come from upgrades
-- For now, we will ignore these and only show data for the base ability
    -- For now, we will ignore these and only show data for the base ability
if prop.Value then
    if prop.Value then
local icon = Icon.getAttrIcon(prop.Type)
    local icon = Icon.getAttrIcon(prop.Type)
local alt_box = frame:expandTemplate{
 
title = "Ability_card_v2/Card/AltBox",
    local value = prop.Value
args = {
 
key = prop.Key,
    if prop.Scale and prop.Scale.Type == 'weapon_power' then
value = prop.Value,
    local hero = get_hero_data(hero_key)
icon = icon and icon.img,
    value = hero.Weapon.BulletDamage * hero.Weapon.BulletsPerBurst * (prop.Scale.Value + 100) / 100
icon_link = icon and icon.link,
    end
icon_color = icon and icon.color,
 
icon_size = icon and icon.size,
    local alt_box = frame:expandTemplate{
scale_value = prop.Scale and commonutils.round_to_sig_fig(prop.Scale.Value, 3),
    title = "Ability_card_v2/Card/AltBox",
scale_type = prop.Scale and prop.Scale.Type,
    args = {
hide = prop.Value == 0 and "true" or "false",
    key = prop.Key,
}
    value = value,
}
    icon = icon and icon.img,
table.insert(alt_boxes, alt_box)
    icon_link = icon and icon.link,
end
    icon_color = icon and icon.color,
end
    icon_size = icon and icon.size,
    scale_value = prop.Scale and commonutils.round_to_sig_fig(prop.Scale.Value, 3),
    scale_type = prop.Scale and prop.Scale.Type,
    hide = value == 0 and "true" or "false",
    }
    }
    table.insert(alt_boxes, alt_box)
    end
    end
return alt_boxes
return alt_boxes