Anonymous

Module:Sandbox/GauTest/ModifierTables: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 216: Line 216:
end
end


-- TODO
-- Need to split up the worship
function p.getTownshipWorshipsWithModifier(modifiers, skill, getOpposites)
function p.getTownshipWorshipsWithModifier(modifiers, skill, getOpposites)
if type(modifiers) == 'string' then
if type(modifiers) == 'string' then
modifiers = {modifiers}
modifiers = {modifiers}
end
end
local buildingList = GameData.getEntities(GameData.skillData.Township.buildings,
local worshipList = GameData.getEntities(Township.GetSplitWorship(),
function(building)
function(worship)
for i, mod in ipairs(modifiers) do
for i, mod in ipairs(modifiers) do
if p.getModifierValue(building.modifiers, mod, skill, getOpposites) ~= 0 then
if p.getModifierValue(worship.modifiers, mod, skill, getOpposites) ~= 0 then
return true
return true
end
end
Line 232: Line 230:
end
end
)
)
return buildingList
return worshipList
end
end


Line 479: Line 477:


row.modifierText, row.otherModifiers = getModText(building.modifiers)
row.modifierText, row.otherModifiers = getModText(building.modifiers)
if not hasOtherModifiers and string.len(row.otherModifiers) > 0 then
hasOtherModifiers = true
end
table.insert(tableArray, row)
end
local worshipList = p.getTownshipWorshipsWithModifier(modifiers, skill, getOpposites)
for i, worship in ipairs(worshipList) do
local row = {}
row.name = worship.name
row.icon = Icons.Icon({worship.statueName, type='building'})
row.type = 'Worship'
local totalVal = 0
for i, mod in pairs(modifiers) do
totalVal = totalVal + p.getModifierValue(worship.modifiers, mod, skill, getOpposites)
end
row.val = totalVal
row.modifierText, row.otherModifiers = getModText(worship.modifiers)


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

edits