Editing Module:AbilityTable/ComplexRenderersGive feedback
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 255: | Line 255: | ||
end | end | ||
-- Renders | -- Renders light melee scaling. | ||
-- Special case for upgrades that | -- Special case for upgrades that change to heavy melee scaling. | ||
function p.RenderMelee(ability) | function p.RenderMelee(ability) | ||
local cells = {} | local cells = {} | ||
local base_scale = find_base_melee_scale(ability) | |||
if base_scale then | if base_scale then cells["Light Melee Scaling"] = "×" .. base_scale end | ||
local upgrades = ability["Upgrades"] | local upgrades = ability["Upgrades"] | ||
if type(upgrades) ~= "table" then return cells end | if type(upgrades) ~= "table" then return cells end | ||
local notes = {} | local notes = {} | ||
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 _, v in pairs(tier) do | |||
for | |||
if type(v) == "table" then | if type(v) == "table" then | ||
local scale = v["Scale"] | local scale = v["Scale"] | ||
if type(scale) == "table" and | if type(scale) == "table" and type(scale["Value"]) == "number" then | ||
local stype = scale["Type"] | |||
local delta = scale["Value"] | |||
if stype == "heavy_melee" and delta > 0 then | |||
table.insert(notes, "T" .. i .. " upgrade changes scaling to ×" | |||
.. delta .. " of Heavy Melee damage") | |||
elseif stype == "melee" and delta ~= 0 and base_scale then | |||
local final = math.floor((base_scale + delta) * 1000 + 0.5) / 1000 | |||
table.insert(notes, "T" .. i .. " upgrade adds ×" | |||
.. delta .. " scaling (total ×" .. final .. ")") | |||
end | end | ||
end | end | ||
end | end | ||
end | end | ||
end | end | ||
end | end | ||
if #notes > 0 then cells["Notes"] = table.concat(notes, " ") end | |||
if #notes > 0 then cells["Notes"] = table.concat(notes, " | |||
return cells | return cells | ||
end | end | ||