Module:AbilityTable: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Refine healreduce renderer: show first heal reduction value with upgrade tier in parentheses if upgrade-only; no wiki links in notes (with help from vergir-bot LLM) |
Fix heal reduction upgrade note to use "increases by X% (total Y%)" style, consistent with duration notes (with help from vergir-bot LLM) |
||
| Line 208: | Line 208: | ||
-- Determine the first heal reduction value and where it comes from. | -- Determine the first heal reduction value and where it comes from. | ||
-- Check base fields first, then scan upgrades in order. | -- Check base fields first, then scan upgrades in order. | ||
local first_pct | local first_pct = nil -- absolute percent value (positive) | ||
local first_tier | local first_tier = nil -- nil = base ability, N = upgrade tier | ||
local first_is_disable = false | local first_is_disable = false | ||
| Line 264: | Line 264: | ||
local upgrades = ability["Upgrades"] | local upgrades = ability["Upgrades"] | ||
if type(upgrades) == "table" then | if type(upgrades) == "table" then | ||
local running_pct = first_pct | local running_pct = first_pct | ||
local running_dur = base_dur | local running_dur = base_dur | ||
local first_pct_seen = (first_tier == nil) -- if base, | local first_pct_seen = (first_tier == nil) -- if base, already "seen" | ||
for i, tier in ipairs(upgrades) do | for i, tier in ipairs(upgrades) do | ||
| Line 283: | Line 283: | ||
if first_pct then running_pct = first_pct end | if first_pct then running_pct = first_pct end | ||
elseif first_pct_seen and pct_delta and pct_delta ~= 0 then | elseif first_pct_seen and pct_delta and pct_delta ~= 0 then | ||
-- Subsequent percent change — | -- Subsequent percent change — "increases by X% (total Y%)" | ||
local delta_abs = math.abs(pct_delta) | local delta_abs = math.abs(pct_delta) | ||
local total = (running_pct or 0) + delta_abs | local total = (running_pct or 0) + delta_abs | ||
table.insert(tier_notes, "T" .. i .. " upgrade increases heal reduction | table.insert(tier_notes, "T" .. i .. " upgrade increases heal reduction by " | ||
.. delta_abs .. "% (total " .. total .. "%).") | |||
running_pct = total | running_pct = total | ||
end | end | ||