Module:HeroDataArrays: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Gammaton32 (talk | contribs) No edit summary |
heroBulletDamageTable: list alt-fire weapons as their own rows instead of a separate table (with help from vergir-bot LLM) |
||
| Line 23: | Line 23: | ||
table.sort(rows, function(a, b) | table.sort(rows, function(a, b) | ||
local nameA = getSortName(a.name or "") | local nameA = getSortName(a.sortName or a.name or "") | ||
local nameB = getSortName(b.name or "") | local nameB = getSortName(b.sortName or b.name or "") | ||
return nameA:lower() < nameB:lower() | return nameA:lower() < nameB:lower() | ||
end) | end) | ||
| Line 93: | Line 93: | ||
cells = cells .. " || " .. (r[col.field] or 0) | cells = cells .. " || " .. (r[col.field] or 0) | ||
end | end | ||
-- A row may carry an alternate sort key and a label suffix, used by | |||
-- secondary fire rows so they stay underneath their hero's main row | |||
local nameCell = "| style=\"text-align:left;\"" | |||
if r.sortName then | |||
nameCell = nameCell .. " data-sort-value=\"" .. r.sortName .. "\"" | |||
end | |||
nameCell = nameCell .. " | " .. | |||
frame:expandTemplate{ title = "PageRef", args = { r.name } } .. | |||
(r.nameSuffix or "") | |||
t = t .. | t = t .. | ||
"|- \n" .. | "|- \n" .. | ||
nameCell .. | |||
cells .. " \n" | cells .. " \n" | ||
end | end | ||
| Line 466: | Line 475: | ||
spiritScalingDamage = "+" .. (data["SpiritScaling>BulletDamage"] or 0), | spiritScalingDamage = "+" .. (data["SpiritScaling>BulletDamage"] or 0), | ||
}) | }) | ||
-- Secondary fire is listed as its own row, right under the hero's main row | |||
local altDamage = data["Weapon>AltFire>BulletDamage"] | |||
if altDamage and altDamage ~= 0 then | |||
local altScaling = data["LevelScaling>BulletDamageAltFire"] or 0 | |||
table.insert(rows, { | |||
name = name, | |||
sortName = name .. " (alt fire)", | |||
nameSuffix = " (alt fire)", | |||
bulletDamage = altDamage, | |||
scalingDamage = "+" .. altScaling, | |||
maxScalingDamage = roundValue(altDamage + altScaling * soul_unlock.get_max("PowerIncrease")), | |||
spiritScalingDamage = "+0", | |||
}) | |||
end | |||
end | end | ||
sortHeroes(rows) | sortHeroes(rows) | ||