Module:AbilityTable/ComplexRenderers: Difference between revisionsGive feedback
add scalingspirit |
Add RenderBossDamageScale for the "bossdmgscale" list (with help from vergir-bot LLM) |
||
| Line 110: | Line 110: | ||
end | end | ||
return out | return out | ||
end | |||
-- Formats a 0–1 multiplier as a percentage: 0.2 → "20%", 0.125 → "12.5%". | |||
-- %.10g absorbs floating-point noise from the ×100. | |||
local function format_percent(v) | |||
return string.format("%.10g", v * 100) .. "%" | |||
end | end | ||
| Line 587: | Line 593: | ||
if #segments == 0 then return {} end | if #segments == 0 then return {} end | ||
return { ["Debuff Resist"] = table.concat(segments, " → ") } | return { ["Debuff Resist"] = table.concat(segments, " → ") } | ||
end | |||
-- Renders how much of an ability's damage applies to objectives (Guardians, | |||
-- Walkers, Patron, Mid-Boss). BossDamageScale is a 0–1 multiplier shown as a | |||
-- percentage: 0.2 → "20%". The field never appears in upgrade tiers, so only | |||
-- the base value is read; sub-ability records are checked as a fallback when | |||
-- the main record lacks it. | |||
function p.RenderBossDamageScale(ability) | |||
local v = unwrap_value(ability["BossDamageScale"]) | |||
if (v == nil or v == 0) and type(ability["_subabilities"]) == "table" then | |||
for _, sub in ipairs(ability["_subabilities"]) do | |||
local sv = unwrap_value(sub["BossDamageScale"]) | |||
if sv and sv ~= 0 then v = sv; break end | |||
end | |||
end | |||
if v == nil or v == 0 then return {} end | |||
return { ["Damage to Objectives"] = format_percent(v) } | |||
end | end | ||
return p | return p | ||