Module:AbilityTable: Difference between revisionsGive feedback
mNo edit summary |
healreduce: remove Duration column; iterate stat_to_props for amount; drop find_base_duration (with help from vergir-bot LLM) |
||
| Line 52: | Line 52: | ||
}, | }, | ||
["moveslow"] = { | ["moveslow"] = { | ||
["Grapple Arm"] = "Applies a short strong slow when the victim reaches Bebop.", | ["Grapple Arm"] = "Applies a short strong slow when the victim reaches Bebop.", | ||
["Heavy Barrage"] = "Slows McGinnis by unknown amount." | ["Heavy Barrage"] = "Slows McGinnis by unknown amount.", | ||
}, | }, | ||
} | } | ||
| Line 77: | Line 77: | ||
local column_suffix = { | local column_suffix = { | ||
["Time Between Charges"] = "s", | ["Time Between Charges"] = "s", | ||
} | } | ||
| Line 238: | Line 237: | ||
if #upgrade_notes > 0 then cells["Notes"] = table.concat(upgrade_notes, " ") end | if #upgrade_notes > 0 then cells["Notes"] = table.concat(upgrade_notes, " ") end | ||
return cells | return cells | ||
end | end | ||
| Line 251: | Line 242: | ||
local cells = {} | local cells = {} | ||
local notes = {} | local notes = {} | ||
local | local props = stat_to_props["healreduce"] | ||
-- Find the first heal reduction value, at base or in upgrades. | |||
-- DisableHealing is a flag (value=100%); all other props are negative percentages. | |||
local first_pct, first_tier, first_is_disable = nil, nil, false | local first_pct, first_tier, first_is_disable = nil, nil, false | ||
for _, prop in ipairs(props) do | |||
local v = num_val(ability[prop]) | |||
if v and v ~= 0 then | |||
if prop == "DisableHealing" then | |||
first_is_disable = true | |||
else | |||
first_pct = math.abs(v) | |||
end | |||
break | |||
end | |||
end | |||
if not first_pct and not first_is_disable then | |||
local upgrades = ability["Upgrades"] | local upgrades = ability["Upgrades"] | ||
if type(upgrades) == "table" then | if type(upgrades) == "table" then | ||
for i, tier in ipairs(upgrades) do | for i, tier in ipairs(upgrades) do | ||
if type(tier) == "table" then | if type(tier) == "table" then | ||
for _, prop in ipairs(props) do | |||
local v = num_val(tier[prop]) | |||
if v and v ~= 0 then | |||
if prop == "DisableHealing" then | |||
first_is_disable, first_tier = true, i | |||
else | |||
first_pct, first_tier = math.abs(v), i | |||
end | |||
break | |||
end | |||
end | end | ||
end | end | ||
if first_pct or first_is_disable then break end | |||
end | end | ||
end | end | ||
| Line 285: | Line 286: | ||
cells["Heal Reduction"] = tostring(first_pct) .. "%" .. (first_tier and " (T" .. first_tier .. ")" or "") | cells["Heal Reduction"] = tostring(first_pct) .. "%" .. (first_tier and " (T" .. first_tier .. ")" or "") | ||
end | end | ||
-- Upgrade notes: percent changes after the first value. | |||
local upgrades = ability["Upgrades"] | local upgrades = ability["Upgrades"] | ||
if type(upgrades) == "table" then | if type(upgrades) == "table" then | ||
local | local running = first_pct | ||
local first_pct_seen = (first_tier == nil) | local first_pct_seen = (first_tier == nil) | ||
for i, tier in ipairs(upgrades) do | for i, tier in ipairs(upgrades) do | ||
if type(tier) == "table" then | if type(tier) == "table" then | ||
if first_tier == i then | if first_tier == i then | ||
first_pct_seen = true | first_pct_seen = true | ||
if first_pct then | if first_pct then running = first_pct end | ||
elseif first_pct_seen | elseif first_pct_seen then | ||
local | local delta = nil | ||
for _, prop in ipairs(props) do | |||
if prop ~= "DisableHealing" then | |||
local v = num_val(tier[prop]) | |||
if v and v ~= 0 then delta = math.abs(v); break end | |||
end | |||
end | |||
if delta then | |||
local total = (running or 0) + delta | |||
local | table.insert(notes, "T" .. i .. " upgrade increases heal reduction by " | ||
table.insert( | .. delta .. "% (total " .. total .. "%).") | ||
running = total | |||
.. | |||
end | end | ||
end | end | ||
end | end | ||
end | end | ||
| Line 449: | Line 444: | ||
}, | }, | ||
["healreduce"] = { | ["healreduce"] = { | ||
headers = { "Heal Reduction | headers = { "Heal Reduction", "Notes" }, | ||
get_cells = healreduce_cells, | get_cells = healreduce_cells, | ||
}, | }, | ||