Module:Attacks/Tables: Difference between revisions

no edit summary
(Use printError function)
No edit summary
(2 intermediate revisions by one other user not shown)
Line 7: Line 7:
local Items = require('Module:Items')
local Items = require('Module:Items')
local Attacks = require('Module:Attacks')
local Attacks = require('Module:Attacks')
local Num = require('Module:Number')


function p._getSpecialAttackTable(effectDefn, categories, sourceHeaderLabel, includeSource)
function p._getSpecialAttackTable(effectDefn, categories, sourceHeaderLabel, includeSource)
-- TODO needs fixing for V1.3
-- Is going to be incredibly broken following combat effects & modifiers overhaul
return ''
--[==[
local spAttTable = {}
local spAttTable = {}
local attacks = Attacks.getAttacks(function(attack)
local attacks = Attacks.getAttacks(function(attack)
Line 70: Line 76:
         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(GameData.rawData[spellCat]) do
                if spell.specialAttack ~= nil and includedAttacks[spell.specialAttack] then
            local spAttID = spell.specialAttack or spell.specialAttackID
                     local spAtt = GameData.getEntityByID('attacks', spell.specialAttack)
                if spAttID ~= nil and includedAttacks[spAttID] then
                     local spAtt = GameData.getEntityByID('attacks', spAttID)
                     if spAtt ~= nil then
                     if spAtt ~= nil then
                         table.insert(spAttTable, {id = spAtt.id, source = 'Spell', sourceSort = spell.name, sourceText = Icons.Icon({ spell.name, type = 'spell' }), chance = spAtt.defaultChance, descType = 'player' })
                         table.insert(spAttTable, {id = spAtt.id, source = 'Spell', sourceSort = spell.name, sourceText = Icons.Icon({ spell.name, type = 'spell' }), chance = spAtt.defaultChance, descType = 'player' })
Line 194: Line 201:
if firstRow.chance then
if firstRow.chance then
rowSuffix = (rowCounts[spIdx][spAttRow.descType][spAttRow.chance] > 1 and 'rowspan="' .. rowCounts[spIdx][spAttRow.descType][spAttRow.chance] .. '" ') or ''
rowSuffix = (rowCounts[spIdx][spAttRow.descType][spAttRow.chance] > 1 and 'rowspan="' .. rowCounts[spIdx][spAttRow.descType][spAttRow.chance] .. '" ') or ''
table.insert(resultPart, '\r\n|' .. rowSuffix .. 'data-sort-value="' .. spAttRow.chance .. '" style="text-align:right;"| ' .. Shared.round(spAttRow.chance, 2, 0) .. '%')
table.insert(resultPart, '\r\n|' .. rowSuffix .. 'data-sort-value="' .. spAttRow.chance .. '" style="text-align:right;"| ' .. Num.round(spAttRow.chance, 2, 0) .. '%')
end
end
if firstRow.descType then
if firstRow.descType then
Line 204: Line 211:
spAttDesc = spAttDesc..'<br/>('
spAttDesc = spAttDesc..'<br/>('
local spAttDuration = spAttInterval * (spAtt.attackCount - 1)
local spAttDuration = spAttInterval * (spAtt.attackCount - 1)
spAttDesc = spAttDesc..Shared.round(spAttInterval / 1000, 2, 2)..'s delay between attacks.'
spAttDesc = spAttDesc..Num.round(spAttInterval / 1000, 2, 2)..'s delay between attacks.'
if spAtt.attackCount ~= nil and spAtt.attackCount > 2 then
if spAtt.attackCount ~= nil and spAtt.attackCount > 2 then
spAttDesc = spAttDesc..' '..Shared.round(spAttDuration / 1000, 2, 2)..'s total duration'
spAttDesc = spAttDesc..' '..Num.round(spAttDuration / 1000, 2, 2)..'s total duration'
end
end
spAttDesc = spAttDesc..')'
spAttDesc = spAttDesc..')'
Line 216: Line 223:


return table.concat(resultPart)
return table.concat(resultPart)
--]==]
end
end


Line 250: Line 258:
-- Generates a table showing the damage/DR multipliers for each combat triangle
-- Generates a table showing the damage/DR multipliers for each combat triangle
function p.getCombatTriangleTable()
function p.getCombatTriangleTable()
local triangleAttributes = {
-- TODO needs fixing for V1.3
return ''
--[==[local triangleAttributes = {
{
{
["name"] = 'damageModifier',
["name"] = 'damageModifier',
Line 320: Line 330:
table.insert(resultPart, '\r\n|}')
table.insert(resultPart, '\r\n|}')
return table.concat(resultPart)
return table.concat(resultPart)
--]==]
end
end


return p
return p
2,875

edits