Module:AbilityTable: Difference between revisions

Remove CC_PROPS duplication; derive ordered prop list from debuff_prop_to_effect keys at load time (with help from vergir-bot LLM)
Vergir (talk | contribs)
Drop debuff_props_ordered; iterate debuff_prop_to_effect directly with pairs() (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.
-- Ordered list ensures deterministic effect output; pairs() iteration order is not guaranteed.
-- 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 298: Line 297:
     TimeSlowDuration    = "Time Slow",
     TimeSlowDuration    = "Time Slow",
     LateCheckoutStun    = "Stun",
     LateCheckoutStun    = "Stun",
}
-- Ordered list of keys from debuff_prop_to_effect, used to iterate props deterministically.
local debuff_props_ordered = {
    "StunDuration", "SleepDuration", "SilenceDuration", "SilenceDebuff",
    "PetrifyDuration", "HexDuration", "ImmobilizeDuration", "LiftDuration",
    "SlowPercent", "HoldInPlaceDuration", "DebuffAccuracy",
    "TimeSlowDuration", "LateCheckoutStun",
}
}


Line 327: Line 318:


     local function collect_effects(obj, tier)
     local function collect_effects(obj, tier)
         for _, prop in ipairs(debuff_props_ordered) do
         for prop, effect in pairs(debuff_prop_to_effect) do
             local val   = obj[prop]
             local val = obj[prop]
            local effect = debuff_prop_to_effect[prop]
             if val and val ~= 0 and not effects_set[effect] then
             if val and val ~= 0 and effect and not effects_set[effect] then
                 table.insert(effects_seen, { name = effect, tier = tier })
                 table.insert(effects_seen, { name = effect, tier = tier })
                 effects_set[effect] = true
                 effects_set[effect] = true