Please note that some information on this wiki is still based on the demo version.
If you notice any errors, feel free to correct them.
Module:MonsterOnDay: Difference between revisions
From Super Fantasy Kingdom Official Wiki
wgg>Cadaei args handling |
m 7 revisions imported |
||
| (5 intermediate revisions by one other user not shown) | |||
| Line 11: | Line 11: | ||
function p.calculate(f) | function p.calculate(f) | ||
local args = f:getParent().args | local args = f:getParent().args | ||
local rank = tonumber(args[ | if (args[1] or '') == '' then return '' end | ||
local rank = tonumber(args[1]) | |||
if rank == nil then | if rank == nil then | ||
return (args[ | return '<code>'..(args[1] or 'nil') .. '</code> is not a valid number for a appearance rank' | ||
end | end | ||
| Line 20: | Line 21: | ||
local dayRows = {} | local dayRows = {} | ||
for curse | for _,curse in ipairs(displayDaysForCurse) do | ||
local dayForCurse = rank - curse | local dayForCurse = rank - curse | ||
-- bosses appear on day 7 and 14, the monster day then is one day later | -- bosses appear on day 7 and 14, the monster day then is one day later | ||
| Line 27: | Line 28: | ||
if dayForCurse < 1 then dayForCurse = '-' end | if dayForCurse < 1 then dayForCurse = '-' end | ||
table.insert(dayRows, '<tr><td>[[File:Curse.png|16x16px|link=Curse]] [[Curse|C'..curse..']]</td><td>'..dayForCurse..'</td></tr>') | table.insert(dayRows, '<tr><td>[[File:Curse.png|16x16px|link=Curse]] [[Curse|C'..curse..']]: </td><td class="right">'..dayForCurse..'</td></tr>') | ||
end | end | ||
return '<table class= | return '<table class="plain-table">'..table.concat(dayRows, '')..'</table>' | ||
end | end | ||
return p | return p | ||
Latest revision as of 23:46, 21 October 2025
Calculates on which days a monster appears first when the monster appearing rank is given (the day on the first appearance on curse 0 ignoring offsets by bosses) depending on on the curse level and the fixed boss days.
- When a monster on curse 0 appears first on day 1 the rank is 1
- When a monster on curse 0 appears first on day 8 the rank is 7 because the boss on day 7 is fixed without rank
{{MonsterOnDay|9}}
| 10 | |
| 9 | |
| 8 | |
| 6 | |
| 5 | |
| 4 |
-- calculates on which days a monster appears first
-- when the monster appearing rank is given (the day on the first appearance on curse 0 ignoring offsets by bosses)
-- depending on
-- on the curse level and
-- the fixed boss days
-- e.g. when a monster on curse 0 appears first on day 1 the rank is 1
-- e.g. when a monster on curse 0 appears first on day 8 the rank is 7 because the boss on day 7 is fixed without rank
local p = {}
function p.calculate(f)
local args = f:getParent().args
if (args[1] or '') == '' then return '' end
local rank = tonumber(args[1])
if rank == nil then
return '<code>'..(args[1] or 'nil') .. '</code> is not a valid number for a appearance rank'
end
local displayDaysForCurse = {0, 1, 2, 3, 4, 5}
local dayRows = {}
for _,curse in ipairs(displayDaysForCurse) do
local dayForCurse = rank - curse
-- bosses appear on day 7 and 14, the monster day then is one day later
if dayForCurse >= 7 then dayForCurse = dayForCurse + 1 end
if dayForCurse >= 14 then dayForCurse = dayForCurse + 1 end
if dayForCurse < 1 then dayForCurse = '-' end
table.insert(dayRows, '<tr><td>[[File:Curse.png|16x16px|link=Curse]] [[Curse|C'..curse..']]: </td><td class="right">'..dayForCurse..'</td></tr>')
end
return '<table class="plain-table">'..table.concat(dayRows, '')..'</table>'
end
return p


