Module:AbilityTable: Difference between revisionsGive feedback
Jump to navigation
Jump to search
m rename physdam => wpndmg |
Add healreduce stat with Heal Reduction % and Duration columns and upgrade notes (with help from vergir-bot LLM) |
||
| Line 3: | Line 3: | ||
-- Maps lowercase friendly stat names to internal AbilityData property keys or values. | -- Maps lowercase friendly stat names to internal AbilityData property keys or values. | ||
local stat_to_props = { | local stat_to_props = { | ||
["charges"] = { "AbilityCharges" }, | ["charges"] = { "AbilityCharges" }, | ||
["melee"] | ["melee"] = { "melee", "heavy_melee" }, | ||
["wpndmg"] = { "melee", "heavy_melee", "weapon_damage_increase" }, | ["wpndmg"] = { "melee", "heavy_melee", "weapon_damage_increase" }, | ||
["healreduce"] = { "HealAmpReceivePenaltyPercent", "HealAmpRegenPenaltyPercent", "DisableHealing" }, | |||
} | } | ||
| Line 21: | Line 22: | ||
local column_suffix = { | local column_suffix = { | ||
["Time Between Charges"] = "s", | ["Time Between Charges"] = "s", | ||
["Duration"] = "s", | |||
} | } | ||
| Line 181: | Line 183: | ||
if #upgrade_notes > 0 then | if #upgrade_notes > 0 then | ||
cells["Notes"] = table.concat(upgrade_notes, " ") | cells["Notes"] = table.concat(upgrade_notes, " ") | ||
end | |||
return cells | |||
end | |||
-- Returns the base heal reduction percent (always positive, e.g. 33 for -33%), | |||
-- or nil if the reduction only appears in upgrades. | |||
-- Also returns true if the ability fully disables healing (DisableHealing). | |||
local function find_base_heal_reduce(ability) | |||
local pct = num_val(ability["HealAmpReceivePenaltyPercent"]) | |||
or num_val(ability["HealAmpRegenPenaltyPercent"]) | |||
if pct and pct ~= 0 then | |||
return math.abs(pct), false | |||
end | |||
if ability["DisableHealing"] and ability["DisableHealing"] ~= 0 then | |||
return nil, true | |||
end | |||
return nil, false | |||
end | |||
-- Returns the base duration value using priority: VenomDuration > DebuffDuration > AbilityDuration. | |||
-- Also returns the field name that was found (for upgrade scanning). | |||
local function find_base_duration(ability) | |||
for _, field in ipairs({ "VenomDuration", "DebuffDuration", "AbilityDuration", "BurnDuration" }) do | |||
local v = num_val(ability[field]) | |||
if v and v > 0 then | |||
return v, field | |||
end | |||
end | |||
return nil, nil | |||
end | |||
local function healreduce_cells(ability) | |||
local cells = {} | |||
local notes = {} | |||
local base_pct, is_disable = find_base_heal_reduce(ability) | |||
local base_dur, dur_field = find_base_duration(ability) | |||
-- Heal Reduction % column | |||
if is_disable then | |||
cells["Heal Reduction"] = "100% (suppressed)" | |||
elseif base_pct then | |||
cells["Heal Reduction"] = tostring(base_pct) .. "%" | |||
end | |||
-- (if neither, it's upgrade-only — cell stays nil → "—") | |||
-- Duration column | |||
if base_dur then | |||
cells["Duration"] = tostring(base_dur) | |||
end | |||
-- Scan upgrades for changes to heal reduction or duration | |||
local upgrades = ability["Upgrades"] | |||
if type(upgrades) == "table" then | |||
local running_pct = base_pct -- track cumulative percent for additive deltas | |||
local running_dur = base_dur | |||
for i, tier in ipairs(upgrades) do | |||
if type(tier) == "table" then | |||
local tier_notes = {} | |||
-- Heal reduction changes | |||
local pct_delta = num_val(tier["HealAmpReceivePenaltyPercent"]) | |||
or num_val(tier["HealAmpRegenPenaltyPercent"]) | |||
local disable = tier["DisableHealing"] | |||
if disable and disable ~= 0 then | |||
table.insert(tier_notes, "T" .. i .. " upgrade fully suppresses [[Healing]].") | |||
elseif pct_delta and pct_delta ~= 0 then | |||
local delta_abs = math.abs(pct_delta) | |||
if running_pct then | |||
-- Additive change to existing base | |||
local total = running_pct + delta_abs | |||
table.insert(tier_notes, "T" .. i .. " upgrade increases heal reduction by " | |||
.. delta_abs .. "% (total " .. total .. "%).") | |||
running_pct = total | |||
else | |||
-- Introduces heal reduction for the first time | |||
table.insert(tier_notes, "T" .. i .. " upgrade adds " | |||
.. delta_abs .. "% [[Healing Reduction]].") | |||
running_pct = delta_abs | |||
end | |||
end | |||
-- Duration changes (additive deltas in the engine) | |||
if dur_field then | |||
local dur_delta = num_val(tier[dur_field]) | |||
if dur_delta and dur_delta ~= 0 then | |||
if running_dur then | |||
local total_dur = running_dur + dur_delta | |||
table.insert(tier_notes, "T" .. i .. " upgrade " | |||
.. (dur_delta > 0 and "increases" or "decreases") | |||
.. " duration by " .. math.abs(dur_delta) | |||
.. "s (total " .. total_dur .. "s).") | |||
running_dur = total_dur | |||
end | |||
end | |||
end | |||
for _, n in ipairs(tier_notes) do | |||
table.insert(notes, n) | |||
end | |||
end | |||
end | |||
end | |||
if #notes > 0 then | |||
cells["Notes"] = table.concat(notes, " ") | |||
end | end | ||
| Line 194: | Line 305: | ||
headers = { "Light Melee Scaling", "Notes" }, | headers = { "Light Melee Scaling", "Notes" }, | ||
get_cells = melee_cells, | get_cells = melee_cells, | ||
}, | |||
["healreduce"] = { | |||
headers = { "Heal Reduction", "Duration", "Notes" }, | |||
get_cells = healreduce_cells, | |||
}, | }, | ||
} | } | ||