Fix crash related to fusion sprites

pull/213/head^2
Flashfyre 2024-04-20 16:08:33 -04:00
parent d9a685611d
commit 9b03d6f8d3
1 changed files with 2 additions and 2 deletions

View File

@ -2043,7 +2043,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
for (let f = 0; f < 2; f++) {
const variantColors = variantColorCache[!f ? spriteKey : backSpriteKey];
let variantColorSet = new Map<integer, integer[]>();
if (variantColors) {
if (this.shiny && variantColors && variantColors[this.variant]) {
Object.keys(variantColors[this.variant]).forEach(k => {
variantColorSet.set(Utils.rgbaToInt(Array.from(Object.values(Utils.rgbHexToRgba(k)))), Array.from(Object.values(Utils.rgbHexToRgba(variantColors[this.variant][k]))));
});
@ -2082,7 +2082,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
for (let f = 0; f < 2; f++) {
const variantColors = variantColorCache[!f ? fusionSpriteKey : fusionBackSpriteKey];
let variantColorSet = new Map<integer, integer[]>();
if (variantColors) {
if (this.fusionShiny && variantColors && variantColors[this.fusionVariant]) {
Object.keys(variantColors[this.fusionVariant]).forEach(k => {
variantColorSet.set(Utils.rgbaToInt(Array.from(Object.values(Utils.rgbHexToRgba(k)))), Array.from(Object.values(Utils.rgbHexToRgba(variantColors[this.fusionVariant][k]))));
});