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 1: Line 1:
-- Complex cell renderers for AbilityTable.
-- Complex cell renderers for AbilityTable.
local Lists = require("Module:AbilityTable/Lists")
local Lists   = require("Module:AbilityTable/Lists")
local GameData = require("Module:GameData")


-- ============================================================
-- ============================================================
Line 47: Line 48:
end
end


-- Sums the non-zero values of `fields` within a single record layer (the base
-- Returns true if prop exists with a non-zero value anywhere in the record
-- ability record, or one upgrade tier). Returns nil when none are present.
-- excluding the Upgrades key.
local function sum_fields(layer, fields)
local function is_base_property(record, prop)
    local total = nil
     for k, v in pairs(record) do
     for _, field in ipairs(fields) do
         if k == "Upgrades" then
         local v = unwrap_value(layer[field])
            -- skip
        if v and v ~= 0 then total = (total or 0) + math.abs(v) end
         elseif k == prop then
    end
             if type(v) == "table" then v = v["Value"] end
    return total
            if v ~= nil and v ~= 0 and v ~= "" and v ~= "0" and v ~= "0m" then
end
                return true
 
-- Sums the barrier value and Spirit scaling contributed by a single record
-- layer (the base ability record, or one upgrade tier). Returns nil when the
-- layer grants no barrier at all; a tier that only raises the scaling still
-- counts, so "+0 value, +1.0 scaling" upgrades are not lost.
local function sum_barrier(layer, fields)
    local value, scale, found = 0, 0, false
    for _, field in ipairs(fields) do
         local entry = layer[field]
        if entry ~= nil then
            local v = unwrap_value(entry) or 0
            local s = 0
             if type(entry) == "table" and type(entry["Scale"]) == "table" then
                s = entry["Scale"]["Value"] or 0
             end
             end
             if v ~= 0 or s ~= 0 then found = true end
        elseif type(v) == "table" then
            value = value + v
             if is_base_property(v, prop) then return true end
             scale = scale + s
        elseif type(v) == "string" then
             if v == prop then return true end
         end
         end
     end
     end
     if not found then return nil end
     return false
    return value, scale
end
end


-- Pads a whole-number scaling out to one decimal, so a running total of 2
-- ============================================================
-- reads "2.0" next to its "1.5" neighbours instead of "2". Values that already
-- Debuff short names (used by RenderDebuff)
-- carry decimals are left alone, which keeps precision on things like 0.75.
-- ============================================================
local function format_scale(scale)
    local text = tostring(scale)
    if not text:find(".", 1, true) then text = text .. ".0" end
    return text
end


-- Formats one barrier step. Spirit scaling goes through the compact {{Ss}}
local debuff_short_name = {
-- form, expanded via the frame the surrounding #invoke is already running
    ["StunDuration"]              = "stun",
-- under: module return values are not re-expanded, so a literal "{{Ss|0.8}}"
    ["SleepDuration"]              = "sleep",
-- would reach the page as text. The plain fallback covers a nil frame
    ["SilenceDuration"]            = "silence",
-- (module console).
    ["SilenceDebuff"]              = "silence",
local function format_barrier(value, scale)
    ["PetrifyDuration"]            = "petrify",
     local out = tostring(value)
    ["HexDuration"]                = "hex",
     if scale and scale ~= 0 then
    ["ImmobilizeDuration"]        = "immobilize",
        local scale_text = format_scale(scale)
    ["LiftDuration"]              = "lift",
        local frame = mw.getCurrentFrame()
     ["HoldInPlaceDuration"]        = "immobilize",
        if frame then
     ["RestrictionDuration"]        = "immobilize",
            out = out .. " " .. frame:expandTemplate{
    ["SlowPercent"]                = "slow",
                title = "Ss",
    ["EnemySlowPct"]              = "slow",
                args  = { scale_text, compact = "1", show_value = "1" },
    ["MoveSlowPercent"]            = "slow",
            }
    ["GroundDashReductionPercent"] = "dash slow",
        else
    ["SlowDuration"]              = "slow",
            out = out .. " ×" .. scale_text
    ["MaxSlowDuration"]            = "slow",
        end
    ["BulletDamageAmpDuration"]    = "bullet amp",
     end
    ["BulletResistReduction"]      = "bullet resist reduction",
     return out
    ["TimeSlowDuration"]          = "time slow",
end
    ["LateCheckoutStun"]          = "stun",
    ["BurnDuration"]              = "burn",
    ["BleedDuration"]              = "bleed",
     ["VenomDuration"]              = "venom",
     ["TossDuration"]              = "knockback",
}


