Module:ModifierTables: Difference between revisions

Implement getPillarsWithModifier(); _getModifierTable: Add Agility pillars
(Tweaked a thing to make the getModifierTable hopefully work a bit better)
(Implement getPillarsWithModifier(); _getModifierTable: Add Agility pillars)
Line 98: Line 98:
         end)
         end)
   return obstList
   return obstList
end
function p.getPillarsWithModifier(modifiers, skill, getOpposites)
  if type(modifiers) == 'string' then
    modifiers = {modifiers}
  end
  local pillarList = Agility.getPillars(
        function(pillar)
          local result = false
          for i, mod in Shared.skpairs(modifiers) do
            if p.getModifierValue(pillar.modifiers, mod, skill, getOpposites) ~= 0 then
              result = true
              break
            end
          end
          return result
        end)
  return pillarList
end
end


Line 238: Line 256:


     row.modifierText, row.otherModifiers = getModText(obst.modifiers)
     row.modifierText, row.otherModifiers = getModText(obst.modifiers)
    if string.len(row.otherModifiers) > 0 then
      hasOtherModifiers = true
    end
    table.insert(tableArray, row)
  end
  local pillarList = p.getPillarsWithModifier(modifiers, skill, getOpposites)
  for i, pillar in Shared.skpairs(pillarList) do
    local row = {}
    row.name = pillar.name
    row.icon = Icons.Icon({'Agility', pillar.name, type='skill'})
    row.type = '[[Agility#Passive Pillars|Agility Pillar]]'
    local totalVal = 0
    for i, mod in pairs(modifiers) do
      totalVal = totalVal + p.getModifierValue(pillar.modifiers, mod, skill, getOpposites)
    end
    row.val = totalVal
    row.modifierText, row.otherModifiers = getModText(pillar.modifiers)


     if string.len(row.otherModifiers) > 0 then
     if string.len(row.otherModifiers) > 0 then