From d790b30a30f26fd9a31af96b4b84c83d7b61151a Mon Sep 17 00:00:00 2001 From: Dean <69436131+emdeann@users.noreply.github.com> Date: Sun, 11 May 2025 18:23:37 -0700 Subject: [PATCH] [Bug][Hotfix] Fix Transformed Sprites not loading properly (#5808) * Fix ditto sprite not loading properly * Remove review comment --- src/field/pokemon.ts | 17 ++++++++++------- src/system/game-data.ts | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 43669c874a9..eec20beb01c 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -909,19 +909,22 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { const originalWarn = console.warn; // Ignore warnings for missing frames, because there will be a lot console.warn = () => {}; - const battleFrameNames = globalScene.anims.generateFrameNames(this.getBattleSpriteKey(), { + const battleSpriteKey = this.getBattleSpriteKey(this.isPlayer(), ignoreOverride); + const battleFrameNames = globalScene.anims.generateFrameNames(battleSpriteKey, { zeroPad: 4, suffix: ".png", start: 1, end: 400, }); console.warn = originalWarn; - globalScene.anims.create({ - key: this.getBattleSpriteKey(), - frames: battleFrameNames, - frameRate: 10, - repeat: -1, - }); + if (!globalScene.anims.exists(battleSpriteKey)) { + globalScene.anims.create({ + key: battleSpriteKey, + frames: battleFrameNames, + frameRate: 10, + repeat: -1, + }); + } } // With everything loaded, now begin playing the animation. this.playAnim(); diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 51e488210be..0c5e0b349ed 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -1110,7 +1110,7 @@ export class GameData { for (const p of sessionData.party) { const pokemon = p.toPokemon() as PlayerPokemon; pokemon.setVisible(false); - loadPokemonAssets.push(pokemon.loadAssets()); + loadPokemonAssets.push(pokemon.loadAssets(false)); party.push(pokemon); }