Module:Capacité
Le module Capacité rassemble différentes fonctions permettant de créer des tableaux d'apprentissage destinés aux articles sur les capacités.
Fonction « liste »[modifier]
Cette fonction est à utiliser à la fois pour l'apprentissage par capsule (sauf dans le cas particulier où tous les Pokémon peuvent apprendre la capsule) et par donneur de capacités.
Paramètres[modifier]
- Uniquement la liste des noms des Pokémon pouvant apprendre la capacité, séparés par des slashs (/).
Exemples[modifier]
{{#invoke:Capacité|liste| Carapuce / Carabaffe / Tortank / Rattata / Rattatac / Nidorina / Nidoqueen / Nidorino / Nidoking / Mélofée / Mélodelfe / Rondoudou / Grodoudou / Miaouss / Persian / Psykokwak / Akwakwak / Ptitard / Têtarte / Tartard / Tentacool / Tentacruel / Ramoloss / Flagadoss / Otaria / Lamantine / Kokiyas / Crustabri / Krabby / Krabboss / Osselait / Ossatueur / Excelangue / Rhinoféros / Leveinard / Kangourex / Hypotrempe / Hypocéan / Poissirène / Poissoroy / Stari / Staross / Lippoutou / Léviator / Lokhlass / Aquali / Amonita / Amonistar / Kabuto / Kabutops / Ronflex / Artikodin / Minidraco / Draco / Dracolosse / Mewtwo / Mew }}
donne :
Pokémon | ||||
---|---|---|---|---|
0007 ![]() | 0008 ![]() | 0009 ![]() | 0019 ![]() | |
0020 ![]() | 0030 ![]() | 0031 ![]() | 0033 ![]() | |
0034 ![]() | 0035 ![]() | 0036 ![]() | 0039 ![]() | |
0040 ![]() | 0052 ![]() | 0053 ![]() | 0054 ![]() | |
0055 ![]() | 0060 ![]() | 0061 ![]() | 0062 ![]() | |
0072 ![]() | 0073 ![]() | 0079 ![]() | 0080 ![]() | |
0086 ![]() | 0087 ![]() | 0090 ![]() | 0091 ![]() | |
0098 ![]() | 0099 ![]() | 0104 ![]() | 0105 ![]() | |
0108 ![]() | 0112 ![]() | 0113 ![]() | 0115 ![]() | |
0116 ![]() | 0117 ![]() | 0118 ![]() | 0119 ![]() | |
0120 ![]() | 0121 ![]() | 0124 ![]() | 0130 ![]() | |
0131 ![]() | 0134 ![]() | 0138 ![]() | 0139 ![]() | |
0140 ![]() | 0141 ![]() | 0143 ![]() | 0144 ![]() | |
0147 ![]() | 0148 ![]() | 0149 ![]() | 0150 ![]() | |
0151 ![]() |
Fonction « tous »[modifier]
Cette fonction est à utiliser dans le cas particulier où tous les Pokémon, potentiellement à quelques exceptions près, peuvent apprendre une capsule. Cette fonction permet alors de faire apparaître un tableau où figure notamment une phrase expliquant la situation.
Paramètres[modifier]
- le premier paramètre, sans nom, n'a pas à être renseigné dans la plupart des cas. Il sert uniquement lorsqu'une capsule ne peut être apprise que par les Pokémon sexués, en le remplissant assez logiquement avec « sexués ».
- exceptions permet quant à lui de lister les quelques Pokémon qui ne sont pas aptes à apprendre la capsule, s'il y en a, les noms étant séparés par des slashs (/).
- Enfin, le paramètre inclus sert uniquement lorsque « sexués » est renseigné. Il sert à lister les quelques Pokémon asexués qui sont tout de même aptes à utiliser la capsule.
Exemples[modifier]
{{#invoke:Capacité|tous|exceptions=Zarbi}}
donne :
Pokémon | ||||
---|---|---|---|---|
Tout Pokémon pouvant apprendre une capacité par capsule peut apprendre cette capacité sauf pour les cas particuliers notés ci-dessous. | ||||
Les Pokémon ci-dessous sont inaptes à utiliser la capsule | ||||
0201 ![]() |
{{#invoke:Capacité|tous|sexués|exceptions=Zarbi / Qulbutoké / Golemastoc sup(N2B2)|inclus=Magnéton}}
donne :
Pokémon | ||||
---|---|---|---|---|
Tout Pokémon sexué pouvant apprendre une capacité par capsule peut apprendre cette capacité sauf pour les cas particuliers notés ci-dessous. | ||||
Les Pokémon ci-dessous sont inaptes à utiliser la capsule | ||||
0201 ![]() | 0202 ![]() | 0623 ![]() | ||
Les Pokémon ci-dessous peuvent utiliser la capsule, bien qu'ils soient asexués | ||||
0082 ![]() |
Fonction « niveau »[modifier]
Paramètres[modifier]
- Uniquement la liste des Pokémon pouvant apprendre la capacité et les niveaux correspondant. Dans le code, à chaque ligne est associée un unique Pokémon dont le nom est la première information qui doit être présente. Ensuite, le niveau d'apprentissage doit être précisé puis, si nécessaire, préciser dans quel jeu, puis un autre niveau, un autre jeu, et ainsi de suite. Dans une même ligne, les informations sont séparées par des slashs (/).
Exemples[modifier]
{{#invoke:Capacité|niveau| Tentacool / 25 Tentacruel / 25 Stari / 31 Staross / Départ Marill / 21 Azumarill / 25 Corayon / 25 Rémoraid / 22 Octillery / 22 Démanta / 18 Suicune / 41 / OA / 11 / C }}
donne :
Pokémon | |||||
---|---|---|---|---|---|
0072 ![]() | N.25 | 0073 ![]() | N.25 | 0120 ![]() | N.31 |
0121 ![]() | Départ | 0183 ![]() | N.21 | 0184 ![]() | N.25 |
0222 ![]() | N.25 | 0223 ![]() | N.22 | 0224 ![]() | N.22 |
0226 ![]() | N.18 | 0245 ![]() | N.41OA N.11C |
Fonction « reproduction »[modifier]
Paramètres[modifier]
- Uniquement la liste des Pokémon enfants, pouvant apprendre la capacité, et parents, pouvant la transmettre. L'organisation du code est la même que celle du tableau rendu en résultat : à chaque ligne de code correspond une ligne du tableau. Dans cette ligne de code doit se trouver un seul et unique slash (/). Avant ce slash, la liste des noms des Pokémon enfants, séparés par des virgules. Après ce slash, la liste des noms des Pokémon parents, séparés par des virgules également.
Exemples[modifier]
{{#invoke:Capacité|reproduction| Ptitard / Amonita, Amonistar, Kabuto, Kabutops Kokiyas, Stari, Poissirène / Tentacool, Tentacruel Amonita / Ptitard, Têtarte, Tartard Kabuto / Kokiyas, Crustabri Qwilfish / Rémoraid, Octillery }}
donne :
Pokémon | Parent(s) possible(s) |
---|---|
0060 ![]() | ![]() ![]() ![]() ![]() |
0090 ![]() 0120 ![]() 0118 ![]() | ![]() ![]() |
0138 ![]() | ![]() ![]() ![]() |
0140 ![]() | ![]() ![]() |
0211 ![]() | ![]() ![]() |
Fonction « preevolution »[modifier]
Paramètres[modifier]
- Uniquement la liste des informations composant le tableau. Le code est organisé par ligne, chaque ligne de code correspondant à une ligne du tableau résultant. Sur une même ligne se trouve trois informations séparées par des slashs (/) : tout d'abord, le nom de Pokémon pouvant apprendre la capacité, puis le nom de sa pré-évolution grâce à laquelle il peut l'apprendre, et enfin la méthode par laquelle la pré-évolution peut l'apprendre.
Exemples[modifier]
{{#invoke:Capacité|preevolution| Crustabri / Kokiyas / [[Reproduction]] Staross / Stari / Montée en [[niveau]] Amonistar / Amonita / [[Reproduction]] Kabutops / Kabuto / [[Reproduction]] Ludicolo / Lombre / Montée en [[niveau]] Maskadra / Arakdo / Montée en [[niveau]] }}
donne :
Pokémon | Pré-évolution | Méthode d'apprentissage |
---|---|---|
0091 ![]() | 0090 ![]() | Reproduction |
0121 ![]() | 0120 ![]() | Montée en niveau |
0139 ![]() | 0138 ![]() | Reproduction |
0141 ![]() | 0140 ![]() | Reproduction |
0272 ![]() | 0271 ![]() | Montée en niveau |
0284 ![]() | 0283 ![]() | Montée en niveau |
Autres cas : événement, Pokémon Dream World, Pokéwalker…[modifier]
Les autres méthodes d'apprentissage, plus rares, n'ont pas de fonction propre pour la raison que la fonction « niveau » permet normalement de répondre à ces cas-ci. Ainsi, si la fonction « niveau » tient son nom de son utilisation principale, elle est aussi utilisée pour ces cas-ci.
Deux exemples, le premier pour des événements, le deuxième pour le Pokémon Dream World :
{{#invoke:Capacité|niveau| Sepiatop / [[Liste des Pokémon distribués en 2014#Sepiatop|Pokémon Center de Tokyo-Bay]] (2014) Magicarpe / [[Liste des Pokémon distribués en 2015#Magicarpe|Pokémon Center de Hiroshima-Bay]] (2015) Pikachu / [[Pokémon with You#Pikachu Smile Park|Pokémon Smile Park]] (2015) Miaouss / [[Liste des Pokémon distribués en 2016#Miaouss HAPPY|Miaouss HAPPY]] (2016) }}
donne :
Pokémon | |||||
---|---|---|---|---|---|
0686 ![]() | Pokémon Center de Tokyo-Bay (2014) | 0129 ![]() | Pokémon Center de Hiroshima-Bay (2015) | 0025 ![]() | Pokémon Smile Park (2015) |
0052 ![]() | Miaouss HAPPY (2016) |
{{#invoke:Capacité|niveau| Goupix / [[Bosquet]] Ponyta / [[Bosquet]] Magby / [[Mont Escarpé]] Chamallot / [[Mont Escarpé]] Cryptéro / [[Vaste Ciel]] Aflamanoir / [[Mont Escarpé]] }}
donne :
Pokémon | |||||
---|---|---|---|---|---|
0037 ![]() | Bosquet | 0077 ![]() | Bosquet | 0240 ![]() | Mont Escarpé |
0322 ![]() | Mont Escarpé | 0561 ![]() | Vaste Ciel | 0631 ![]() | Mont Escarpé |
local p = {}
local ressources = {
["infosPokemon"] = require("Module:Ressources/infosPokemon")
}
function p.liste ( frame )
local pokemon = frame.args[1]
if pokemon ~= nil then pokemon = mw.text.split( pokemon, "/" ) else pokemon = {} end
local type = mw.smw.ask('[[' .. frame:getParent():getTitle() .. ']]|?Type')
if type ~= nil then
type = type[1]['Type']
if type ~= nil then type = mw.ustring.lower( string.gsub( type, "É", "é" ) ) else type = '' end
else type = '' end
local resultat = {}
table.insert(resultat, '<table class="tableaustandard ' .. type .. ' capacité-liste"><tr><th colspan="5">Pokémon</th></tr><tr>')
local i = 1
local j = 1
while pokemon[i] do
if mw.text.trim( pokemon[i] ) ~= "" then
table.insert(resultat, '<td>' .. ressources.infosPokemon( pokemon[i] ) .. '</td>')
if j == 4 then
j = 1
table.insert(resultat, '</tr><tr>')
else j = j + 1
end
end
i = i + 1
end
table.insert(resultat, '</tr></table>')
return table.concat(resultat, '')
end
function p.tous( frame )
local type = mw.smw.ask('[[' .. frame:getParent():getTitle() .. ']]|?Type')
if type ~= nil then
type = type[1]['Type']
if type ~= nil then type = mw.ustring.lower( string.gsub( type, "É", "é" ) ) else type = '' end
else type = '' end
local resultat = {}
table.insert(resultat, '<table class="tableaustandard ' .. type .. '"><tr><th colspan="5">Pokémon</th></tr><tr><td colspan="5">Tout Pokémon')
if frame.args[1] == "sexués" then table.insert(resultat, ' sexué') end
table.insert(resultat, ' pouvant apprendre une capacité par capsule peut apprendre cette capacité')
if frame.args['exceptions'] or frame.args['inclus'] then table.insert(resultat, ' sauf pour les cas particuliers notés ci-dessous') end
table.insert(resultat, '.</td></tr>')
if frame.args['exceptions'] then
exceptions = mw.text.split(frame.args['exceptions'], "/")
table.insert(resultat, '<tr><th colspan="5">Les Pokémon ci-dessous sont inaptes à utiliser la capsule</th></tr>')
local i = 1
local j = 1
while exceptions[i] do
if mw.text.trim( exceptions[i] ) ~= "" then
table.insert(resultat, '<td>' .. ressources.infosPokemon( exceptions[i] ) .. '</td>')
if j == 4 then
j = 1
table.insert(resultat, '</tr><tr>')
else j = j + 1
end
end
i = i + 1
end
end
if frame.args['inclus'] then
inclus = mw.text.split(frame.args['inclus'], "/")
table.insert(resultat, '<tr><th colspan="5">Les Pokémon ci-dessous peuvent utiliser la capsule, bien qu\'ils soient asexués</th></tr>')
local i = 1
local j = 1
while inclus[i] do
if mw.text.trim( inclus[i] ) ~= "" then
table.insert(resultat, '<td>' .. ressources.infosPokemon( inclus[i] ) .. '</td>')
if j == 4 then
j = 1
table.insert(resultat, '</tr><tr>')
else j = j + 1
end
end
i = i + 1
end
end
table.insert(resultat, '</table>')
return table.concat(resultat, '')
end
function p.niveau ( frame )
local pokemon = frame.args[1]
if pokemon ~= nil then pokemon = mw.text.split( pokemon, "\n" ) else pokemon = {} end
local type = mw.smw.ask('[[' .. frame:getParent():getTitle() .. ']]|?Type')
if type ~= nil then
type = type[1]['Type']
if type ~= nil then type = mw.ustring.lower( string.gsub( type, "É", "é" ) ) else type = '' end
else type = '' end
local resultat = {}
table.insert(resultat, '<table class="tableaustandard ' .. type .. ' capacité-niveau"><tr><th colspan="6">Pokémon</th></tr><tr>')
local i = 1
local j = 1
local y = 1
local poke = {}
local infos = ""
while pokemon[i] do
poke = mw.text.split( pokemon[i], "/" )
if poke[1] and poke[2] then
y = 3
infos = ""
while poke[y] do
poke[y] = mw.text.trim( poke[y] )
if y % 2 == 0 then
local maitrise = false
if mw.ustring.find(poke[y], "M") == 1
then maitrise = true
poke[y] = mw.ustring.sub(poke[y], 2)
end
if tonumber(poke[y]) ~= nil then poke[y] = "N." .. poke[y] end
infos = infos .. "<br />"
if maitrise then infos = infos .. "[[Fichier:Icône Maîtrise LPA.png|x20px|Maîtrise|link=Maîtrise]]" end
infos = infos .. poke[y]
else infos = infos .. frame:expandTemplate{ title = 'Sup', args = { poke[y] } }
end
y = y + 1
end
local prefix_poke2 = ""
if mw.ustring.find(poke[2], "M") == 1
then prefix_poke2 = "[[Fichier:Icône Maîtrise LPA.png|x20px|Maîtrise|link=Maîtrise]]"
poke[y] = mw.ustring.sub(poke[2], 2)
end
if tonumber(poke[2]) ~= nil then poke[2] = "N." .. mw.text.trim( poke[2] ) else poke[2] = mw.text.trim( poke[2] ) end
table.insert(resultat, '<td>' .. ressources.infosPokemon( poke[1] ) .. '</td><td style="white-space:nowrap">' .. prefix_poke2 .. poke[2] .. infos .. '</td>')
if j == 3 then
j = 1
table.insert(resultat, '</tr><tr>')
else j = j + 1
end
end
i = i + 1
end
table.insert(resultat, '</tr></table>')
return table.concat(resultat, "")
end
function p.reproduction ( frame )
local pokemon = frame.args[1]
if pokemon ~= nil then pokemon = mw.text.split( pokemon, "\n" ) else pokemon = {} end
local type = mw.smw.ask('[[' .. frame:getParent():getTitle() .. ']]|?Type')
if type ~= nil then
type = type[1]['Type']
if type ~= nil then type = mw.ustring.lower( string.gsub( type, "É", "é" ) ) else type = '' end
else type = '' end
local resultat = {}
table.insert(resultat, '<table class="tableaustandard centre ' .. type .. '" style="max-width: 100%;"><tr><th>Pokémon</th><th>Parent(s) possible(s)</th></tr><tr>')
local i = 1
local j = 1
local y = 2
local poke = {}
local parents = {}
local enfants = {}
local miniaturesParents = ""
local miniaturesEnfants = ""
while pokemon[i] do
poke = mw.text.split( pokemon[i], "/" )
if poke[2] and mw.text.trim( poke[1] ) ~= "" and mw.text.trim( poke[2] ) ~= "" then
j = 1
parents = mw.text.split( poke[2], "," )
miniaturesParents = ""
while parents[j] do
miniaturesParents = miniaturesParents .. ressources.infosPokemon( parents[j], "miniature" )
j = j + 1
end
y = 2
enfants = mw.text.split( poke[1], "," )
miniaturesEnfants = ressources.infosPokemon( enfants[1] )
while enfants[y] do
miniaturesEnfants = miniaturesEnfants .. '<br />' .. ressources.infosPokemon( enfants[y] )
y = y + 1
end
table.insert(resultat, '<tr><td style="text-align: left;">' .. miniaturesEnfants .. '</td><td>' .. miniaturesParents .. '</td></tr>')
end
i = i + 1
end
table.insert(resultat, '</tr></table>')
return table.concat(resultat, '')
end
function p.preevolution ( frame )
local pokemon = frame.args[1]
if pokemon ~= nil then pokemon = mw.text.split( pokemon, "\n" ) else pokemon = {} end
local type = mw.smw.ask('[[' .. frame:getParent():getTitle() .. ']]|?Type')
if type ~= nil then
type = type[1]['Type']
if type ~= nil then type = mw.ustring.lower( string.gsub( type, "É", "é" ) ) else type = '' end
else type = '' end
local resultat = {}
table.insert(resultat, '<table class="tableaustandard centre ' .. type .. '"><tr><th>Pokémon</th><th>Pré-évolution</th><th>Méthode d\'apprentissage</th></tr>')
local i = 1
while pokemon[i] do
pokemon[i] = mw.text.split( pokemon[i], "/" )
if pokemon[i][2] and mw.text.trim( pokemon[i][1] ) ~= "" and mw.text.trim( pokemon[i][2] ) ~= "" then
if not pokemon[i][3]
then pokemon[i][3] = "—"
else local j = 4
while pokemon[i][j] do -- il y a des / dans les balises du modèle Sup
pokemon[i][3] = pokemon[i][3] .. "/" .. pokemon[i][j]
j = j + 1
end
end
table.insert(resultat, '<tr><td style="text-align: left;">' .. ressources.infosPokemon( pokemon[i][1] ) .. '</td><td style="text-align: left;">' .. ressources.infosPokemon( pokemon[i][2] ) .. '</td><td style="white-space:nowrap">' .. frame:preprocess(pokemon[i][3]) .. '</td></tr>')
end
i = i + 1
end
table.insert(resultat, '</table>')
return table.concat(resultat, '')
end
return p