-- ============================================================
-- ============================================================
-- Generic renderer for a single numeric stat that can increase
-- Generic renderer for a single numeric stat column.
-- additively through upgrades. Shows value in a named column
-- col_name: column header string
-- and generates upgrade notes with running totals.
-- fields:  ordered list of property names (first non-zero wins)
-- Note: auto-generated notes omit trailing periods; the main
-- suffix:   string appended to values in cell and upgrade notes
-- module's ensure_period handles that.
-- ============================================================
-- ============================================================


local function render_upgradable_stat(ability, col_name, fields, suffix)
local function val_stat_cells(ability, col_name, fields, suffix)
     suffix = suffix or ""
     suffix = suffix or ""
     local cells = {}
     local cells = {}
Line 151: Line 137:
                         table.insert(notes, "T" .. i .. " upgrade increases "
                         table.insert(notes, "T" .. i .. " upgrade increases "
                             .. col_name:lower() .. " by " .. delta .. suffix
                             .. col_name:lower() .. " by " .. delta .. suffix
                             .. " (total " .. total .. suffix .. ")")
                             .. " (total " .. total .. suffix .. ").")
                         running = total
                         running = total
                     end
                     end
Line 169: Line 155:
local p = {}
local p = {}


-- Renders the barrier an ability grants, with its Spirit Power scaling.
-- Charges: shows base charges, time between charges, and upgrade notes.
-- Both the value and the scaling accumulate across upgrades, so every step
-- after the first shows the running total: "100 x0.8 → 180 x1.5 (T2)".
-- A tier that only improves the scaling still gets its own segment.
function p.RenderBarrier(ability)
    local fields  = Lists.lists["barrier"]
    local segments = {}
 
    local value, scale = sum_barrier(ability, fields)
    if value then
        table.insert(segments, format_barrier(value, scale))
    else
        value, scale = 0, 0
    end
 
    local upgrades = ability["Upgrades"]
    if type(upgrades) == "table" then
        for i, tier in ipairs(upgrades) do
            if type(tier) == "table" then
                local delta_value, delta_scale = sum_barrier(tier, fields)
                if delta_value then
                    value, scale = value + delta_value, scale + delta_scale
                    table.insert(segments,
                        format_barrier(value, scale) .. " (T" .. i .. ")")
                end
            end
        end
    end
 
    if #segments == 0 then return {} end
    return { ["Barrier"] = table.concat(segments, " → ") }
end
 
-- Renders charge count and time between charges.
-- Special case for abilities that gain charges only through upgrades.
function p.RenderCharges(ability)
function p.RenderCharges(ability)
     local base_charges  = unwrap_value(ability["AbilityCharges"])
     local base_charges  = unwrap_value(ability["AbilityCharges"])
     local base_cooldown = unwrap_value(ability["AbilityCooldownBetweenCharge"])
     local base_cooldown = ability["AbilityCooldownBetweenCharge"]
     local has_base      = base_charges ~= nil and base_charges > 0
     local has_base      = base_charges ~= nil and base_charges > 0
     local upgrade_info  = find_in_upgrades(ability, "AbilityCharges")
     local upgrade_info  = find_in_upgrades(ability, "AbilityCharges")
Line 237: Line 189:
         local charge_str = n .. " charge" .. (n ~= 1 and "s" or "")
         local charge_str = n .. " charge" .. (n ~= 1 and "s" or "")
         if has_base then
         if has_base then
             table.insert(note_parts, "+" .. charge_str .. " on T" .. upgrade_info.tier .. " upgrade")
             table.insert(note_parts, "+" .. charge_str .. " on T" .. upgrade_info.tier .. " upgrade.")
         else
         else
             local cd_str = upgrade_cooldown and (upgrade_cooldown .. "s") or "unknown"
             local cd_str = upgrade_cooldown and (upgrade_cooldown .. "s") or "unknown"
             table.insert(note_parts, "Becomes charged on T" .. upgrade_info.tier
             table.insert(note_parts, "Becomes charged on T" .. upgrade_info.tier
                 .. " upgrade with " .. charge_str
                 .. " upgrade with " .. charge_str
                 .. " and " .. cd_str .. " time between charges")
                 .. " and " .. cd_str .. " time between charges.")
         end
         end
     end
     end
     if ability["AbilityChargesConditionally"] ~= nil then
     if ability["AbilityChargesConditionally"] ~= nil then
         table.insert(note_parts, "Has a conditional charge")
         table.insert(note_parts, "Has a conditional charge.")
     end
     end
     if #note_parts > 0 then
     if #note_parts > 0 then
