Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Card skill: Difference between revisions

From Sekaipedia
mNo edit summary
m (ChaoticShadow moved page Module:Card Skill to Module:Card skill without leaving a redirect)
(No difference)

Revision as of 04:16, 15 November 2021

To generate {{Card skill}}, invoke using the main function.


local getArgs   = require('Module:Arguments').getArgs

local p = {}

local skill_types = {
	['scorer']  = {
		effect = "%d%% score boost for 5 seconds.",
		['1'] = { { 20 }, { 25 }, { 30 }, { 40 } },
		['2'] = { { 30 }, { 35 }, { 40 }, { 50 } },
		['3'] = { { 60 }, { 65 }, { 70 }, { 80 } },
		['4'] = { { 100 }, { 105 }, { 110 }, { 120 } }
	},
	['plocker'] = {
		effect = "All %ss and higher will become PERFECTs for %.1f seconds; %d%% score boost for 5 seconds.",
		['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.",
		['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 } }
	},
	['pscorer'] = {
		effect = "%d%% score boost for 5 seconds for PERFECTs only.",
		['4'] = { { 110 }, { 115 }, { 120 }, { 130 } }
	},
	['fes 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%%).",
		['4'] = { { 70, 100, 120 }, { 75, 105, 125 }, { 80, 110, 130 }, { 90, 120, 140 } }
	},
	['fes pscorer'] = {
		effect = "%d%% score boost for 5 seconds. If you hit GREAT or lower, score boost will be reduced to %d%%.",
		['4'] = { { 120, 70 }, { 125, 75 }, { 130, 80 }, { 140, 90 } }
	},
	['birthday'] = {
		effect = "Recover %d life; %d%% score boost for 5 seconds for PERFECTs only.",
		['birthday'] = { { 700, 60 }, { 750, 65 }, { 800, 70 }, { 850, 80 } }
	}
}
	
local function skill_value(skill_type, rarity, skill_level)
	if skill_type and 
		rarity and 
		skill_types[skill_type] and
		skill_types[skill_type][rarity] then
		
		return string.format(
			skill_types[skill_type]['effect'],
			unpack(skill_types[skill_type][rarity][skill_level])
		)
	end

	return string.format("<span class=\"plainlinks\">[%s?action=edit ? (edit)]</span>",
		tostring(mw.uri.fullUrl(mw.title.getCurrentTitle().text))
	)
end

function p.main(frame)
	local args = getArgs(frame)
	
	local skill_type = args['skill type']
	local rarity = args['rarity']
	
	local root = mw.html.create('ul')
	
	for i=1,4,1 do
		root:tag('li')
			:wikitext(string.format(
				"'''Level %d:''' %s",
				i,
				skill_value(skill_type, rarity, i)
			))
			:done()
	end
		
	return tostring(root)
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.