diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 52490cd16..ac1d3e629 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -429,10 +429,12 @@ export default class BattleScene extends SceneBase { ui.setup(); + const defaultMoves = [ Moves.TACKLE, Moves.TAIL_WHIP, Moves.FOCUS_ENERGY, Moves.STRUGGLE ]; + Promise.all([ Promise.all(loadPokemonAssets), initCommonAnims().then(() => loadCommonAnimAssets(this, true)), - initMoveAnim(Moves.STRUGGLE).then(() => loadMoveAnimAssets(this, [ Moves.STRUGGLE ], true)) + Promise.all([ Moves.TACKLE, Moves.TAIL_WHIP, Moves.FOCUS_ENERGY, Moves.STRUGGLE ].map(m => initMoveAnim(m))).then(() => loadMoveAnimAssets(this, defaultMoves, true)) ]).then(() => { this.pushPhase(new LoginPhase(this)); this.pushPhase(new TitlePhase(this)); diff --git a/src/data/battle-anims.ts b/src/data/battle-anims.ts index a3af386d0..9583b47f1 100644 --- a/src/data/battle-anims.ts +++ b/src/data/battle-anims.ts @@ -455,16 +455,14 @@ export function initMoveAnim(move: Moves): Promise { } else { moveAnims.set(move, null); const defaultMoveAnim = allMoves[move] instanceof AttackMove ? Moves.TACKLE : allMoves[move] instanceof SelfStatusMove ? Moves.FOCUS_ENERGY : Moves.TAIL_WHIP; + const moveName = Moves[move].toLowerCase().replace(/\_/g, '-'); const fetchAnimAndResolve = (move: Moves) => { - fetch(`./battle-anims/${Moves[move].toLowerCase().replace(/\_/g, '-')}.json`) + fetch(`./battle-anims/${moveName}.json`) .then(response => { if (!response.ok) { - console.error(response.status, response.statusText); - if (move !== defaultMoveAnim) - fetchAnimAndResolve(defaultMoveAnim); - else - resolve(); - return; + console.error(`Could not load animation file for move '${moveName}'`, response.status, response.statusText); + populateMoveAnim(move, moveAnims.get(defaultMoveAnim)); + return resolve(); } return response.json(); })