Line 255: Line 207:
end
end


-- Renders base damage and melee scaling.
-- Melee: shows light melee scaling and upgrade notes.
-- Special case for upgrades that switch from Light to Heavy Melee scaling.
function p.RenderMelee(ability)
function p.RenderMelee(ability)
     local melee_types = {}
     local function find_base_melee_scale(ability)
    for _, t in ipairs(Lists.lists["melee"]) do melee_types[t] = true end
        for _, v in pairs(ability) do
 
            if type(v) == "table" then
    -- Find the base property with active melee/heavy_melee scaling (Scale.Value > 0)
                local scale = v["Scale"]
    local base_prop, base_damage, base_scale, base_type
                if type(scale) == "table"
    for k, v in pairs(ability) do
                    and scale["Type"] == "melee"
        if k ~= "Upgrades" and type(v) == "table" then
                    and type(scale["Value"]) == "number"
            local scale = v["Scale"]
                    and scale["Value"] > 0
            if type(scale) == "table" and melee_types[scale["Type"]]
                 then
              and type(scale["Value"]) == "number" and scale["Value"] > 0 then
                    return scale["Value"]
                 base_prop = k
                 end
                base_damage = v["Value"] or 0
                base_scale = scale["Value"]
                 base_type = scale["Type"]
                break
             end
             end
         end
         end
        return nil
     end
     end


     local cells = {}
     local cells = {}
     cells["Base Damage"] = tostring(base_damage or 0)
     local base_scale = find_base_melee_scale(ability)
     if base_scale then
     if base_scale then cells["Light Melee Scaling"] = "×" .. base_scale end
        cells["Light Melee Scaling"] = "×" .. base_scale
    end


     local upgrades = ability["Upgrades"]
     local upgrades = ability["Upgrades"]
     if type(upgrades) ~= "table" then return cells end
     if type(upgrades) ~= "table" then return cells end
     local notes = {}
     local notes = {}
    local running_damage = base_damage or 0
    local running_scale = base_scale or 0
    local running_type = base_type
     for i, tier in ipairs(upgrades) do
     for i, tier in ipairs(upgrades) do
         if type(tier) == "table" then
         if type(tier) == "table" then
            local damage_delta = 0
             for _, v in pairs(tier) do
            local new_scale = nil
            local new_type = nil
 
             for k, v in pairs(tier) do
                 if type(v) == "table" then
                 if type(v) == "table" then
                     local scale = v["Scale"]
                     local scale = v["Scale"]
                     if type(scale) == "table" and melee_types[scale["Type"]] then
                     if type(scale) == "table" and type(scale["Value"]) == "number" then
                         damage_delta = damage_delta + (v["Value"] or 0)
                         local stype = scale["Type"]
                         if scale["Value"] > 0 then
                         local delta = scale["Value"]
                             new_scale = scale["Value"]
                        if stype == "heavy_melee" and delta > 0 then
                             new_type = scale["Type"]
                             table.insert(notes, "T" .. i .. " upgrade changes scaling to ×"
                                .. delta .. " of Heavy Melee damage.")
                        elseif stype == "melee" and delta ~= 0 and base_scale then
                             local final = math.floor((base_scale + delta) * 1000 + 0.5) / 1000
                            table.insert(notes, "T" .. i .. " upgrade adds ×"
                                .. delta .. " scaling (total ×" .. final .. ").")
                         end
                         end
                     end
                     end
                 end
                 end
             end
             end
        end
    end
    if #notes > 0 then cells["Notes"] = table.concat(notes, " ") end
    return cells
end


            local flat_delta = 0
-- HealReduce: shows heal reduction percentage and upgrade notes.
            if base_prop and type(tier[base_prop]) == "number" then
