Fix shiny variant back sprite color mapping not working

This commit is contained in:
Flashfyre committed 2024-04-22 00:31:33 -04:00
1 parent df7a6be654
commit 4950dd0e73
2 files changed
+4 -4

No files matched your search

+3 -3
View File
@@ -309,7 +309,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (this.shiny) {
const populateVariantColors = (key: string, back: boolean = false): Promise<void> => {
return new Promise(resolve => {
const battleSpritePath = this.getBattleSpriteAtlasPath(back, ignoreOverride);
const battleSpritePath = this.getBattleSpriteAtlasPath(back, ignoreOverride).replace('variant/', '').replace(/_[1-3]$/, '');
let variantSet: VariantSet;
let config = variantData;
battleSpritePath.split('/').map(p => config ? config = config[p] : null);
@@ -326,9 +326,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
});
};
if (this.isPlayer())
Promise.all([ populateVariantColors(this.getBattleSpriteKey()), populateVariantColors(this.getBattleSpriteKey(true)) ]).then(() => updateFusionPaletteAndResolve());
Promise.all([ populateVariantColors(this.getBattleSpriteKey(false)), populateVariantColors(this.getBattleSpriteKey(true), true) ]).then(() => updateFusionPaletteAndResolve());
else
populateVariantColors(this.getBattleSpriteKey()).then(() => updateFusionPaletteAndResolve());
populateVariantColors(this.getBattleSpriteKey(false)).then(() => updateFusionPaletteAndResolve());
} else
updateFusionPaletteAndResolve();
});