diff --git a/play.pokemonshowdown.com/src/battle-animations.ts b/play.pokemonshowdown.com/src/battle-animations.ts index 18f44921a..a42cf99fd 100644 --- a/play.pokemonshowdown.com/src/battle-animations.ts +++ b/play.pokemonshowdown.com/src/battle-animations.ts @@ -829,8 +829,11 @@ export class BattleScene implements BattleSceneStub { if (textBuf) textBuf += ' / '; textBuf += pokemon.speciesForme; let url = spriteData.url; + var placeholderSprite = spriteData.isFrontSprite // Pet Mods placeholder sprites + ? "https://play.pokemonshowdown.com/sprites/gen5/substitute.png" + : "https://play.pokemonshowdown.com/sprites/gen5-back/substitute.png"; // if (this.paused) url.replace('/xyani', '/xy').replace('.gif', '.png'); - buf += ''; + buf += ''; buf2 += '
'; const gender = pokemon.gender; if (gender === 'M' || gender === 'F') { diff --git a/play.pokemonshowdown.com/src/battle-dex.ts b/play.pokemonshowdown.com/src/battle-dex.ts index edba35147..1ada85ee4 100644 --- a/play.pokemonshowdown.com/src/battle-dex.ts +++ b/play.pokemonshowdown.com/src/battle-dex.ts @@ -533,14 +533,14 @@ const Dex = new class implements ModdedDex { let resourcePrefix = Dex.resourcePrefix; let spriteDir = 'sprites/'; let fakeSprite = false; - let modName = modSpecies.spriteid; - let id = toID(modName); - options.mod = this.getSpriteMod(options.mod, id, isFront ? 'front' : 'back', modSpecies.exists !== false); + let modSprite = modSpecies.spriteid; + let modSpriteId = toID(modSprite); + options.mod = this.getSpriteMod(options.mod, modSpriteId, isFront ? 'front' : 'back', modSpecies.exists); if (options.mod) { resourcePrefix = Dex.modResourcePrefix; spriteDir = `${options.mod}/sprites/`; fakeSprite = true; - if (this.getSpriteMod(options.mod, id, (isFront ? 'front' : 'back') + '-shiny', modSpecies.exists !== false) === '') options.shiny = false; + if (this.getSpriteMod(options.mod, modSpriteId, (isFront ? 'front' : 'back') + '-shiny', modSpecies.exists) === '') options.shiny = false; } const species = Dex.species.get(pokemon); @@ -667,7 +667,7 @@ const Dex = new class implements ModdedDex { } let fakeAnim = false; - if (fakeSprite && window.ModSprites[id][options.mod].includes('ani' + facing)){ + if (fakeSprite && window.ModSprites[modSpriteId][options.mod].includes('ani' + facing)){ fakeAnim = true; animationData[facing] = {}; animationData[facing].w = 192; @@ -722,7 +722,15 @@ const Dex = new class implements ModdedDex { spriteData.h *= 1.5; spriteData.y += -11; } - + // Placeholder sprites for Pet Mods Fakemons with no sprite data + // window.modsprites[modSpriteId]: checks if it has custom sprite data. + // window.BattlePokemonSprites[modSpriteId]: checks if it is a real Pokemon. + if (!window.ModSprites[modSpriteId] && !window.BattlePokemonSprites[modSpriteId] && pokemon !== 'substitute') { + spriteData = Dex.getSpriteData('substitute', spriteData.isFrontSprite, { + gen: options.gen, + mod: options.mod, + }); + } return spriteData; } @@ -1397,4 +1405,4 @@ if (typeof require === 'function') { // in Node (global as any).Dex = Dex; (global as any).toID = toID; -} +} \ No newline at end of file