function p.RenderHealReduce(ability)
                flat_delta = tier[base_prop]
    local cells = {}
            end
    local notes = {}
    local stat_props = Lists.props["healreduce"]


            local tier_parts = {}
    local first_pct, first_tier, first_is_disable = nil, nil, false


            if new_type and new_type ~= running_type then
    for _, prop in ipairs(stat_props) do
                running_damage = running_damage + damage_delta
        local v = unwrap_value(ability[prop])
                running_scale = new_scale
        if v and v ~= 0 then
                running_type = new_type
             if prop == "DisableHealing" then
                local type_label = new_type == "heavy_melee" and "'''Heavy Melee'''" or "Light Melee"
                 first_is_disable = true
                local parts = {}
             else
                if running_damage > 0 then
                 first_pct = math.abs(v)
                    table.insert(parts, running_damage .. " base damage")
                end
                table.insert(parts, "×" .. new_scale .. " " .. type_label .. " scaling")
                table.insert(tier_parts, "on T" .. i .. " becomes " .. table.concat(parts, " with "))
            elseif new_scale then
                running_damage = running_damage + damage_delta
                running_scale = running_scale + new_scale
                local parts = {}
                if damage_delta ~= 0 then
                    table.insert(parts, "+" .. damage_delta .. " base damage")
                end
                table.insert(parts, "+×" .. new_scale .. " scaling (total ×" .. running_scale .. ")")
                table.insert(tier_parts, "on T" .. i .. " gets " .. table.concat(parts, ", "))
            end
 
             if flat_delta ~= 0 and not new_scale then
                 running_damage = running_damage + flat_delta
                table.insert(tier_parts, "on T" .. i .. " gets +" .. flat_delta .. " base damage (total " .. running_damage .. ")")
            end
 
             if #tier_parts > 0 then
                 table.insert(notes, table.concat(tier_parts, ", "))
             end
             end
            break
         end
         end
     end
     end
 
     if not first_pct and not first_is_disable then
     if #notes > 0 then cells["Notes"] = table.concat(notes, ". ") end
        local upgrades = ability["Upgrades"]
    return cells
        if type(upgrades) == "table" then
end
            for i, tier in ipairs(upgrades) do
 
                if type(tier) == "table" then
-- Renders base damage and heavy melee scaling.
                    for _, prop in ipairs(stat_props) do
-- Notes when heavy melee is only available via upgrade.
                        local v = unwrap_value(tier[prop])
function p.RenderHeavyMelee(ability)
                        if v and v ~= 0 then
    -- Find base heavy_melee property
                            if prop == "DisableHealing" then
    local base_damage, base_scale
                                first_is_disable, first_tier = true, i
    for k, v in pairs(ability) do
                            else
        if k ~= "Upgrades" and type(v) == "table" then
                                first_pct, first_tier = math.abs(v), i
            local scale = v["Scale"]
                            end
            if type(scale) == "table" and scale["Type"] == "heavy_melee"
                            break
              and type(scale["Value"]) == "number" then
                        end
                base_damage = v["Value"] or 0
                    end
                 base_scale = scale["Value"]
                 end
                 break
                 if first_pct or first_is_disable then break end
             end
             end
         end
         end
     end
     end


    local cells = {}
     if first_is_disable then
 
         cells["Heal Reduction"] = "100%" .. (first_tier and " (T" .. first_tier .. ")" or "")
    -- Active at base
    elseif first_pct then
     if base_scale and base_scale > 0 then
         cells["Heal Reduction"] = tostring(first_pct) .. "%" .. (first_tier and " (T" .. first_tier .. ")" or "")
         cells["Base Damage"] = tostring(base_damage)
         cells["Heavy Melee Scaling"] = "×" .. base_scale
        return cells
     end
     end


    -- Not at base — find in upgrades
     local upgrades = ability["Upgrades"]
     local upgrades = ability["Upgrades"]
     if type(upgrades) ~= "table" then return cells end
     if type(upgrades) == "table" then
 
        local running        = first_pct
    for i, tier in ipairs(upgrades) do
        local first_pct_seen = (first_tier == nil)
        if type(tier) == "table" then
        for i, tier in ipairs(upgrades) do
            for k, v in pairs(tier) do
            if type(tier) == "table" then
                if type(v) == "table" then
                if first_tier == i then
                    local scale = v["Scale"]
                    first_pct_seen = true
                    if type(scale) == "table" and scale["Type"] == "heavy_melee"
                    if first_pct then running = first_pct end
                      and type(scale["Value"]) == "number" and scale["Value"] > 0 then
                elseif first_pct_seen then
                         cells["Base Damage"] = tostring(v["Value"] or 0)
                    local delta = nil
                         cells["Heavy Melee Scaling"] = "×" .. scale["Value"]
                    for _, prop in ipairs(stat_props) do
                        cells["Notes"] = "Only becomes Heavy Melee on '''T" .. i .. "''' upgrade"
                        if prop ~= "DisableHealing" then
                         return cells
                            local v = unwrap_value(tier[prop])
                            if v and v ~= 0 then delta = math.abs(v); break end
                        end
                    end
                    if delta then
                         local total = (running or 0) + delta
                         table.insert(notes, "T" .. i .. " upgrade increases heal reduction by "
                            .. delta .. "% (total " .. total .. "%).")
                         running = total
                     end
                     end
                 end
                 end
