Anonymous

Module:Skills/Summoning: Difference between revisions

From Melvor Idle
Include enemyModifiers when creating descriptions from modifiers
(Fix max hit handling due to change in source data)
(Include enemyModifiers when creating descriptions from modifiers)
Line 12: Line 12:
local Shop = require('Module:Shop')
local Shop = require('Module:Shop')
local Num = require('Module:Number')
local Num = require('Module:Number')
local function getSummonModifierText(summonItem, maxVisible)
local playerMods = Modifiers.getModifiersText(summonItem.modifiers, false, false, maxVisible) or ''
local enemyMods = Modifiers.getModifiersText(summonItem.enemyModifiers, false, false, maxVisible, function(text) return 'Gives the enemy: ' .. text end) or ''
return playerMods .. (playerMods ~= '' and '<br>' or '') .. enemyMods
end


function p.getMarkTable(frame)
function p.getMarkTable(frame)
Line 135: Line 141:
local item = Items.getItemByID(Fam.productID)
local item = Items.getItemByID(Fam.productID)
if item ~= nil then
if item ~= nil then
local effectDesc = Modifiers.getModifiersText(item.modifiers, false, false, 10)
local row = html:tag('tr')
local row = html:tag('tr')
row:tag('td'):wikitext(Icons.Icon({item.name, type='item', notext=true}))
row:tag('td'):wikitext(Icons.Icon({item.name, type='item', notext=true}))
Line 233: Line 237:
if synDesc == nil then
if synDesc == nil then
-- Generate description from modifiers
-- Generate description from modifiers
synDesc = Modifiers.getModifiersText(syn.modifiers, false, false, 10) or ''
synDesc = getSummonModifierText(syn, 10)
end
end
local rowText = '|-'
local rowText = '|-'
Line 312: Line 316:
local famSkills = Modifiers.getModifierSkills(item.modifiers)
local famSkills = Modifiers.getModifierSkills(item.modifiers)
if Shared.contains(famSkills, skill) then
if Shared.contains(famSkills, skill) then
table.insert(rowArray, {Fam1 = item.name, FamID1 = item.id, Fam2 = nil, FamID2 = nil, Descrip = Modifiers.getModifiersText(item.modifiers, false)})
table.insert(rowArray, {Fam1 = item.name, FamID1 = item.id, Fam2 = nil, FamID2 = nil, Descrip = getSummonModifierText(item)})
end
end
end
end
Line 327: Line 331:
if synDesc == nil then
if synDesc == nil then
-- Generate description from modifiers
-- Generate description from modifiers
synDesc = Modifiers.getModifiersText(syn.modifiers, false) or ''
synDesc = getSummonModifierText(syn)
end
end
table.insert(rowArray, {Fam1 = FamName1, FamID1 = syn.summonIDs[1], Fam2 = FamName2, FamID2 = syn.summonIDs[2], Descrip = synDesc})
table.insert(rowArray, {Fam1 = FamName1, FamID1 = syn.summonIDs[1], Fam2 = FamName2, FamID2 = syn.summonIDs[2], Descrip = synDesc})