Anonymous

Module:Attacks/Tables: Difference between revisions

From Melvor Idle
m
Fixed Spell category and interval between attacks will only show if attack count > 1
(Uncommented the Monster and Item categories as they seem to work properly)
m (Fixed Spell category and interval between attacks will only show if attack count > 1)
 
Line 8: Line 8:
local Attacks = require('Module:Attacks')
local Attacks = require('Module:Attacks')
local Num = require('Module:Number')
local Num = require('Module:Number')
local Magic = require('Module:Magic')


function p._getSpecialAttackTable(effectDefn, categories, sourceHeaderLabel, includeSource)
function p._getSpecialAttackTable(effectDefn, categories, sourceHeaderLabel, includeSource)
Line 68: Line 69:
         end
         end
     end
     end
--[[
 
     -- Spells
     -- Spells
     if includeCat['Spell'] then
     if includeCat['Spell'] then
         local spellCats = { 'ancientSpells', 'archaicSpells' }
         local spellCats = { 'standard', 'ancient', 'archaic', 'abyssal' }
         for i, spellCat in ipairs(spellCats) do
         for i, spellCat in ipairs(spellCats) do
             for j, spell in ipairs(GameData.rawData[spellCat]) do
             for j, spell in ipairs(Magic.getSpellsBySpellBook(spellCat)) do
             local spAttID = spell.specialAttack or spell.specialAttackID
             local spAttID = spell.specialAttack or spell.specialAttackID
                 if spAttID ~= nil and includedAttacks[spAttID] then
                 if spAttID ~= nil and includedAttacks[spAttID] then
Line 84: Line 85:
         end
         end
     end
     end
 
--[[
-- Summoning familiars. Any effects inflicted by combat familiars aren't actually special
-- Summoning familiars. Any effects inflicted by combat familiars aren't actually special
-- attacks, therefore the handling here is a bit different
-- attacks, therefore the handling here is a bit different
Line 206: Line 207:
--Adding the time between hits and total duration as a note at the end of the special attack description
--Adding the time between hits and total duration as a note at the end of the special attack description
local spAttInterval = spAtt.attackInterval ~= nil and spAtt.attackInterval or -1
local spAttInterval = spAtt.attackInterval ~= nil and spAtt.attackInterval or -1
if(spAttInterval ~= -1 and spAtt.damage ~= nil and Shared.tableCount(spAtt.damage) > 0) then
if(spAttInterval ~= -1 and spAtt.damage ~= nil and Shared.tableCount(spAtt.damage) > 0 and spAtt.attackCount > 1) then
spAttDesc = spAttDesc..'<br/>('
spAttDesc = spAttDesc..'<br/>('
local spAttDuration = spAttInterval * (spAtt.attackCount - 1)
local spAttDuration = spAttInterval * (spAtt.attackCount - 1)