Fix Transform and Imposter causing crash

This commit is contained in:
Flashfyre 2024-03-27 23:44:11 -04:00
parent eb14031bdd
commit 63a6655759
3 changed files with 5 additions and 5 deletions

View File

@ -762,7 +762,7 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
pokemon.scene.playSound('PRSFX- Transform');
pokemon.loadAssets().then(() => pokemon.playAnim());
pokemon.loadAssets(false).then(() => pokemon.playAnim());
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` transformed\ninto ${target.name}!`));

View File

@ -2480,7 +2480,7 @@ export class TransformAttr extends MoveEffectAttr {
user.scene.queueMessage(getPokemonMessage(user, ` transformed\ninto ${target.name}!`));
user.loadAssets().then(() => {
user.loadAssets(false).then(() => {
user.playAnim();
resolve(true);
});

View File

@ -275,7 +275,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
abstract getBattlerIndex(): BattlerIndex;
loadAssets(): Promise<void> {
loadAssets(ignoreOveride: boolean = true): Promise<void> {
return new Promise(resolve => {
const moveIds = this.getMoveset().map(m => m.getMove().id);
Promise.allSettled(moveIds.map(m => initMoveAnim(m)))
@ -283,10 +283,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
loadMoveAnimAssets(this.scene, moveIds);
this.getSpeciesForm().loadAssets(this.scene, this.getGender() === Gender.FEMALE, this.formIndex, this.shiny);
if (this.isPlayer() || this.getFusionSpeciesForm())
this.scene.loadPokemonAtlas(this.getBattleSpriteKey(true, true), this.getBattleSpriteAtlasPath(true, true));
this.scene.loadPokemonAtlas(this.getBattleSpriteKey(true, ignoreOveride), this.getBattleSpriteAtlasPath(true, ignoreOveride));
if (this.getFusionSpeciesForm()) {
this.getFusionSpeciesForm().loadAssets(this.scene, this.getFusionGender() === Gender.FEMALE, this.fusionFormIndex, this.fusionShiny);
this.scene.loadPokemonAtlas(this.getFusionBattleSpriteKey(true, true), this.getFusionBattleSpriteAtlasPath(true, true));
this.scene.loadPokemonAtlas(this.getFusionBattleSpriteKey(true, ignoreOveride), this.getFusionBattleSpriteAtlasPath(true, ignoreOveride));
}
this.scene.load.once(Phaser.Loader.Events.COMPLETE, () => {
if (this.isPlayer()) {