mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 14:19:56 +02:00
Future-proof pokedex-moveset for Sword/Shield
This commit is contained in:
@@ -86,6 +86,7 @@
|
|||||||
"level": 1
|
"level": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"moveSetVersion": "red-blue",
|
||||||
"chain": [0],
|
"chain": [0],
|
||||||
"missingno": true,
|
"missingno": true,
|
||||||
"sprite": "https://cdn.bulbagarden.net/upload/9/98/Missingno_RB.png",
|
"sprite": "https://cdn.bulbagarden.net/upload/9/98/Missingno_RB.png",
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ const Command = require('../../structures/Command');
|
|||||||
const { MessageEmbed } = require('discord.js');
|
const { MessageEmbed } = require('discord.js');
|
||||||
const versions = {
|
const versions = {
|
||||||
'red-blue': 'Red and Blue',
|
'red-blue': 'Red and Blue',
|
||||||
'ultra-sun-ultra-moon': 'Ultra Sun and Ultra Moon'
|
'ultra-sun-ultra-moon': 'Ultra Sun and Ultra Moon',
|
||||||
|
'sword-shield': 'Sword and Shield'
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = class PokedexMovesetCommand extends Command {
|
module.exports = class PokedexMovesetCommand extends Command {
|
||||||
@@ -56,6 +57,7 @@ module.exports = class PokedexMovesetCommand extends Command {
|
|||||||
const data = await this.client.pokemon.fetch(pokemon);
|
const data = await this.client.pokemon.fetch(pokemon);
|
||||||
if (!data) return msg.say('Could not find any results.');
|
if (!data) return msg.say('Could not find any results.');
|
||||||
if (!data.gameDataCached) await data.fetchGameData();
|
if (!data.gameDataCached) await data.fetchGameData();
|
||||||
|
if (!data.moveSet.length) return msg.say('This Pokémon\'s moves are not yet documented.');
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(0xED1C24)
|
.setColor(0xED1C24)
|
||||||
.setAuthor(`#${data.displayID} - ${data.name}`, data.boxImageURL, data.serebiiURL)
|
.setAuthor(`#${data.displayID} - ${data.name}`, data.boxImageURL, data.serebiiURL)
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "123.4.0",
|
"version": "123.4.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ module.exports = class Pokemon {
|
|||||||
this.height = data.missingno ? data.height : null;
|
this.height = data.missingno ? data.height : null;
|
||||||
this.weight = data.missingno ? data.weight : null;
|
this.weight = data.missingno ? data.weight : null;
|
||||||
this.moveSet = data.missingno ? data.moveSet : [];
|
this.moveSet = data.missingno ? data.moveSet : [];
|
||||||
this.moveSetVersion = data.missingno ? 'red-blue' : 'ultra-sun-ultra-moon';
|
this.moveSetVersion = data.missingno ? data.moveSetVersion : null;
|
||||||
this.gameDataCached = data.missingno || false;
|
this.gameDataCached = data.missingno || false;
|
||||||
this.missingno = data.missingno || false;
|
this.missingno = data.missingno || false;
|
||||||
this.cry = data.id > store.pokemonCountWithCry
|
this.cry = data.id > store.pokemonCountWithCry
|
||||||
@@ -111,6 +111,9 @@ module.exports = class Pokemon {
|
|||||||
sDef: defaultBody.stats.find(stat => stat.stat.name === 'special-defense').base_stat,
|
sDef: defaultBody.stats.find(stat => stat.stat.name === 'special-defense').base_stat,
|
||||||
spd: defaultBody.stats.find(stat => stat.stat.name === 'speed').base_stat
|
spd: defaultBody.stats.find(stat => stat.stat.name === 'speed').base_stat
|
||||||
};
|
};
|
||||||
|
const inSwordShield = defaultBody.moves
|
||||||
|
.some(move => move.version_group_details.some(mve => mve.version_group.name === 'sword-shield'));
|
||||||
|
this.moveSetVersion = inSwordShield ? 'sword-shield' : 'ultra-sun-ultra-moon';
|
||||||
for (const move of defaultBody.moves) {
|
for (const move of defaultBody.moves) {
|
||||||
const versionGroup = move.version_group_details.find(mve => mve.version_group.name === this.moveSetVersion);
|
const versionGroup = move.version_group_details.find(mve => mve.version_group.name === this.moveSetVersion);
|
||||||
if (!versionGroup || !versionGroup.level_learned_at) continue;
|
if (!versionGroup || !versionGroup.level_learned_at) continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user