Module:AbilityTable: Difference between revisions

Vergir (talk | contribs)
update props for debuff_resist (still wip, don't use)
Vergir (talk | contribs)
Replace manual_entries with exclude_list; seed debuff_resist exclusions; clean up DELETE notes (with help from vergir-bot LLM)
Line 29: Line 29:
     },
     },
     ["debuff_resist"] = {
     ["debuff_resist"] = {
    ["Aura of Suffering"] = "T1 slow, T3 extra damage. The effect is negligible.",
        ["Aura of Suffering"] = "T1 slow, T3 extra damage. The effect is negligible.",
    ["Lightning Ball"] = "T2 Slow. The effect is negligible.",
        ["Lightning Ball"]     = "T2 Slow. The effect is negligible.",
    ["Static Charge"] = "Stun duration. Delay before stun is not affected.",
        ["Static Charge"]     = "Stun duration. Delay before stun is not affected.",
    ["Enchanter's Satchel"] = "T3 Slow.",
        ["Enchanter's Satchel"] = "T3 Slow.",
    ["Scorn"] = "T3 extra damage from Mo & Krill.",
        ["Scorn"]             = "T3 extra damage from Mo & Krill.",
    ["Hotel Guest"] = "Only T2 late check-out stun can be reduced.",
        ["Hotel Guest"]       = "Only T2 late check-out stun can be reduced.",
    ["Jar of Dead"] = "T2 slow.",
        ["Jar of Dead"]       = "T2 slow.",
    ["Grapple Arm"] = "T1 extra damage from Bebop",
        ["Grapple Arm"]       = "T1 extra damage from Bebop",
        ["Itani Lo Sahn"] = "DELETE Silence/Time Slow debuff can not be reduced.", -- DELETE debuffduration
         ["Binding Word"]       = "Immobilize Duration. Escape time is not affected.",
        ["Bookwyrm"] = "DELETE", -- DELETE debuffduration
         ["Power Slash"]       = "T1 slow",
        ["Slam Fire"] = "DELETE", -- debuffduration
         ["Kinetic Pulse"]     = "T2 bullet resist reduction and slow.",
        ["Splatter"] = "DELETE", -- SlowPercent
         ["Pain Battery"]       = "T1 slow.",
         ["Binding Word"] = "Immobilize Duration. Escape time is not affected.",
         ["Power Surge"]       = "T3 Spirit Resist reduction.",
         ["Power Slash"] = "T1 slow",
         ["Rain of Arrows"]     = "T2 slow.",
         ["Kinetic Pulse"] = "T2 bullet resist reduction and slow.",
         ["Soul Exchange"]     = "T2 silence.",
         ["Pain Battery"] = "T1 slow.",
         ["Ground Strike"]     = "T2 slow.",
         ["Power Surge"] = "T3 Spirit Resist reduction.",
         ["Flog"]               = "T2 Fire rate slow.",
         ["Rain of Arrows"] = "T2 slow.",
         ["Soul Exchange"] = "T2 silence.",
         ["Ground Strike"] = "T2 slow.",
         ["Flog"] = "T2 Fire rate slow."
     },
     },
}
}


-- Manually specified abilities to include even if they match no props.
-- Abilities incorrectly matched by props that should not appear in the table.
-- Listed by ability name; the key and hero are resolved from AbilityCards.json.
-- Listed by ability name.
local manual_entries = {}
local exclude_list = {
    ["debuff_resist"] = {
        "Itani Lo Sahn",
        "Bookwyrm",
        "Slam Fire",
        "Splatter",
    },
}


-- Unit strings appended to cell values by column name.
-- Unit strings appended to cell values by column name.
Line 310: Line 313:
--  _name_to_key : ability name -> ability key
--  _name_to_key : ability name -> ability key
-- Both built together from HeroData + AbilityCards.
-- Both built together from HeroData + AbilityCards.
-- manual_entries resolve name -> key via _name_to_key, then use _key_lookup normally.
-- ============================================================
-- ============================================================


Line 376: Line 378:


     local key_lookup, name_to_key = build_lookup()
     local key_lookup, name_to_key = build_lookup()
     local spec       = extra_columns[stat]
     local spec       = extra_columns[stat]
     local headers     = spec and spec.headers or {}
     local headers   = spec and spec.headers or {}
     local get_cells   = spec and spec.get_cells or function() return {} end
     local get_cells = spec and spec.get_cells or function() return {} end
     local stat_notes = human_notes[stat]
     local stat_notes = human_notes[stat]
     local stat_manual = manual_entries[stat]
 
    -- Build excluded-name set for this stat
     local excluded = {}
    if exclude_list[stat] then
        for _, name in ipairs(exclude_list[stat]) do
            excluded[name] = true
        end
    end


     local abilities = GameData.get_entities(GameData.Dataset.ABILITIES, internal_keys)
     local abilities = GameData.get_entities(GameData.Dataset.ABILITIES, internal_keys)


     -- Keep only abilities belonging to active, released heroes
     -- Keep only abilities belonging to active, released heroes and not excluded
     local filtered = {}
     local filtered = {}
    local filtered_keys = {}
     for _, ability in ipairs(abilities) do
     for _, ability in ipairs(abilities) do
         local key = ability["Key"]
         local key = ability["Key"]
         if key and key_lookup[key] then
         if key and key_lookup[key] and not excluded[ability["Name"]] then
             table.insert(filtered, ability)
             table.insert(filtered, ability)
            filtered_keys[key] = true
        end
    end
    -- Inject manual entries not already covered by prop-matching.
    -- Resolve ability name -> key via name_to_key, then verify key is in key_lookup.
    if stat_manual then
        for _, name in ipairs(stat_manual) do
            local key = name_to_key[name]
            if key and key_lookup[key] and not filtered_keys[key] then
                -- Inject a minimal record; no cell renderer needs fields from it.
                table.insert(filtered, { Key = key, Name = name })
                filtered_keys[key] = true
            end
         end
         end
     end
     end