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 Carapuce | 0008 Carabaffe | 0009 Tortank | 0019 Rattata | |
0020 Rattatac | 0030 Nidorina | 0031 Nidoqueen | 0033 Nidorino | |
0034 Nidoking | 0035 Mélofée | 0036 Mélodelfe | 0039 Rondoudou | |
0040 Grodoudou | 0052 Miaouss | 0053 Persian | 0054 Psykokwak | |
0055 Akwakwak | 0060 Ptitard | 0061 Têtarte | 0062 Tartard | |
0072 Tentacool | 0073 Tentacruel | 0079 Ramoloss | 0080 Flagadoss | |
0086 Otaria | 0087 Lamantine | 0090 Kokiyas | 0091 Crustabri | |
0098 Krabby | 0099 Krabboss | 0104 Osselait | 0105 Ossatueur | |
0108 Excelangue | 0112 Rhinoféros | 0113 Leveinard | 0115 Kangourex | |
0116 Hypotrempe | 0117 Hypocéan | 0118 Poissirène | 0119 Poissoroy | |
0120 Stari | 0121 Staross | 0124 Lippoutou | 0130 Léviator | |
0131 Lokhlass | 0134 Aquali | 0138 Amonita | 0139 Amonistar | |
0140 Kabuto | 0141 Kabutops | 0143 Ronflex | 0144 Artikodin | |
0147 Minidraco | 0148 Draco | 0149 Dracolosse | 0150 Mewtwo | |
0151 Mew |
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 Zarbi |
{{#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 Zarbi | 0202 Qulbutoké | 0623 GolemastocN2B2 | ||
Les Pokémon ci-dessous peuvent utiliser la capsule, bien qu'ils soient asexués | ||||
0082 Magnéton |
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 Tentacool | N.25 | 0073 Tentacruel | N.25 | 0120 Stari | N.31 |
0121 Staross | Départ | 0183 Marill | N.21 | 0184 Azumarill | N.25 |
0222 Corayon | N.25 | 0223 Rémoraid | N.22 | 0224 Octillery | N.22 |
0226 Démanta | N.18 | 0245 Suicune | 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 Ptitard | |
0090 Kokiyas 0120 Stari 0118 Poissirène | |
0138 Amonita | |
0140 Kabuto | |
0211 Qwilfish |
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 Crustabri | 0090 Kokiyas | Reproduction |
0121 Staross | 0120 Stari | Montée en niveau |
0139 Amonistar | 0138 Amonita | Reproduction |
0141 Kabutops | 0140 Kabuto | Reproduction |
0272 Ludicolo | 0271 Lombre | Montée en niveau |
0284 Maskadra | 0283 Arakdo | 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 Sepiatop | Pokémon Center de Tokyo-Bay (2014) | 0129 Magicarpe | Pokémon Center de Hiroshima-Bay (2015) | 0025 Pikachu | Pokémon Smile Park (2015) |
0052 Miaouss | 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 Goupix | Bosquet | 0077 Ponyta | Bosquet | 0240 Magby | Mont Escarpé |
0322 Chamallot | Mont Escarpé | 0561 Cryptéro | Vaste Ciel | 0631 Aflamanoir | 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>' .. 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] = "-" 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>' .. pokemon[i][3] .. '</td></tr>') end i = i + 1 end table.insert(resultat, '</table>') return table.concat(resultat, '') end return p