572
edits
No edit summary |
No edit summary |
||
Line 216: | Line 216: | ||
end | end | ||
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 | local worshipList = GameData.getEntities(Township.GetSplitWorship(), | ||
function( | function(worship) | ||
for i, mod in ipairs(modifiers) do | for i, mod in ipairs(modifiers) do | ||
if p.getModifierValue( | if p.getModifierValue(worship.modifiers, mod, skill, getOpposites) ~= 0 then | ||
return true | return true | ||
end | end | ||
Line 232: | Line 230: | ||
end | end | ||
) | ) | ||
return | 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 |
edits