Anonymous

Module:Skills/Agility: Difference between revisions

From Melvor Idle
Added a getObstacles function which will be used by the in-progress ModifierTables module
(Applied same change to getModifierText to the PassivePillars function)
(Added a getObstacles function which will be used by the in-progress ModifierTables module)
(One intermediate revision by the same user not shown)
Line 24: Line 24:
   end
   end
   return nil
   return nil
end
function p.getObstacles(checkFunc)
  local result = {}
  for i, obst in Shared.skpairs(SkillData.Agility.Obstacles) do
    if checkFunc(obst) then
      local newObst = Shared.clone(obst)
      newObst.id = i - 1
      table.insert(result, newObst)
    end
  end
  return result
end
end


Line 58: Line 70:
     --After that, adding the bonuses
     --After that, adding the bonuses
     for bonusName, bonusValue in pairs(obst.modifiers) do
     for bonusName, bonusValue in pairs(obst.modifiers) do
       table.insert(bonuses, Constants.getModifierText(bonusName, bonusValue))
       table.insert(bonuses, Constants._getModifierText(bonusName, bonusValue))
     end
     end
     if Shared.tableCount(bonuses) == 0 then
     if Shared.tableCount(bonuses) == 0 then
Line 106: Line 118:
     local bonuses = {}
     local bonuses = {}
     for bonusName, bonusValue in pairs(pill.modifiers) do
     for bonusName, bonusValue in pairs(pill.modifiers) do
       table.insert(bonuses, Constants.getModifierText(bonusName, bonusValue))
       table.insert(bonuses, Constants._getModifierText(bonusName, bonusValue))
     end
     end
     if Shared.tableCount(bonuses) == 0 then
     if Shared.tableCount(bonuses) == 0 then