Module:Abilities/card: Difference between revisions

added melee scaling
add line break in generated upgrade descriptions
Line 369: Line 369:


function create_description(prop, frame)
function create_description(prop, frame)
local description = ''
    local description = ''
for k, v in pairs(prop) do
    local first = true  -- Track if it's the first entry
if type(v) ~= 'table' then
 
local formatted_value = utils.format_value_with_prepost(k, v, frame)
    for k, v in pairs(prop) do
local attr_name = lang.get_string(k..'_label')
        if type(v) ~= 'table' then
description = description .. string.format('%s %s', formatted_value, attr_name)
            local formatted_value = utils.format_value_with_prepost(k, v, frame)
end
            local attr_name = lang.get_string(k..'_label')
end
           
            -- Add line break if this is not the first item
return description
            if not first then
                description = description .. '<br>'
            end
 
            description = description .. string.format('%s %s', formatted_value, attr_name)
            first = false  -- After first item
        end
    end
 
    return description
end
end