Module:Attacks/Tables: Difference between revisions

Removed getCombatTriangleTable as this table can be found in-game and an image can be used in place of this function
No edit summary
(Removed getCombatTriangleTable as this table can be found in-game and an image can be used in place of this function)
Line 254: Line 254:


return p._getSpecialAttackTable(effectDefn, tableCategories, sourceHeaderLabel, includeSource)
return p._getSpecialAttackTable(effectDefn, tableCategories, sourceHeaderLabel, includeSource)
end
-- Generates a table showing the damage/DR multipliers for each combat triangle
function p.getCombatTriangleTable()
-- TODO needs fixing for V1.3
return ''
--[==[local triangleAttributes = {
{
["name"] = 'damageModifier',
["head"] = 'DMG',
["func"] = function(val)
local outVal = 100 * (val - 1)
return { outVal, (outVal < 0 and '' or '+') .. string.format(outVal, '%.0f') .. '%' }
end
},
{
["name"] = 'reductionModifier',
["head"] = 'DR',
["func"] = function(val) return { (val - 1), string.format('%.2fx', val) } end
}
}
local combatStyles = {
{ 'melee', Icons.Icon({ 'Attack', 'Melee', type = 'skill' }) },
{ 'ranged', Icons.Icon({ 'Ranged', type = 'skill' }) },
{ 'magic', Icons.Icon({ 'Magic', type = 'skill' }) }
}
local gameMode = {
{ 'Standard Mode', 'Standard' },
{ 'Hardcore Mode', Icons.Icon({ 'Hardcore' }) }
}
local attrCount = Shared.tableCount(triangleAttributes)
local styleCount = Shared.tableCount(combatStyles)
local modeCount = Shared.tableCount(gameMode)
local resultPart = {}
-- Generate header
table.insert(resultPart, '{| class="wikitable"\r\n|-')
table.insert(resultPart, '\r\n!rowspan="2"| Player Style')
table.insert(resultPart, '\r\n!rowspan="2"| Game Mode')
for i, style in ipairs(combatStyles) do
table.insert(resultPart, '\r\n!colspan="' .. attrCount .. '"| VS ' .. style[2])
end
local attrHeader = ''
for i, attr in ipairs(triangleAttributes) do
attrHeader = attrHeader .. '\r\n! ' .. attr.head
end
table.insert(resultPart, '\r\n|-' .. string.rep(attrHeader, styleCount))
-- Generate table body
for i, attStyle in ipairs(combatStyles) do
local borderStyle = (i < styleCount and 'style="border-bottom:solid lightgrey"' or '')
for j, mode in ipairs(gameMode) do
table.insert(resultPart, '\r\n|-')
if j == 1 then
table.insert(resultPart, '\r\n|rowspan="' .. modeCount .. '" ' .. borderStyle .. '| ' .. attStyle[2])
elseif j == modeCount and borderStyle ~= '' then
table.insert(resultPart, ' ' .. borderStyle)
end
table.insert(resultPart, '\r\n| ' .. mode[2])
for k, targStyle in ipairs(combatStyles) do
for m, attr in ipairs(triangleAttributes) do
local cellStyle = nil
local attValRaw = Constants.getTriangleAttribute(attr.name, attStyle[1], targStyle[1], mode[1])
local attrVal = attr.func(attValRaw)
if attrVal[1] > 0 then
cellStyle = 'background-color:lightgreen;'
elseif attrVal[1] < 0 then
cellStyle = 'background-color:lightpink;'
end
table.insert(resultPart, '\r\n|' .. (cellStyle ~= nil and 'style="' .. cellStyle .. '"| ' or ' ') .. attrVal[2])
end
end
end
end
table.insert(resultPart, '\r\n|}')
return table.concat(resultPart)
--]==]
end
end


return p
return p