Fix crash with certain animated variant sprites
This commit is contained in:
1 parent
b863ab88a7
commit
ef552c7ffd
5 files changed
+212
-6
No files matched your search
@@ -312,12 +312,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
const battleSpritePath = this.getBattleSpriteAtlasPath(back, ignoreOverride).replace('variant/', '').replace(/_[1-3]$/, '');
|
||||
let variantSet: VariantSet;
|
||||
let config = variantData;
|
||||
const useExpSprite = this.scene.experimentalSprites && this.scene.hasExpSprite(this.getBattleSpriteKey(back, ignoreOverride));
|
||||
battleSpritePath.split('/').map(p => config ? config = config[p] : null);
|
||||
variantSet = config as VariantSet;
|
||||
if (variantSet && variantSet[this.variant] === 1) {
|
||||
if (variantColorCache.hasOwnProperty(key))
|
||||
return resolve();
|
||||
this.scene.cachedFetch(`./images/pokemon/variant/${battleSpritePath}.json`).then(res => res.json()).then(c => {
|
||||
this.scene.cachedFetch(`./images/pokemon/variant/${useExpSprite ? 'exp/' : ''}${battleSpritePath}.json`).then(res => res.json()).then(c => {
|
||||
variantColorCache[key] = c;
|
||||
resolve();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user