Module:AbilityTable/ComplexRenderers: Difference between revisionsGive feedback
Jump to navigation
Jump to search
mNo edit summary |
rename val_stat_cells to render_upgradable_stat, simplify RenderHealReduce to use it, fix Lists.props to Lists.lists (with help from vergir-bot LLM) |
||
| Line 100: | Line 100: | ||
-- ============================================================ | -- ============================================================ | ||
-- Generic renderer for a single numeric stat | -- Generic renderer for a single numeric stat that can increase | ||
-- | -- additively through upgrades. Shows value in a named column | ||
-- and generates upgrade notes with running totals. | |||
-- | |||
-- ============================================================ | -- ============================================================ | ||
local function | local function render_upgradable_stat(ability, col_name, fields, suffix) | ||
suffix = suffix or "" | suffix = suffix or "" | ||
local cells = {} | local cells = {} | ||
| Line 259: | Line 258: | ||
-- HealReduce: shows heal reduction percentage and upgrade notes. | -- HealReduce: shows heal reduction percentage and upgrade notes. | ||
function p.RenderHealReduce(ability) | function p.RenderHealReduce(ability) | ||
-- DisableHealing is always 100%, handle it separately | |||
local v = unwrap_value(ability["DisableHealing"]) | |||
if v and v ~= 0 then | |||
return { ["Heal Reduction"] = "100%" } | |||
end | end | ||
local upgrade = find_in_upgrades(ability, "DisableHealing") | |||
if upgrade then | |||
return { ["Heal Reduction"] = "100% (T" .. upgrade.tier .. ")" } | |||
end | end | ||
-- Everything else goes through the generic renderer | |||
local filtered = {} | |||
for _, prop in ipairs(Lists.lists["healreduce"]) do | |||
if prop ~= "DisableHealing" then table.insert(filtered, prop) end | |||
end | end | ||
return render_upgradable_stat(ability, "Heal Reduction", filtered, "%") | |||
end | end | ||
| Line 339: | Line 279: | ||
-- Outputs upgrade-tier notes for debuffs added only in upgrades (not at base). | -- Outputs upgrade-tier notes for debuffs added only in upgrades (not at base). | ||
function p.RenderDebuff(ability, stat) | function p.RenderDebuff(ability, stat) | ||
local stat_props = Lists. | local stat_props = Lists.lists[stat] | ||
local cells = {} | local cells = {} | ||
| Line 396: | Line 336: | ||
-- MoveSlow: shows move slow percentage and caster slow note if present. | -- MoveSlow: shows move slow percentage and caster slow note if present. | ||
function p.RenderMoveSlow(ability) | function p.RenderMoveSlow(ability) | ||
local cells = | local cells = render_upgradable_stat(ability, "Move Slow", Lists.lists["moveslow"], "%") | ||
local channel_slow = unwrap_value(ability["ChannelSlowPercent"]) | local channel_slow = unwrap_value(ability["ChannelSlowPercent"]) | ||
| Line 409: | Line 349: | ||
-- DashSlow: shows dash slow percentage, auto-detects caster self-slow. | -- DashSlow: shows dash slow percentage, auto-detects caster self-slow. | ||
function p.RenderDashSlow(ability) | function p.RenderDashSlow(ability) | ||
local stat_props = Lists. | local stat_props = Lists.lists["dashslow"] | ||
local props = {} | local props = {} | ||
for _, | for _, pr in ipairs(stat_props) do table.insert(props, pr) end | ||
local caster_dash_slow = nil | local caster_dash_slow = nil | ||
| Line 451: | Line 391: | ||
end | end | ||
local cells = | local cells = render_upgradable_stat(ability, "Dash Slow", props, "%") | ||
if caster_dash_slow then | if caster_dash_slow then | ||