Module:Abilities/card: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Handle attributes carrying multiple scalings by picking the first one that renders, so real coefficients are not dropped when paired with a hidden stat-category marker (with help from vergir-bot LLM) |
Keep zero-valued scalings from multi-scaling attributes so the placeholder badge still renders and upgrades can populate it, fixing Doorman's Doorway distance scaling (with help from vergir-bot LLM) |
||
| Line 198: | Line 198: | ||
-- healing, charges) that always hold a value of 1 and are never displayed, so | -- healing, charges) that always hold a value of 1 and are never displayed, so | ||
-- return the first entry that actually renders a badge. | -- return the first entry that actually renders a badge. | ||
-- A zero-valued scaling is still returned when nothing else is displayable. The | |||
-- card renders it as an x0 placeholder, and the ability upgrade gadget fills | |||
-- that element in when an upgrade grants real scaling (Doorman's Doorway). | |||
local function pick_scale(attr) | local function pick_scale(attr) | ||
if not attr then | if not attr then | ||
| Line 213: | Line 216: | ||
end | end | ||
local placeholder = nil | |||
for _, entry in ipairs(scale) do | for _, entry in ipairs(scale) do | ||
if type(entry) == 'table' | if type(entry) == 'table' and Icon.isDisplayedScale(entry.Type) then | ||
return entry | if entry.Value ~= 0 then | ||
return entry | |||
end | |||
placeholder = placeholder or entry | |||
end | end | ||
end | end | ||
return | return placeholder | ||
end | end | ||