Module:AbilityTable: Difference between revisions

Vergir (talk | contribs)
Remove hero field from manual_entries; hero resolved automatically via name_lookup from AbilityCards (with help from vergir-bot LLM)
Remove spurious Key and abilityNum=9999 from manual entry injection; simplify sort comparator (with help from vergir-bot LLM)
Line 371: Line 371:
     end
     end


     -- Duration cell: collect distinct non-DebuffDuration duration fields (base or upgrade)
     -- Duration cell: collect distinct non-DebuffDuration duration fields (base or upgrade).
    -- If exactly one found → use its value. If multiple, or DebuffDuration present → "(See notes)".
     local DUR_FIELDS = {
     local DUR_FIELDS = {
         "StunDuration", "SleepDuration", "SilenceDuration", "PetrifyDuration",
         "StunDuration", "SleepDuration", "SilenceDuration", "PetrifyDuration",
Line 395: Line 396:
     end
     end


     -- AbilityDuration is only meaningful as a duration source when DebuffAccuracy is the
     -- AbilityDuration is only meaningful when DebuffAccuracy is the sole CC prop (Call Bell).
    -- sole CC prop (Call Bell) — otherwise it's too generic.
     local sole_cc_is_accuracy = (effects_set["Inaccuracy"] and not effects_set["Slow"]
     local sole_cc_is_accuracy = (effects_set["Inaccuracy"] and not effects_set["Slow"]
         and not effects_set["Stun"] and not effects_set["Sleep"]
         and not effects_set["Stun"] and not effects_set["Sleep"]
Line 535: Line 535:


     -- Inject manual entries not already covered by prop-matching.
     -- Inject manual entries not already covered by prop-matching.
     -- Hero is resolved via _name_lookup; if not found the row shows "—" in the Hero column.
     -- Hero and slot are resolved via name_lookup; if the ability isn't in AbilityCards
    -- the row shows "—" in the Hero column and sorts to the end.
     if stat_manual then
     if stat_manual then
         for name, _ in pairs(stat_manual) do
         for name, _ in pairs(stat_manual) do
Line 541: Line 542:
                 table.insert(filtered, {
                 table.insert(filtered, {
                     Name        = name,
                     Name        = name,
                    Key        = "__manual__",
                     _manualInfo = name_lookup[name],
                     _manualInfo = name_lookup[name] or { abilityNum = 9999 },
                 })
                 })
             end
             end
Line 552: Line 552:
     end
     end


     -- Sort by hero name, then ability slot number
     -- Sort by hero name, then ability slot number.
    -- Abilities with no info (not in lookup or AbilityCards) sort to the end.
     table.sort(filtered, function(a, b)
     table.sort(filtered, function(a, b)
         local ia = lookup[a["Key"]] or a._manualInfo
         local ia = lookup[a["Key"]] or a._manualInfo