Content added Content deleted
No edit summary |
mNo edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
local p = {} |
local p = {} |
||
local |
local skillTypes = { |
||
['Scorer'] = { |
['Scorer'] = { |
||
effect = "%d%% score boost for 5 seconds.", |
effect = "%d%% score boost for 5 seconds.", |
||
Line 37: | Line 37: | ||
['4'] = { { 70, 100, 120 }, { 75, 105, 125 }, { 80, 110, 130 }, { 90, 120, 140 } } |
['4'] = { { 70, 100, 120 }, { 75, 105, 125 }, { 80, 110, 130 }, { 90, 120, 140 } } |
||
}, |
}, |
||
[' |
['Combo scorer'] = { |
||
effect = "%d%% score boost for 5 seconds. If you hit |
effect = "%d%% score boost for 5 seconds. If you hit GOOD or lower, score boost will be reduced to %d%%.", |
||
category = '[[Category: |
category = '[[Category:Combo scorer cards]]', |
||
['4'] = { { 120, 70 }, { 125, 75 }, { 130, 80 }, { 140, 90 } } |
['4'] = { { 120, 70 }, { 125, 75 }, { 130, 80 }, { 140, 90 } } |
||
}, |
}, |
||
Line 53: | Line 53: | ||
['4'] = { { 80, 130 }, { 85, 135 }, { 90, 140 }, { 100, 150 } } |
['4'] = { { 80, 130 }, { 85, 135 }, { 90, 140 }, { 100, 150 } } |
||
}, |
}, |
||
['MORE MORE JUMP! scorer'] = { |
['MORE MORE JUMP! scorer'] = { |
||
effect = "%d%% score boost for 5 seconds. Gain additional +10%% boost for every [MORE MORE JUMP!] card (except for themselves), and another +10%% boost if all cards are from the same unit (up to %d%%).", |
|||
category = '[[Category:MORE MORE JUMP! scorer cards]]', |
|||
['4'] = { { 80, 130 }, { 85, 135 }, { 90, 140 }, { 100, 150 } } |
|||
}, |
|||
['Vivid BAD SQUAD scorer'] = { |
['Vivid BAD SQUAD scorer'] = { |
||
effect = "%d%% score boost for 5 seconds. Gain additional +10%% boost for every [Vivid BAD SQUAD] card (except for themselves), and another +10%% boost if all cards are from the same unit (up to %d%%).", |
effect = "%d%% score boost for 5 seconds. Gain additional +10%% boost for every [Vivid BAD SQUAD] card (except for themselves), and another +10%% boost if all cards are from the same unit (up to %d%%).", |
||
Line 71: | Line 75: | ||
} |
} |
||
local function |
local function getSkillValue(skill, rarity, skillLevel) |
||
if |
if skill and |
||
rarity and |
rarity and |
||
skill[rarity] then |
|||
skill_types[skill_type] and |
|||
skill_types[skill_type][rarity] then |
|||
return string.format( |
return string.format( |
||
skill['effect'], |
|||
unpack( |
unpack(skill[rarity][skillLevel]) |
||
) |
) |
||
end |
end |
||
Line 88: | Line 91: | ||
end |
end |
||
local function |
local function getCategory(skill) |
||
if |
if skill then |
||
return |
return skill['category'] |
||
end |
end |
||
Line 99: | Line 102: | ||
local args = getArgs(frame) |
local args = getArgs(frame) |
||
local |
local skillType = args['skill type'] |
||
local rarity = args['rarity'] or VariablesLua.var( 'rarity' ) |
local rarity = args['rarity'] or VariablesLua.var( 'rarity' ) |
||
local skill = skillTypes[skillType] |
|||
local root = mw.html.create('ul') |
local root = mw.html.create('ul') |
||
Line 110: | Line 115: | ||
"'''Level %d:''' %s", |
"'''Level %d:''' %s", |
||
i, |
i, |
||
getSkillValue(skill, rarity, i) |
|||
)) |
)) |
||
:done() |
:done() |
||
end |
end |
||
local |
local category = '' |
||
if mw.title.getCurrentTitle().namespace == 0 then |
if mw.title.getCurrentTitle().namespace == 0 then |
||
category = getCategory(skill) |
|||
categories = autocategorize(skill_type) |
|||
end |
end |
||
return tostring(root) .. |
return tostring(root) .. category |
||
end |
end |
||
Latest revision as of 22:50, 28 April 2023
This module depends on the following other modules: |
To generate {{Card skill}}, invoke using the main function.
local getArgs = require('Module:Arguments').getArgs
local VariablesLua = mw.ext.VariablesLua
local p = {}
local skillTypes = {
['Scorer'] = {
effect = "%d%% score boost for 5 seconds.",
category = '[[Category:Scorer cards]]',
['1'] = { { 20 }, { 25 }, { 30 }, { 40 } },
['2'] = { { 30 }, { 35 }, { 40 }, { 50 } },
['3'] = { { 60 }, { 65 }, { 70 }, { 80 } },
['4'] = { { 100 }, { 105 }, { 110 }, { 120 } }
},
['Perfect locker'] = {
effect = "All %ss and higher will become PERFECTs for %.1f seconds; %d%% score boost for 5 seconds.",
category = '[[Category:Perfect locker cards]]',
['2'] = { { 'GREAT', 4.5, 10 }, { 'GREAT', 5, 15 }, { 'GREAT', 5.5, 20 }, { 'GREAT', 6, 30 } },
['3'] = { { 'GOOD', 5, 40 }, { 'GOOD', 5.5, 45 }, { 'GOOD', 6, 50 }, { 'GOOD', 6.5, 60 } },
['4'] = { { 'BAD', 5.5, 80 }, { 'BAD', 6, 85 }, { 'BAD', 6.5, 90 }, { 'BAD', 7, 100 } }
},
['Healer'] = {
effect = "Recover %d life; %d%% score boost for 5 seconds.",
category = '[[Category:Healer cards]]',
['2'] = { { 150, 10 }, { 200, 15 }, { 250, 20 }, { 300, 30 } },
['3'] = { { 250, 40 }, { 300, 45 }, { 350, 50 }, { 400, 60 } },
['4'] = { { 350, 80 }, { 400, 85 }, { 450, 90 }, { 500, 100 } }
},
['Perfect scorer'] = {
effect = "%d%% score boost for 5 seconds for PERFECTs only.",
category = '[[Category:Perfect scorer cards]]',
['4'] = { { 110 }, { 115 }, { 120 }, { 130 } }
},
['Life scorer'] = {
effect = "For 5 seconds, %d%% score boost if life is less than 800 or %d%% score boost if life is 800. For every +10 life above 800, score boost increased by +1%% (up to %d%%).",
category = '[[Category:Life scorer cards]]',
['4'] = { { 70, 100, 120 }, { 75, 105, 125 }, { 80, 110, 130 }, { 90, 120, 140 } }
},
['Combo scorer'] = {
effect = "%d%% score boost for 5 seconds. If you hit GOOD or lower, score boost will be reduced to %d%%.",
category = '[[Category:Combo scorer cards]]',
['4'] = { { 120, 70 }, { 125, 75 }, { 130, 80 }, { 140, 90 } }
},
['Birthday scorer'] = {
effect = "Recover %d life; %d%% score boost for 5 seconds for PERFECTs only.",
category = '[[Category:Birthday scorer cards]]',
['birthday'] = { { 700, 60 }, { 750, 65 }, { 800, 70 }, { 850, 80 } },
['Birthday'] = { { 700, 60 }, { 750, 65 }, { 800, 70 }, { 850, 80 } }
},
['Leo/need scorer'] = {
effect = "%d%% score boost for 5 seconds. Gain additional +10%% boost for every [Leo/need] card (except for themselves), and another +10%% boost if all card are from the same unit (up to %d%%).",
category = '[[Category:Leo/need scorer cards]]',
['4'] = { { 80, 130 }, { 85, 135 }, { 90, 140 }, { 100, 150 } }
},
['MORE MORE JUMP! scorer'] = {
effect = "%d%% score boost for 5 seconds. Gain additional +10%% boost for every [MORE MORE JUMP!] card (except for themselves), and another +10%% boost if all cards are from the same unit (up to %d%%).",
category = '[[Category:MORE MORE JUMP! scorer cards]]',
['4'] = { { 80, 130 }, { 85, 135 }, { 90, 140 }, { 100, 150 } }
},
['Vivid BAD SQUAD scorer'] = {
effect = "%d%% score boost for 5 seconds. Gain additional +10%% boost for every [Vivid BAD SQUAD] card (except for themselves), and another +10%% boost if all cards are from the same unit (up to %d%%).",
category = '[[Category:Vivid BAD SQUAD scorer cards]]',
['4'] = { { 80, 130 }, { 85, 135 }, { 90, 140 }, { 100, 150 } }
},
['Wonderlands×Showtime scorer'] = {
effect = "%d%% score boost for 5 seconds. Gain additional +10%% boost for every [Wonderlands×Showtime] card (except for themselves), and another +10%% boost if all members are from the same unit (up to %d%%).",
category = '[[Category:Wonderlands×Showtime scorer cards]]',
['4'] = { { 80, 130 }, { 85, 135 }, { 90, 140 }, { 100, 150 } }
},
['25-ji, Nightcord de. scorer'] = {
effect = "%d%% score boost for 5 seconds. Gain additional +10%% boost for every [25-ji, Nightcord de.] card (except for themselves), and another +10%% boost if all cards are from the same unit (up to %d%%).",
category = '[[Category:25-ji, Nightcord de. scorer cards]]',
['4'] = { { 80, 130 }, { 85, 135 }, { 90, 140 }, { 100, 150 } }
},
}
local function getSkillValue(skill, rarity, skillLevel)
if skill and
rarity and
skill[rarity] then
return string.format(
skill['effect'],
unpack(skill[rarity][skillLevel])
)
end
return string.format("<span class=\"plainlinks\">[%s?action=edit ? (edit)]</span>",
tostring(mw.uri.fullUrl(mw.title.getCurrentTitle().text))
)
end
local function getCategory(skill)
if skill then
return skill['category']
end
return ''
end
function p.main(frame)
local args = getArgs(frame)
local skillType = args['skill type']
local rarity = args['rarity'] or VariablesLua.var( 'rarity' )
local skill = skillTypes[skillType]
local root = mw.html.create('ul')
for i=1,4,1 do
root:tag('li')
:wikitext(string.format(
"'''Level %d:''' %s",
i,
getSkillValue(skill, rarity, i)
))
:done()
end
local category = ''
if mw.title.getCurrentTitle().namespace == 0 then
category = getCategory(skill)
end
return tostring(root) .. category
end
return p