Module:AbilityTable: Difference between revisions

Jump to navigation Jump to search
Vergir (talk | contribs)
Fix dashslow caster-slow detection: scan only enemy-targeted props in upgrades, not GroundDashReductionPercent itself (with help from vergir-bot LLM)
Vergir (talk | contribs)
Remove dashslow_enemy_props constant; iterate stat_to_props["dashslow"] inline with skip condition (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 any enemy-targeted dash slow prop
     -- If GroundDashReductionPercent is set at base AND any other dashslow prop
     -- exists anywhere (base or upgrades), the base value is a caster self-slow rather than
     -- exists anywhere (base or upgrades), the base value is a caster self-slow
     -- an enemy debuff. Exclude it from the main value and note it instead.
     -- rather than 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
         local has_enemy_prop = false
         local has_enemy_prop = false
         for _, p in ipairs(dashslow_enemy_props) do
         for _, p in ipairs(stat_to_props["dashslow"]) do
             local v = num_val(ability[p])
             if p ~= "GroundDashReductionPercent" then
            if v and v ~= 0 then has_enemy_prop = true; break end
                local v = num_val(ability[p])
                if v and v ~= 0 then has_enemy_prop = true; break end
            end
         end
         end
         if not has_enemy_prop then
         if not has_enemy_prop then
Line 407: Line 405:
                 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(dashslow_enemy_props) do
                         for _, p in ipairs(stat_to_props["dashslow"]) do
                             local v = num_val(tier[p])
                             if p ~= "GroundDashReductionPercent" then
                            if v and v ~= 0 then has_enemy_prop = true; break end
                                local v = num_val(tier[p])
                                if v and v ~= 0 then has_enemy_prop = true; break end
                            end
                         end
                         end
                     end
                     end