Module:GameSkills: Difference between revisions
From SpiritVale Wiki
More actions
No edit summary |
No edit summary |
||
| Line 301: | Line 301: | ||
-- - For non-healing: "100% + 40 / 80 / 120 ... Attack Per Level" | -- - For non-healing: "100% + 40 / 80 / 120 ... Attack Per Level" | ||
-- - For healing: "10 / 20 / 30 ... Healing Per Level" | -- - For healing: "10 / 20 / 30 ... Healing Per Level" | ||
local function formatDamageEntry(entry, maxLevel | local function formatDamageEntry(entry, maxLevel) | ||
if type(entry) ~= "table" then | if type(entry) ~= "table" then | ||
return nil | return nil | ||
end | end | ||
local isHealing = (entry.Type == "Healing") | |||
local baseRaw = entry["Base %"] | local baseRaw = entry["Base %"] | ||
| Line 312: | Line 314: | ||
local perN = toNum(perRaw) | local perN = toNum(perRaw) | ||
local basis = basisLabel(entry | local basis = isHealing and "Healing" or basisLabel(entry) | ||
local function baseIsPresent() | |||
if baseN ~= nil then | |||
return baseN ~= 0 | |||
if baseN ~= nil | |||
return | |||
end | end | ||
if baseRaw ~= nil then | if baseRaw ~= nil then | ||
local s = tostring(baseRaw) | local s = tostring(baseRaw) | ||
return (s ~= "" and s ~= "0" and s ~= "0.0" and s ~= "0.00") | |||
end | end | ||
return false | |||
end | end | ||
local baseText = nil | local baseText = nil | ||
if | if baseIsPresent() then | ||
if baseN ~= nil then | if baseN ~= nil then | ||
baseText = fmtNum(baseN) .. "%" | baseText = fmtNum(baseN) .. "%" | ||
| Line 358: | Line 336: | ||
end | end | ||
if perN == nil or perN == 0 or not maxLevel or maxLevel <= 0 then | if perN == nil or perN == 0 or not maxLevel or maxLevel <= 0 then | ||
return baseText and (baseText .. " " .. basis) or nil | |||
end | end | ||
local vals = {} | local vals = {} | ||
for lv = 1, maxLevel do | for lv = 1, maxLevel do | ||
table.insert(vals, fmtNum(perN * lv) | table.insert(vals, fmtNum(perN * lv) .. "%") | ||
end | end | ||
local listText = table.concat(vals, " / ") | |||
if not baseText then | if not baseText then | ||
return string.format("%s %s Per Level", listText, basis) | return string.format("%s %s Per Level", listText, basis) | ||
end | end | ||
return string.format("%s + %s %s Per Level", baseText, listText, basis) | return string.format("%s + %s %s Per Level", baseText, listText, basis) | ||
end | end | ||