Módulo:Calculadora de Fúria Ira Insana
Documentação do módulo
Esta documentação é transcluída de Predefinição:Sem documentação/doc. [editar] [atualizar]
Este módulo não possui nenhuma documentação. Por favor, considere adicionar uma documentação em Módulo:Calculadora de Fúria Ira Insana/doc. [editar]
Módulo:Calculadora de Fúria Ira Insana's a função main é invocada por Calculadora:Predefinição/Combate/Fúria Ira Insana.
-- <pre>
local p = {}
local lang = mw.getContentLanguage()
function p.main(frame)
local invokeArgs = frame.args
local args = frame:getParent().args
return p._main( invokeArgs, args )
end
function p._main( invokeArgs, args )
local maxhp = tonumber(args.maxhp)
--local upperBoundsPercent = {99.999,90.999,80.999,70.999,60.999,50.999,40.999,30.999,20.999,10.999}
local upperBoundsPercent = {100,91,81,71,61,51,41,31,21,11}
local lowerBoundsPercent = {91,81,71,61,51,41,31,21,11,1}
local upperBoundsHP = {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999}
local lowerBoundsHP = {-999,-999,-999,-999,-999,-999,-999,-999,-999,-999}
local percentIncrease = {0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0}
--fill in the hp values
for range = 1,10 do
upperBoundsHP[range] = math.floor(upperBoundsPercent[range]/100*maxhp)
lowerBoundsHP[range] = math.floor(lowerBoundsPercent[range]/100*maxhp)
end
--create the table
local resultsDiv = mw.html.create( 'div' )
local resultsTable = mw.html.create( 'table' )
resultsTable:addClass( 'wikitable' )
:addClass( 'align-center-1 align-center-2 align-center-3' )
:tag( 'tr' )
:tag( 'th' )
:wikitext( 'Resultados' )
:attr( 'colspan', 3 )
:done()
:done()
:tag( 'tr' )
:tag( 'th' )
:wikitext( 'Aumento percentual de danos' )
:done()
:tag( 'th' )
:wikitext( 'Limites como porcentagem de pontos de vida máximos')
:done()
:tag( 'th' )
:wikitext( 'Limites em pontos de vida')
:done()
:done()
:done()
resultsTable:tag( 'tr' )
:tag( 'td' )
:wikitext ( '0.0%' )
:done()
:tag( 'td' )
:wikitext ( '100%+' )
:done()
:tag( 'td' )
:wikitext ( string.format("%s+",lang:formatNum(maxhp)) )
:done()
:done()
for range = 1,10 do
--boundary checks
if(upperBoundsHP[1] == maxhp) then upperBoundsHP[1] = upperBoundsHP[1] -1 end
if (range>=2 and range<=9) then
if (upperBoundsHP[range] == lowerBoundsHP[range-1]) then upperBoundsHP[range] = upperBoundsHP[range] -1 end
end
if(upperBoundsHP[10] == lowerBoundsHP[9]) then upperBoundsHP[10] = upperBoundsHP[10] -1 end
resultsTable:tag( 'tr' )
:tag( 'td' )
:wikitext ( string.format("%.1f%%",percentIncrease[range]) )
:done()
:tag( 'td' )
:wikitext ( string.format("'''['''%d%%,%d%%''')'''",lowerBoundsPercent[range],upperBoundsPercent[range]) )
:done()
:tag( 'td' )
:wikitext ( string.format("%s - %s",lang:formatNum(lowerBoundsHP[range]),lang:formatNum(upperBoundsHP[range])) )
:done()
:done()
end
resultsTable:tag( 'tr' )
:tag( 'td' )
:wikitext ( '5.5%' )
:done()
:tag( 'td' )
:wikitext ( "'''('''0%,1%''')'''" )
:done()
:tag( 'td' )
:wikitext ( string.format("1 - %s",lang:formatNum(lowerBoundsHP[10])-1) )
:done()
:done()
--return results (table)
resultsDiv:node(tostring(resultsTable))
return resultsDiv
end
return p
-- </nowiki>