Anonymous

Module:ModifierTables: Difference between revisions

From Melvor Idle
_getModifierTable: Fix hard-coded sort value of 15 for Astrology
(getModifierTable: Add option to force modifier magnitude sorting)
(_getModifierTable: Fix hard-coded sort value of 15 for Astrology)
Line 423: Line 423:
local constellationList = p.getConstellationsWithModifier(modifiers, skill, getOpposites)
local constellationList = p.getConstellationsWithModifier(modifiers, skill, getOpposites)
for i, cons in ipairs(constellationList) do
for i, cons in ipairs(constellationList) do
local modList = Skills._buildAstrologyModifierArray(cons, nil, true, true, true, true)
local row = {}
local row = {}
row.name = cons.name
row.name = cons.name
Line 429: Line 430:
row.type = '[[Astrology#Constellations|Constellation]]'
row.type = '[[Astrology#Constellations|Constellation]]'
row.typeText = 'Constellation'
row.typeText = 'Constellation'
row.val = 15 -- Assume highest possible, the range is 1 to 15 inclusive
local modList = Skills._buildAstrologyModifierArray(cons, nil, true, true, true, true)
row.modifierText, row.otherModifiers = getModText(modList)
row.modifierText, row.otherModifiers = getModText(modList)
local totalVal = 0
for i, mod in pairs(modifiers) do
totalVal = totalVal + p.getModifierValue(modList, mod, skill, getOpposites)
end
row.val = totalVal


if not hasOtherModifiers and string.len(row.otherModifiers) > 0 then
if not hasOtherModifiers and string.len(row.otherModifiers) > 0 then