Module:AbilityTable: Difference between revisions

Jump to navigation Jump to search
Vergir (talk | contribs)
dashslow: auto-detect caster GroundDashReductionPercent and note it; moveslow: note ChannelSlowPercent caster slow; remove dashslow_prop_overrides (with help from vergir-bot LLM)
Vergir (talk | contribs)
Fix dashslow caster-slow detection: scan only enemy-targeted props in upgrades, not GroundDashReductionPercent itself (with help from vergir-bot LLM)
Line 383: Line 383:
     return cells
     return cells
end
end
-- The enemy-targeted dash slow props (everything except GroundDashReductionPercent,
-- which can be either a caster self-slow or an enemy debuff depending on context).
local dashslow_enemy_props = { "MaxGroundDashReductionPercent", "MoveSpeedAndDashSlowPct", "EnemyDashSlowPercent" }


local function dashslow_cells(ability)
local function dashslow_cells(ability)
     local props = stat_to_props["dashslow"]
     local props = stat_to_props["dashslow"]


     -- If GroundDashReductionPercent is set at base AND another dash slow prop
     -- If GroundDashReductionPercent is set at base AND any enemy-targeted dash slow prop
     -- exists anywhere (base or upgrades), the base value is a caster self-slow
     -- exists anywhere (base or upgrades), the base value is a caster self-slow rather than
     -- rather than an enemy debuff. Skip it for the main value and note it instead.
     -- an enemy debuff. Exclude it from the main value and note it instead.
     local caster_dash_slow = nil
     local caster_dash_slow = nil
     local base_ground = num_val(ability["GroundDashReductionPercent"])
     local base_ground = num_val(ability["GroundDashReductionPercent"])
     if base_ground and base_ground ~= 0 then
     if base_ground and base_ground ~= 0 then
        -- Check whether any other dashslow prop exists anywhere
         local has_enemy_prop = false
        local other_props = { "MaxGroundDashReductionPercent", "MoveSpeedAndDashSlowPct", "EnemyDashSlowPercent" }
         for _, p in ipairs(dashslow_enemy_props) do
         local has_other = false
         for _, p in ipairs(other_props) do
             local v = num_val(ability[p])
             local v = num_val(ability[p])
             if v and v ~= 0 then has_other = true; break end
             if v and v ~= 0 then has_enemy_prop = true; break end
         end
         end
         if not has_other then
         if not has_enemy_prop then
             local upgrades = ability["Upgrades"]
             local upgrades = ability["Upgrades"]
             if type(upgrades) == "table" then
             if type(upgrades) == "table" then
                 for _, tier in ipairs(upgrades) do
                 for _, tier in ipairs(upgrades) do
                     if type(tier) == "table" then
                     if type(tier) == "table" then
                         for _, p in ipairs(props) do
                         for _, p in ipairs(dashslow_enemy_props) do
                             local v = num_val(tier[p])
                             local v = num_val(tier[p])
                             if v and v ~= 0 then has_other = true; break end
                             if v and v ~= 0 then has_enemy_prop = true; break end
                         end
                         end
                     end
                     end
                     if has_other then break end
                     if has_enemy_prop then break end
                 end
                 end
             end
             end
         end
         end
         if has_other then
         if has_enemy_prop then
             caster_dash_slow = math.abs(base_ground)
             caster_dash_slow = math.abs(base_ground)
            -- Use a filtered prop list that excludes GroundDashReductionPercent
             local filtered = {}
             local filtered = {}
             for _, p in ipairs(props) do
             for _, p in ipairs(props) do