Module:AbilityTable/ComplexRenderers: Difference between revisions

Vergir (talk | contribs)
update renderer comments, remove unused GameData require, extract find_base_melee_scale to module level (with help from vergir-bot LLM)
Vergir (talk | contribs)
strip trailing periods from auto-generated notes, period is now handled by main module ensure_period (with help from vergir-bot LLM)
Line 119: Line 119:
-- additively through upgrades. Shows value in a named column
-- additively through upgrades. Shows value in a named column
-- and generates upgrade notes with running totals.
-- and generates upgrade notes with running totals.
-- Note: auto-generated notes omit trailing periods; the main
-- module's ensure_period handles that.
-- ============================================================
-- ============================================================


Line 152: Line 154:
                         table.insert(notes, "T" .. i .. " upgrade increases "
                         table.insert(notes, "T" .. i .. " upgrade increases "
                             .. col_name:lower() .. " by " .. delta .. suffix
                             .. col_name:lower() .. " by " .. delta .. suffix
                             .. " (total " .. total .. suffix .. ").")
                             .. " (total " .. total .. suffix .. ")")
                         running = total
                         running = total
                     end
                     end
Line 205: Line 207:
         local charge_str = n .. " charge" .. (n ~= 1 and "s" or "")
         local charge_str = n .. " charge" .. (n ~= 1 and "s" or "")
         if has_base then
         if has_base then
             table.insert(note_parts, "+" .. charge_str .. " on T" .. upgrade_info.tier .. " upgrade.")
             table.insert(note_parts, "+" .. charge_str .. " on T" .. upgrade_info.tier .. " upgrade")
         else
         else
             local cd_str = upgrade_cooldown and (upgrade_cooldown .. "s") or "unknown"
             local cd_str = upgrade_cooldown and (upgrade_cooldown .. "s") or "unknown"
             table.insert(note_parts, "Becomes charged on T" .. upgrade_info.tier
             table.insert(note_parts, "Becomes charged on T" .. upgrade_info.tier
                 .. " upgrade with " .. charge_str
                 .. " upgrade with " .. charge_str
                 .. " and " .. cd_str .. " time between charges.")
                 .. " and " .. cd_str .. " time between charges")
         end
         end
     end
     end
     if ability["AbilityChargesConditionally"] ~= nil then
     if ability["AbilityChargesConditionally"] ~= nil then
         table.insert(note_parts, "Has a conditional charge.")
         table.insert(note_parts, "Has a conditional charge")
     end
     end
     if #note_parts > 0 then
     if #note_parts > 0 then
Line 243: Line 245:
                         if stype == "heavy_melee" and delta > 0 then
                         if stype == "heavy_melee" and delta > 0 then
                             table.insert(notes, "T" .. i .. " upgrade changes scaling to ×"
                             table.insert(notes, "T" .. i .. " upgrade changes scaling to ×"
                                 .. delta .. " of Heavy Melee damage.")
                                 .. delta .. " of Heavy Melee damage")
                         elseif stype == "melee" and delta ~= 0 and base_scale then
                         elseif stype == "melee" and delta ~= 0 and base_scale then
                             local final = math.floor((base_scale + delta) * 1000 + 0.5) / 1000
                             local final = math.floor((base_scale + delta) * 1000 + 0.5) / 1000
                             table.insert(notes, "T" .. i .. " upgrade adds ×"
                             table.insert(notes, "T" .. i .. " upgrade adds ×"
                                 .. delta .. " scaling (total ×" .. final .. ").")
                                 .. delta .. " scaling (total ×" .. final .. ")")
                         end
                         end
                     end
                     end
Line 344: Line 346:
     local channel_slow = unwrap_value(ability["ChannelSlowPercent"])
     local channel_slow = unwrap_value(ability["ChannelSlowPercent"])
     if channel_slow and channel_slow ~= 0 then
     if channel_slow and channel_slow ~= 0 then
         local note = "Also slows the caster for " .. math.abs(channel_slow) .. "%."
         local note = "Also slows the caster for " .. math.abs(channel_slow) .. "%"
         cells["Notes"] = cells["Notes"] and (cells["Notes"] .. "; " .. note) or note
         cells["Notes"] = cells["Notes"] and (cells["Notes"] .. "; " .. note) or note
     end
     end
Line 400: Line 402:


     if caster_dash_slow then
     if caster_dash_slow then
         local note = "Gives " .. caster_dash_slow .. "% dash slow for the caster."
         local note = "Gives " .. caster_dash_slow .. "% dash slow for the caster"
         cells["Notes"] = cells["Notes"] and (cells["Notes"] .. "; " .. note) or note
         cells["Notes"] = cells["Notes"] and (cells["Notes"] .. "; " .. note) or note
     end
     end