Show correct form sprite in pokedex-stats

This commit is contained in:
Dragon Fire
2021-01-18 18:05:09 -05:00
parent 07e66871f8
commit d38a2d76d6
3 changed files with 14 additions and 3 deletions
+9 -1
View File
@@ -100,11 +100,19 @@ module.exports = class Pokemon {
}
get spriteImageURL() {
if (this.missingno) return missingno.sprite;
if (this.missingno) return missingno.sprites.default;
if (this.id === 898) return 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/898.png';
return `https://serebii.net/pokemon/art/${this.displayID}.png`;
}
formSpriteImageURL(variety) {
if (this.missingno && form === 'yellow') return missingno.sprites.yellow;
if (this.id === 898) return 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/898.png';
const found = this.varieties.find(vrity => variety ? vrity.id === variety.toLowerCase() : vrity.default);
const name = found.name ? found.name.toLowerCase().split(' ').map(n => n.charAt(0)).join('') : '';
return `https://serebii.net/pokemon/art/${this.displayID}${name ? `-${name}` : ''}.png`;
}
get boxImageURL() {
if (this.missingno) return missingno.box;
return `https://www.serebii.net/pokedex-swsh/icon/${this.displayID}.png`;