Site News |
---|
Warning: This wiki contains spoilers. Read at your own risk! Social media: If you would like, please join our Discord server, and/or follow us on Twitter or Tumblr! Engage info: As the game has only recently released, we lack much key information. Please help add any info that you can. |
Module:Scaling3DS02
From Fire Emblem Wiki, your source on Fire Emblem information. By fans, for fans.
The module that creates the cells and information for {{Scaling3DS02}}. The levels that enemies gain from the previous chapter are set, and the total levels gained are generated based on which of those is used.
local p = {}
function p.scaling(frame)
--Naming input for convinience
local in_args = frame:getParent().args
-- universal scaling pattern from previous chapter; Ch 7–27
local levels = {0, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}
-- Before Awakening and Vanguard Dawn scale differently at Chapter 12
if in_args["bavd"] ~= nil then
levels[6] = 2
end
-- Chapter the paralogue is first available for; chapter the paralogue starts scaling
local available = 7
if in_args["chap1st"] ~= nil then -- sets "available" to the "chap1st" field if it exists
available = tonumber(in_args["chap1st"])
end
local scales = math.max(12, available + 1) --[[ defaults scales to the greater of 12 or available+1
done as Ch 12 is the most common scaling start and as most paralogues first available after
Ch 12 begin scaling one chapter later]]
if in_args["scale1st"] ~= nil then -- sets "scaling" to the "scale1st" field if it exists
scales = tonumber(in_args["scale1st"])
end
--[[ Begins constructing output
"chapters" is the top row of the final table, "gains" the middle, and "totals" the bottom]]
local chapters = "! class=\"roundtl\" style=\"width: 100px\" | Chapter"
local gains = "! Levels from previous chapter"
local totals = "! class=\"roundbl\" | Total levels gained"
-- Loop for all chapters the paralogue is playable but does not scale
for i = available - 6, scales - 7 do
chapters = chapters .. "\n! style=\"width: 35px\" | " .. (i+6)
gains = gains .. "\n| 0"
totals = totals .. "\n| 0"
end
-- Loop for all chapters but the last where the paralogue scales
local sum = 0
for i = scales - 6, #levels - 1 do
chapters = chapters .. "\n! style=\"width: 35px\" | " .. (i+6)
gains = gains .. "\n| +" .. levels[i]
sum = sum + levels[i]
totals = totals .. "\n| +" .. sum
end
-- Loop for the last chapter, which is always Chapter 27
chapters = chapters .. "\n! class=\"roundtr\" style=\"width: 35px\" | " .. 27
gains = gains .. "\n| +" .. levels[21]
sum = sum + levels[21]
totals = totals .. "\n| class=\"roundbr\" | +" .. sum
-- Output
return chapters .. "\n|-\n" .. gains .. "\n|-\n" .. totals
end
return p