Module:BTD6 paragon stats: Difference between revisions

From Blooncyclopedia, the independent Bloons knowledge base
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(12 intermediate revisions by the same user not shown)
Line 20: Line 20:
-- upper header
-- upper header
table.insert(ret, '!rowspan="2"|Degree\n!rowspan="2"|Power')
table.insert(ret, '!rowspan="2"|Degree\n!rowspan="2"|Power\n!rowspan="2"|[[Paragon#Boss damage|Boss multiplier]]')
local labels = {}
local labels = {}
local sublabels = {}
local sublabels = {}
Line 48: Line 48:
table.insert(ret, '|-')
table.insert(ret, '|-')
table.insert(ret, string.format("!%s\n|%s", i, degreeRequirements[i]))
table.insert(ret, string.format("!%s\n|%s", i, degreeRequirements[i]))
if i < 20 then table.insert(ret, "|×1.0")
elseif i < 40 then table.insert(ret, "|×1.25")
elseif i < 60 then table.insert(ret, "|×1.5")
elseif i < 80 then table.insert(ret, "|×1.75")
elseif i ~= 100 then table.insert(ret, "|×2.0")
else table.insert(ret, "|×2.25") end
local values = {}
local values = {}
Line 55: Line 61:
end
end
local bd = 0
local amount = 0
local prefix = ''
local suffix = ''
for j=1, #values do
for j=1, #values do
if sublabels[j] == 'Damage' then bd = values[j] end
if sublabels[j] == 'MOAB-Class damage' then bd = bd + values[j] end
if sublabels[j] == 'Boss damage' then bd = bd + values[j] end
prefix = ''
suffix = ''
if sublabels[j] == 'Cooldown' then
if sublabels[j] == 'Cooldown' then
table.insert(ret, string.format('|%.4gs',
amount = values[j] / (1 + (0.01 * math.sqrt((i-1)*50)))
values[j] / (1 + (0.01 * math.sqrt((i-1)*50)))
suffix = 's'
))
elseif sublabels[j] == 'Pierce' then
elseif sublabels[j] == 'Pierce' then
if i == 100 then
if i == 100 then amount = values[j] * 2 + 100
table.insert(ret, string.format('|%.4g',
else amount = values[j] * (1 + (i-1) * 0.01) + i - 1
values[j] * 2 + 100
))
else
table.insert(ret, string.format('|%.4g',
values[j] * (1 + (i-1) * 0.01) + i - 1
))
end
end
elseif sublabels[j] == 'Damage' then
elseif sublabels[j] == 'Damage' then
if i == 100 then
if i == 100 then amount = values[j] * 2 + 10
table.insert(ret, string.format('|%.4g',
else amount = values[j] * (1 + (i-1) * 0.01) + math.floor((i-1)/10)
values[j] * 2 + 10
))
else
table.insert(ret, string.format('|%.4g',
values[j] * (1 + (i-1) * 0.01) + math.floor((i-1)/10)
))
end
end
elseif sublabels[j] == 'Ceramic damage' or sublabels[j] == 'MOAB-Class damage' then
else
if i == 100 then
if i == 100 then amount = values[j] * 2
table.insert(ret, string.format('|%.4g',
else amount = values[j] * (1 + (i-1) * 0.01)
values[j] * 2
))
else
table.insert(ret, string.format('|%.4g',
values[j] * (1 + (i-1) * 0.01)
))
end
end
prefix = ' +'
end
end
if amount > 999 then table.insert(ret, string.format('|%s%.8g%s', prefix, amount, suffix))
else table.insert(ret, string.format('|%s%.4g%s', prefix, amount, suffix)) end
end
end
end
end

Latest revision as of 23:01, 25 July 2024

Documentation for this module may be created at Module:BTD6 paragon stats/doc

local p = {}

