Module:LevelTables: Difference between revisions

Jump to navigation Jump to search
renamed power increase to boons
One Bar (talk | contribs)
Add function to write the list of multishot heroes and their weapon stats
Line 19: Line 19:
}
}


-- Outputs a wikitable of the boon scaling of the inputted property by hero
-- @function  p.write_power_increase_table
-- @param      {string}
-- @return    {string}
p.write_power_increase_table = function(frame)
p.write_power_increase_table = function(frame)
local pi_souls_list = {}
local pi_souls_list = {}
Line 110: Line 114:
return tostring(create_table)
return tostring(create_table)
end
-- Outputs a string list of weapon stats from heroes with either spreadshot or burst fire
-- @function  p.write_multishot_stats
-- @param      {}
-- @return    {string}
p.write_multishot_stats = function(frame)
local function hero_sort(h1, h2)
return h1["Name"] < h2["Name"]
end
local spreadshot_heroes = {}
local burst_heroes = {}
for _, hero in pairs(heroes_data) do
if (hero["BulletsPerShot"] > 1 and not hero["IsDisabled"]) then
table.insert(spreadshot_heroes, hero)
elseif (hero["BulletsPerBurst"] > 1 and not hero["IsDisabled"]) then
table.insert(burst_heroes, hero)
end
end
table.sort(spreadshot_heroes, hero_sort)
table.sort(burst_heroes, hero_sort)
local multishot_str = "Weapons with multiple projectiles (Spreadshot):\n"
for _, hero in ipairs(spreadshot_heroes) do
local base = math.floor(hero["BulletDamage"] * 100) / 100
local level = math.floor(hero["LevelScaling"]["BulletDamage"] * 100) / 100
local shots = hero["BulletsPerShot"]
local hero_icon = frame:expandTemplate{ title = "HeroIcon", args = {hero["Name"]}}
local stat_str = "* " .. hero_icon .. ": " .. shots .. " pellets, "
.. base .. "/pellet, +" .. level .. "/pellet\n"
multishot_str = multishot_str .. stat_str
end
multishot_str = multishot_str .. "Weapons with burst fire (Burst Fire):\n"
for _, hero in ipairs(burst_heroes) do
local base = math.floor(hero["BulletDamage"] * 100) / 100
local level = math.floor(hero["LevelScaling"]["BulletDamage"] * 100) / 100
local shots = hero["BulletsPerBurst"]
local hero_icon = frame:expandTemplate{ title = "HeroIcon", args = {hero["Name"]}}
local stat_str = "* " .. hero_icon .. ": " .. shots .. " rounds, "
.. base .. "/bullet, +" .. level .. "/bullet\n"
multishot_str = multishot_str .. stat_str
end
return multishot_str
end
end


return p
return p