Aller au contenu

Module:Description/formesSpéciales/Pokémon Sleep

De Poképédia

Ce module est un sous-module du Module:Description, qui permet de gérer l'affichage du nom des formes et costumes de Pokémon spécifiques à Pokémon Sleep.


return function(ndex, name, form, special_form_name, info_indix_beginning, info_indix_end)
	
	local has_form = info_indix_beginning <= info_indix_end
	local name_prefix = ""
	local name_suffix = ""
	local special_form_as_name_suffix = true
	local name_category = name
	local form_between_commas = ""
	
	local switch_sleep = {
		["0025"] = function()	-- Pikachu
				if has_form
				then 
					if form == "Fêtes"
					then special_form_name = " (Fêtes) avec un chapeau rouge"
						special_form_as_name_suffix = false
						info_indix_beginning = info_indix_end + 1
						return true
					end
					
					local form_first_word = mw.text.split(form, " ")[1]
					
					if form_first_word == "Halloween"
					then special_form_name = " (Halloween) avec un chapeau " .. string.gsub(form, "Halloween %((.-)%)", "%1")
						special_form_as_name_suffix = false
						info_indix_beginning = info_indix_end + 1
						return true
					end
				end
		end,
		["0133"] = function()	-- Évoli
				if form == "Fêtes"
				then special_form_name = " (Fêtes) avec un chapeau rouge"
					special_form_as_name_suffix = false
					info_indix_beginning = info_indix_end + 1
					return true
				end
			end,
	}
	
	local has_found_special_form = false
	local f = switch_sleep[ndex]
	if f
	then has_found_special_form = f() -- f() has border effects
		has_found_special_form = has_found_special_form == true
	end
	
	return {
		["form_between_commas"] = form_between_commas,
		["has_found_special_form"] = has_found_special_form,
		["info_indix_beginning"] = info_indix_beginning,
		["info_indix_end"] = info_indix_end,
		["name"] = name,
		["name_category"] = name_category,
		["name_prefix"] = name_prefix,
		["name_suffix"] = name_suffix,
		["special_form_name"] = special_form_name,
		["special_form_as_name_suffix"] = special_form_as_name_suffix
	}
end