Module:ModifierTables: Difference between revisions

From Melvor Idle
No edit summary
(getModifierValue: Fix for modifier value ranges (from Astrology))
Line 50: Line 50:


             for i, subVal in ipairs(valueArray) do
             for i, subVal in ipairs(valueArray) do
                 if type(subVal) == 'table' and subVal.skillID ~= nil then
                 if type(subVal) == 'table' then
                    -- Modifier value is skill specific
if  subVal.skillID ~= nil then
                    if skill == nil or skill == '' or subVal.skillID == skill then
-- Modifier value is skill specific
                        magnitude[modType] = magnitude[modType] + subVal.value
if skill == nil or skill == '' or subVal.skillID == skill then
                    end
magnitude[modType] = magnitude[modType] + subVal.value
end
else
-- Modifier value is a table of two numbers representing a range. Take the largest value
magnitude[modType] = magnitude[modType] + (subVal[2] or 0)
end
                 else
                 else
                     magnitude[modType] = magnitude[modType] + subVal
                     magnitude[modType] = magnitude[modType] + subVal