Anonymous

Module:Magic: Difference between revisions

From Melvor Idle
Added an inline option for spell description (so that I can put some data on the monster page about curses more easily)
(Add TotH icon to tables)
(Added an inline option for spell description (so that I can put some data on the monster page about curses more easily))
Line 267: Line 267:
end
end


function p._getSpellDescription(spell)
function p._getSpellDescription(spell, inline)
if inline == nil then inline = false end
local connector = inline and '<br/>' or ' and '
if spell.description ~= nil then
if spell.description ~= nil then
         return Shared.applyTemplateData(spell.description, p._getSpellTemplateData(spell))
         return Shared.applyTemplateData(spell.description, p._getSpellTemplateData(spell))
Line 276: Line 278:
         end
         end
         if spell.targetModifiers ~= nil then
         if spell.targetModifiers ~= nil then
             local targetModText = Constants.getModifiersText(spell.targetModifiers, false)
             local targetModText = Constants.getModifiersText(spell.targetModifiers, false, inline)
             table.insert(resultPart, 'Enemies are inflicted with:<br/>' .. targetModText)
             if inline then
            table.insert(resultPart, targetModText)
            else
            table.insert(resultPart, 'Enemies are inflicted with:<br/>' .. targetModText)
            end
         end
         end
         return table.concat(resultPart, '<br/>')
         return table.concat(resultPart, connector)
     elseif spell.specialAttackID ~= nil or spell.specialAttack ~= nil then
     elseif spell.specialAttackID ~= nil or spell.specialAttack ~= nil then
     local spAtt = Attacks.getAttackByID(spell.specialAttackID or spell.specialAttack)
     local spAtt = Attacks.getAttackByID(spell.specialAttackID or spell.specialAttack)