Fix freeze on catching Pokemon

pull/2/head
Flashfyre 2023-11-01 10:38:54 -04:00
parent 74f6e9a8f2
commit ccb0245889
1 changed files with 5 additions and 6 deletions

View File

@ -1126,13 +1126,12 @@ export default class BattleScene extends Phaser.Scene {
this.playSound(soundName);
} else if (!virtual) {
const defaultModifierType = getDefaultModifierTypeForTier(modifier.type.tier);
this.addModifier(defaultModifierType.newModifier(), ignoreUpdate, playSound).then(() => resolve());
this.queueMessage(`The stack for this item is full.\n You will receive ${defaultModifierType.name} instead.`, null, true);
return;
return this.addModifier(defaultModifierType.newModifier(), ignoreUpdate, playSound).then(() => resolve());
}
if (!ignoreUpdate && !virtual)
this.updateModifiers().then(() => resolve());
return this.updateModifiers().then(() => resolve());
} else if (modifier instanceof ConsumableModifier) {
if (playSound && !this.sound.get(soundName))
this.playSound(soundName);
@ -1155,15 +1154,15 @@ export default class BattleScene extends Phaser.Scene {
modifier.apply(args);
}
Promise.allSettled(this.party.map(p => p.updateInfo())).then(() => resolve());
return Promise.allSettled(this.party.map(p => p.updateInfo())).then(() => resolve());
} else {
const args = [ this ];
if (modifier.shouldApply(args))
modifier.apply(args);
}
}
resolve();
}
}
});
}