Line 401: Line 332:
     end
     end


    if #notes > 0 then cells["Notes"] = table.concat(notes, " ") end
     return cells
     return cells
end
end


-- Renders Spirit Power scaling.
-- Debuff: shared by debuffresist and dispelmagic.
-- Shows the Scale.Value for abilities whose Scale.Type is "spirit".
-- Outputs upgrade-tier notes for debuffs added only in upgrades (not at base).
function p.RenderSpiritScaling(ability)
function p.RenderDebuff(ability, stat)
     local base_scale = nil
     local stat_props = Lists.props[stat]
     local base_prop = nil
     local cells = {}


     -- Find base Spirit scaling
     -- If any prop exists in base, this is a base-level debuff — no note needed.
     for k, v in pairs(ability) do
     for _, prop in ipairs(stat_props) do
         if k ~= "Upgrades" and type(v) == "table" then
         if is_base_property(ability, prop) then
            local scale = v["Scale"]
             return cells
            if type(scale) == "table"
              and scale["Type"] == "spirit"
              and type(scale["Value"]) == "number"
              and scale["Value"] ~= 0 then
                base_scale = scale["Value"]
                base_prop = k
                break
             end
         end
         end
    end
    local cells = {}
    if base_scale then
        cells["Spirit Scaling"] = "×" .. base_scale
     end
     end


Line 434: Line 352:
     if type(upgrades) ~= "table" then return cells end
     if type(upgrades) ~= "table" then return cells end


     local notes = {}
     local tier_debuffs = {}
    local seen_names  = {}


     for i, tier in ipairs(upgrades) do
     for i, tier in ipairs(upgrades) do
         if type(tier) == "table" then
         if type(tier) == "table" then
             local upgrade_scale = nil
             local names_this_tier = {}
 
            local seen_this_tier  = {}
             for k, v in pairs(tier) do
             for _, prop in ipairs(stat_props) do
                 if type(v) == "table" then
                 local v = tier[prop]
                    local scale = v["Scale"]
                if v ~= nil then
                     if type(scale) == "table"
                    if type(v) == "table" then v = v["Value"] end
                      and scale["Type"] == "spirit"
                     if v ~= nil and v ~= 0 and v ~= "" and v ~= "0" and v ~= "0m" then
                      and type(scale["Value"]) == "number"
                        local short = debuff_short_name[prop] or "debuff"
                      and scale["Value"] ~= 0 then
                        if not seen_this_tier[short] then
                        upgrade_scale = scale["Value"]
                            seen_this_tier[short] = true
                         break
                            if not seen_names[short] then
                                seen_names[short] = true
                                table.insert(names_this_tier, short)
                            end
                         end
                     end
                     end
                 end
                 end
             end
             end
 
             if #names_this_tier > 0 then
             if upgrade_scale then
                 tier_debuffs[i] = names_this_tier
                 table.insert(notes,
                    "on T" .. i .. " gets +×" .. upgrade_scale .. " Spirit scaling")
             end
             end
         end
         end
     end
     end


     if #notes > 0 then
     local tier_indices = {}
         cells["Notes"] = table.concat(notes, ". ")
    for i in pairs(tier_debuffs) do table.insert(tier_indices, i) end
    table.sort(tier_indices)
 
    local parts = {}
    for _, i in ipairs(tier_indices) do
         table.insert(parts, "T" .. i .. " " .. table.concat(tier_debuffs[i], " + "))
     end
     end


    if #parts > 0 then cells["Notes"] = table.concat(parts, ", ") end
     return cells
     return cells
