Editing Module:AbilityTable/ComplexRenderers

Warning: You are not logged in. Once you make an edit, a temporary account will be created for you. Learn more. Log in or create an account to continue receiving notifications after this account expires, and to access other features.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision Your text
Line 110: Line 110:
     end
     end
     return out
     return out
end
-- Formats a 0–1 multiplier as a percentage: 0.2 → "20%", 0.125 → "12.5%".
-- %.10g absorbs floating-point noise from the ×100.
local function format_percent(v)
    return string.format("%.10g", v * 100) .. "%"
end
end


Line 593: Line 587:
     if #segments == 0 then return {} end
     if #segments == 0 then return {} end
     return { ["Debuff Resist"] = table.concat(segments, " → ") }
     return { ["Debuff Resist"] = table.concat(segments, " → ") }
end
-- Renders how much of an ability's damage applies to objectives (Guardians,
-- Walkers, Patron, Mid-Boss). BossDamageScale is a 0–1 multiplier shown as a
-- percentage: 0.2 → "20%". The field never appears in upgrade tiers, so only
-- the base value is read; sub-ability records are checked as a fallback when
-- the main record lacks it.
function p.RenderBossDamageScale(ability)
    local v = unwrap_value(ability["BossDamageScale"])
    if (v == nil or v == 0) and type(ability["_subabilities"]) == "table" then
        for _, sub in ipairs(ability["_subabilities"]) do
            local sv = unwrap_value(sub["BossDamageScale"])
            if sv and sv ~= 0 then v = sv; break end
        end
    end
    if v == nil or v == 0 then return {} end
    return { ["Damage to Objectives"] = format_percent(v) }
end
end


return p
return p
Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Deadlock:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template