local degreeRequirements = {
	0,      2000,   2324,   2666,   3027,   3408,   3808,   4228,   4669,   5131,
	5615,   6121,   6650,   7203,   7779,   8379,   9004,   9654,   10330,  11032,
	11761,  12518,  13302,  14114,  14955,  15825,  16725,  17655,  18616,  19609,
	20633,  21689,  22778,  23900,  25056,  26246,  27471,  28732,  30028,  31360,
	32729,  34135,  35579,  37061,  38582,  40143,  41743,  43383,  45064,  46786,
	48550,  50356,  52205,  54098,  56034,  58014,  60039,  62109,  64225,  66387,
	68596,  70853,  73157,  75509,  77910,  80360,  82860,  85410,  88011,  90664,
	93368,  96124,  98933,  101795, 104711, 107681, 110706, 113787, 116923, 120115,
	123364, 126670, 130034, 133456, 136937, 140478, 144078, 147738, 151459, 155241,
	159085, 162991, 166960, 170993, 175089, 179249, 183474, 187764, 192120, 200000
}

function p.main(frame)
	local ret = {
		'{|class="wikitable mw-collapsible mw-collapsed" style="text-align:center"\n|+style="white-space:nowrap"|Degree-dependent stats\n',
	}
	
	-- upper header
	table.insert(ret, '!rowspan="2"|Degree\n!rowspan="2"|Power\n!rowspan="2"|[[Paragon#Boss damage|Boss multiplier]]')
	local labels = {}
	local sublabels = {}
	local colspans = {}
	
	for label in string.gmatch(frame.args['labels'], string.format('([^,]+)')) do
		table.insert(labels, label)
	end
	
	for colspan in string.gmatch(frame.args['colspans'], string.format('([^,]+)')) do
		table.insert(colspans, colspan)
	end
	
	for i=1, #labels do
		table.insert(ret, string.format('!colspan="%s"|<i>%s</i>', colspans[i], labels[i]))
	end
	
	-- lower header
	table.insert(ret, '|-')
	for label in string.gmatch(frame.args['sublabels'], string.format('([^,]+)')) do
		table.insert(sublabels, label)
		table.insert(ret, string.format('!%s', label))
	end
	
	-- values by degree
	for i=1, 100 do
		table.insert(ret, '|-')
		table.insert(ret, string.format("!%s\n|%s", i, degreeRequirements[i]))
		if i < 20 then table.insert(ret, "|×1.0")
		elseif i < 40 then table.insert(ret, "|×1.25")
		elseif i < 60 then table.insert(ret, "|×1.5")
		elseif i < 80 then table.insert(ret, "|×1.75")
		elseif i ~= 100 then table.insert(ret, "|×2.0")
		else table.insert(ret, "|×2.25") end
		
		local values = {}
		
		for value in string.gmatch(frame.args['values'], string.format('([^,]+)')) do
			table.insert(values, value)
		end
		
		local bd = 0
		local amount = 0
		local prefix = ''
		local suffix = ''
		for j=1, #values do
			if sublabels[j] == 'Damage' then bd = values[j] end
			if sublabels[j] == 'MOAB-Class damage' then bd = bd + values[j] end
			if sublabels[j] == 'Boss damage' then bd = bd + values[j] end
			
			prefix = ''
			suffix = ''
			
			if sublabels[j] == 'Cooldown' then
				amount = values[j] / (1 + (0.01 * math.sqrt((i-1)*50)))
				suffix = 's'
			elseif sublabels[j] == 'Pierce' then
				if i == 100 then	amount = values[j] * 2 + 100
				else				amount = values[j] * (1 + (i-1) * 0.01) + i - 1
				end
			elseif sublabels[j] == 'Damage' then
				if i == 100 then	amount = values[j] * 2 + 10
				else				amount = values[j] * (1 + (i-1) * 0.01) + math.floor((i-1)/10)
				end
			else
				if i == 100 then	amount = values[j] * 2
				else				amount = values[j] * (1 + (i-1) * 0.01)
				end
				prefix = ' +'
			end
			if amount > 999 then table.insert(ret, string.format('|%s%.8g%s', prefix, amount, suffix))
			else table.insert(ret, string.format('|%s%.4g%s', prefix, amount, suffix)) end
		end
	end
	
	table.insert(ret, '|}')
	return table.concat(ret, '\n')
end

return p