end
end


-- Renders heal reduction percentage.
-- MoveSlow: shows move slow percentage and caster slow note if present.
-- Special case for DisableHealing, shown as 100%.
function p.RenderHealReduce(ability)
    -- DisableHealing is always 100%, handle it separately
    local v = unwrap_value(ability["DisableHealing"])
    if v and v ~= 0 then
        return { ["Heal Reduction"] = "100%" }
    end
    local upgrade = find_in_upgrades(ability, "DisableHealing")
    if upgrade then
        return { ["Heal Reduction"] = "100% (T" .. upgrade.tier .. ")" }
    end
 
    -- Everything else goes through the generic renderer
    local filtered = {}
    for _, prop in ipairs(Lists.lists["healreduce"]) do
        if prop ~= "DisableHealing" then table.insert(filtered, prop) end
    end
    return render_upgradable_stat(ability, "Heal Reduction", filtered, "%")
end
 
-- Renders move slow percentage.
-- Appends a note if the ability also self-slows the caster.
function p.RenderMoveSlow(ability)
function p.RenderMoveSlow(ability)
     local cells = render_upgradable_stat(ability, "Move Slow", Lists.lists["moveslow"], "%")
     local cells = val_stat_cells(ability, "Move Slow", Lists.props["moveslow"], "%")


     local channel_slow = unwrap_value(ability["ChannelSlowPercent"])
     local channel_slow = unwrap_value(ability["ChannelSlowPercent"])
     if channel_slow and channel_slow ~= 0 then
     if channel_slow and channel_slow ~= 0 then
         local note = "Also slows the caster for " .. math.abs(channel_slow) .. "%"
         local note = "Also slows the caster for " .. math.abs(channel_slow) .. "%."
         cells["Notes"] = cells["Notes"] and (cells["Notes"] .. "; " .. note) or note
         cells["Notes"] = cells["Notes"] and (cells["Notes"] .. "; " .. note) or note
     end
     end
Line 502: Line 407:
end
end


-- Renders dash slow percentage.
-- DashSlow: shows dash slow percentage, auto-detects caster self-slow.
-- Special case for GroundDashReductionPercent coexisting with another dashslow
-- prop, which means it's a caster self-slow and is noted separately.
function p.RenderDashSlow(ability)
function p.RenderDashSlow(ability)
     local stat_props = Lists.lists["dashslow"]
     local stat_props = Lists.props["dashslow"]
     local props = {}
     local props = {}
     for _, pr in ipairs(stat_props) do table.insert(props, pr) end
     for _, p in ipairs(stat_props) do table.insert(props, p) end


     local caster_dash_slow = nil
     local caster_dash_slow = nil
Line 548: Line 451:
     end
     end


     local cells = render_upgradable_stat(ability, "Dash Slow", props, "%")
     local cells = val_stat_cells(ability, "Dash Slow", props, "%")


     if caster_dash_slow then
     if caster_dash_slow then
         local note = "Gives " .. caster_dash_slow .. "% dash slow for the caster"
         local note = "Gives " .. caster_dash_slow .. "% dash slow for the caster."
         cells["Notes"] = cells["Notes"] and (cells["Notes"] .. "; " .. note) or note
         cells["Notes"] = cells["Notes"] and (cells["Notes"] .. "; " .. note) or note
     end
     end


     return cells
     return cells
end
-- Renders the amount of Debuff Resist an ability grants.
-- Upgrades stack additively onto the base value, so every step after the first
-- shows the running total: "20% (T3)" when granted only by an upgrade,
-- "10% → 25% (T2)" when a base value is later increased. Chains for any number
-- of steps. No ability currently has both a base and an upgrade value.
function p.RenderExtraDebuffResist(ability)
    local fields  = Lists.lists["extradebuffresist"]
    local segments = {}
    local running = sum_fields(ability, fields)
    if running then
        table.insert(segments, running .. "%")
    end
    local upgrades = ability["Upgrades"]
    if type(upgrades) == "table" then
        for i, tier in ipairs(upgrades) do
            if type(tier) == "table" then
                local delta = sum_fields(tier, fields)
                if delta then
                    running = (running or 0) + delta
                    table.insert(segments, running .. "% (T" .. i .. ")")
                end
            end
        end
    end
    if #segments == 0 then return {} end
    return { ["Debuff Resist"] = table.concat(segments, " → ") }
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