Module:AbilityTable/ComplexRenderers: Difference between revisionsGive feedback
Jump to navigation
Jump to search
add base damage column to melee list |
add extra columns rendererer to heavymelee list |
||
| Line 321: | Line 321: | ||
if #notes > 0 then cells["Notes"] = table.concat(notes, ". ") end | if #notes > 0 then cells["Notes"] = table.concat(notes, ". ") end | ||
return cells | |||
end | |||
-- Renders base damage and heavy melee scaling. | |||
-- Notes when heavy melee is only available via upgrade. | |||
function p.RenderHeavyMelee(ability) | |||
-- Find base heavy_melee property | |||
local base_damage, base_scale | |||
for k, v in pairs(ability) do | |||
if k ~= "Upgrades" and type(v) == "table" then | |||
local scale = v["Scale"] | |||
if type(scale) == "table" and scale["Type"] == "heavy_melee" | |||
and type(scale["Value"]) == "number" then | |||
base_damage = v["Value"] or 0 | |||
base_scale = scale["Value"] | |||
break | |||
end | |||
end | |||
end | |||
local cells = {} | |||
-- Active at base | |||
if base_scale and base_scale > 0 then | |||
cells["Base Damage"] = tostring(base_damage) | |||
cells["Heavy Melee Scaling"] = "×" .. base_scale | |||
return cells | |||
end | |||
-- Not at base — find in upgrades | |||
local upgrades = ability["Upgrades"] | |||
if type(upgrades) ~= "table" then return cells end | |||
for i, tier in ipairs(upgrades) do | |||
if type(tier) == "table" then | |||
for k, v in pairs(tier) do | |||
if type(v) == "table" then | |||
local scale = v["Scale"] | |||
if type(scale) == "table" and scale["Type"] == "heavy_melee" | |||
and type(scale["Value"]) == "number" and scale["Value"] > 0 then | |||
cells["Base Damage"] = tostring(v["Value"] or 0) | |||
cells["Heavy Melee Scaling"] = "×" .. scale["Value"] | |||
cells["Notes"] = "Only becomes 'eavy Melee on '''T" .. i .. "''' upgrade" | |||
return cells | |||
end | |||
end | |||
end | |||
end | |||
end | |||
return cells | |||
end | |||
-- Renders base damage and heavy melee scaling. | |||
-- Notes when heavy melee is only available via upgrade. | |||
function p.RenderHeavyMelee(ability) | |||
-- Find base heavy_melee property | |||
local base_damage, base_scale | |||
for k, v in pairs(ability) do | |||
if k ~= "Upgrades" and type(v) == "table" then | |||
local scale = v["Scale"] | |||
if type(scale) == "table" and scale["Type"] == "heavy_melee" | |||
and type(scale["Value"]) == "number" then | |||
base_damage = v["Value"] or 0 | |||
base_scale = scale["Value"] | |||
break | |||
end | |||
end | |||
end | |||
local cells = {} | |||
-- Active at base | |||
if base_scale and base_scale > 0 then | |||
cells["Base Damage"] = tostring(base_damage) | |||
cells["Heavy Melee Scaling"] = "×" .. base_scale | |||
return cells | |||
end | |||
-- Not at base — find in upgrades | |||
local upgrades = ability["Upgrades"] | |||
if type(upgrades) ~= "table" then return cells end | |||
for i, tier in ipairs(upgrades) do | |||
if type(tier) == "table" then | |||
for k, v in pairs(tier) do | |||
if type(v) == "table" then | |||
local scale = v["Scale"] | |||
if type(scale) == "table" and scale["Type"] == "heavy_melee" | |||
and type(scale["Value"]) == "number" and scale["Value"] > 0 then | |||
cells["Base Damage"] = tostring(v["Value"] or 0) | |||
cells["Heavy Melee Scaling"] = "×" .. scale["Value"] | |||
cells["Notes"] = "Only becomes '''Heavy Melee''' on T" .. i .. " upgrade" | |||
return cells | |||
end | |||
end | |||
end | |||
end | |||
end | |||
return cells | return cells | ||
end | end | ||