Anonymous

Module:Magic: Difference between revisions

From Melvor Idle
_getSpellRow: Prevent attack interval display when attack only has a single hit
(right-aligning spell damage)
(_getSpellRow: Prevent attack interval display when attack only has a single hit)
(One intermediate revision by one other user not shown)
Line 323: Line 323:
local result = ''
local result = ''


--11/01/22: Added Spell Damage for standard & archaic spells
if spell.spellBook == 'standard' or spell.spellBook == 'archaic' then
result = result.."\r\n|-\r\n|'''Spell Damage:''' "..p._getSpellStat(spell, 'spellDamage')
end
--8/20/21: Changed to using the new getSpellDescription function
--8/20/21: Changed to using the new getSpellDescription function
result = result.."\r\n|-\r\n|'''Description:'''<br/>"..p._getSpellStat(spell, 'description')
result = result.."\r\n|-\r\n|'''Description:'''<br/>"..p._getSpellStat(spell, 'description')
Line 564: Line 568:
local spAtt = Attacks.getAttackByID(spAttID)
local spAtt = Attacks.getAttackByID(spAttID)
local interval = spAtt.attackInterval
local interval = spAtt.attackInterval
if interval ~= nil then
local hits = spAtt.attackCount ~= nil and spAtt.attackCount or 1
local hits = spAtt.attackCount ~= nil and spAtt.attackCount or 1
if interval ~= nil and hits > 1 then
             table.insert(rowPart, '<br/>(' .. Shared.round(interval / 1000, 2, 2) .. 's delay between attacks.')
             table.insert(rowPart, '<br/>(' .. Shared.round(interval / 1000, 2, 2) .. 's delay between attacks.')
if hits > 2 then
if hits > 2 then