mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Future-proof pokedex-moveset for Sword/Shield
This commit is contained in:
@@ -86,6 +86,7 @@
|
||||
"level": 1
|
||||
}
|
||||
],
|
||||
"moveSetVersion": "red-blue",
|
||||
"chain": [0],
|
||||
"missingno": true,
|
||||
"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 versions = {
|
||||
'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 {
|
||||
@@ -56,6 +57,7 @@ module.exports = class PokedexMovesetCommand extends Command {
|
||||
const data = await this.client.pokemon.fetch(pokemon);
|
||||
if (!data) return msg.say('Could not find any results.');
|
||||
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()
|
||||
.setColor(0xED1C24)
|
||||
.setAuthor(`#${data.displayID} - ${data.name}`, data.boxImageURL, data.serebiiURL)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "123.4.0",
|
||||
"version": "123.4.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -48,7 +48,7 @@ module.exports = class Pokemon {
|
||||
this.height = data.missingno ? data.height : null;
|
||||
this.weight = data.missingno ? data.weight : null;
|
||||
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.missingno = data.missingno || false;
|
||||
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,
|
||||
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) {
|
||||
const versionGroup = move.version_group_details.find(mve => mve.version_group.name === this.moveSetVersion);
|
||||
if (!versionGroup || !versionGroup.level_learned_at) continue;
|
||||
|
||||
Reference in New Issue
Block a user