Module:AbilityTable: Difference between revisions

Vergir (talk | contribs)
mNo edit summary
Vergir (talk | contribs)
collect_effects falls back to prop name for unmapped props instead of skipping (with help from vergir-bot LLM)
Line 282: Line 282:


-- Maps AbilityData property names to human-readable effect names for the debuff table.
-- Maps AbilityData property names to human-readable effect names for the debuff table.
-- Props not listed here fall back to using the prop name itself as the effect label.
-- DebuffDuration is absent: it signals "(See notes)" on Duration rather than a named effect.
-- DebuffDuration is absent: it signals "(See notes)" on Duration rather than a named effect.
local debuff_prop_to_effect = {
local debuff_prop_to_effect = {
Line 317: Line 318:
     local effects_set  = {}  -- effect name -> true, for dedup
     local effects_set  = {}  -- effect name -> true, for dedup


    -- Iterate stat_to_props["debuff"], skipping DebuffDuration (handled separately).
    -- Use debuff_prop_to_effect for the display name; fall back to the prop name itself.
     local function collect_effects(obj, tier)
     local function collect_effects(obj, tier)
         for prop, effect in pairs(debuff_prop_to_effect) do
         for _, prop in ipairs(stat_to_props["debuff"]) do
             local val = obj[prop]
             if prop ~= "DebuffDuration" then
            if val and val ~= 0 and not effects_set[effect] then
                local val = obj[prop]
                table.insert(effects_seen, { name = effect, tier = tier })
                if val and val ~= 0 then
                effects_set[effect] = true
                    local effect = debuff_prop_to_effect[prop] or prop
                    if not effects_set[effect] then
                        table.insert(effects_seen, { name = effect, tier = tier })
                        effects_set[effect] = true
                    end
                end
             end
             end
         end
         end