Module:BTD6 hero xp: Difference between revisions

mNo edit summary
No edit summary
Line 3: Line 3:


local level_reqs = { 180, 460, 1000, 1860, 3280, 5180, 8320, 9380, 13620, 16380, 14400, 16650, 14940, 16380, 17820, 19260, 20700, 16470, 17280 }
local level_reqs = { 180, 460, 1000, 1860, 3280, 5180, 8320, 9380, 13620, 16380, 14400, 16650, 14940, 16380, 17820, 19260, 20700, 16470, 17280 }
local difficulty_modifiers = { 1, 1.1, 1.2, 1.3 }
local xp_modifiers = { 1, 1.1, 1.2, 1.3, 1 * 1.1 * 1.05 * 1.08, 1.1 * 1.1 * 1.05 * 1.08, 1.2 * 1.1 * 1.05 * 1.08, 1.3 * 1.1 * 1.05 * 1.08 }


function p.main(frame)
function p.main(frame)
local wikitable = {
local wikitable = {
'{|class="wikitable" style="text-align:center;display:inline-table"\n!rowspan="2"|Level!!rowspan="2"|XP required!!colspan="4"|<abbr title="if placed on round 1">Rounds to level up</abbr>\n|-\n![[Beginner]]!![[Intermediate]]!![[Advanced]]!![[Expert]]'
'{|class="wikitable" style="text-align:center;display:inline-table"\n!rowspan="2"|Level!!rowspan="2"|XP required!!colspan="4"|<abbr title="if placed on round 1">Rounds to level up</abbr>!!colspan="4"|<abbr title="if placed on round 1">Rounds to level up with max [[Monkey Knowledge (BTD6)|Monkey Knowledge]]</abbr>\n|-\n![[Beginner]]!![[Intermediate]]!![[Advanced]]!![[Expert]]!![[Beginner]]!![[Intermediate]]!![[Advanced]]!![[Expert]]'
}
}
local curve = tonumber(frame.args[1])
local curve = tonumber(frame.args[1])
local xp_lv3 = math.floor(640 * curve)
local total_required = 0
local total_required = 0
local total_xp_diff = {0, 0, 0, 0}
local total_xp_diff = {0, 0, 0, 0, xp_lv3, xp_lv3, xp_lv3, xp_lv3}
local total_rounds_diff = {0, 0, 0, 0}
local total_rounds_diff = {0, 0, 0, 0, 0, 0, 0, 0}
local function insert_rounds(index, req)
local function insert_rounds(index, req)
local xp = 0
local xp = 0
local mult = difficulty_modifiers[index]
local mult = xp_modifiers[index]
local total_xp = total_xp_diff[index]
local total_xp = total_xp_diff[index]
local total_rounds = total_rounds_diff[index]
local total_rounds = total_rounds_diff[index]
Line 30: Line 31:
else xp = (total_rounds * 90 - 2880) end
else xp = (total_rounds * 90 - 2880) end
total_xp = total_xp + (xp * mult)
total_xp = total_xp + math.floor((xp * mult) + 0.05)
end
end
table.insert(wikitable, string.format('|%i (%i)', total_rounds - total_rounds_diff[index], total_rounds))
if total_rounds == 0 then table.insert(wikitable, '—')
else table.insert(wikitable, string.format('|%i (%i)', total_rounds - total_rounds_diff[index], total_rounds))
end
total_xp_diff[index] = total_xp
total_xp_diff[index] = total_xp
Line 49: Line 51:
insert_rounds(3, total_required)
insert_rounds(3, total_required)
insert_rounds(4, total_required)
insert_rounds(4, total_required)
insert_rounds(5, total_required)
insert_rounds(6, total_required)
insert_rounds(7, total_required)
insert_rounds(8, total_required)
end
end