From bd8028185927b87b0ec082262c96ff162e76d30d Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 19 Apr 2024 11:11:19 -0400 Subject: [PATCH] Fix various shiny checks for palettes --- src/data/battle-anims.ts | 2 +- src/field/pokemon.ts | 6 +++--- src/pipelines/sprite.ts | 2 +- src/ui/summary-ui-handler.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/data/battle-anims.ts b/src/data/battle-anims.ts index b6275d956..e35914c94 100644 --- a/src/data/battle-anims.ts +++ b/src/data/battle-anims.ts @@ -798,7 +798,7 @@ export abstract class BattleAnim { sprite = scene.addPokemonSprite(isUser ? user : target, 0, 0, spriteSource.texture, spriteSource.frame.name, true); [ 'spriteColors', 'fusionSpriteColors' ].map(k => sprite.pipelineData[k] = (isUser ? user : target).getSprite().pipelineData[k]); sprite.setPipelineData('spriteKey', (isUser ? user : target).getSpriteKey()); - sprite.setPipelineData('shiny', (isUser ? user : target).isShiny()); + sprite.setPipelineData('shiny', (isUser ? user : target).shiny); sprite.setPipelineData('variant', (isUser ? user : target).variant); sprite.setPipelineData('ignoreFieldPos', true); spriteSource.on('animationupdate', (_anim, frame) => sprite.setFrame(frame.textureFrame)); diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 2eddadd1a..28f60027f 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -306,7 +306,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.updateFusionPalette(true); resolve(); }; - if (this.isShiny()) { + if (this.shiny) { const populateVariantColors = (key: string, back: boolean = false): Promise => { return new Promise(resolve => { const battleSpritePath = this.getBattleSpriteAtlasPath(back, ignoreOverride); @@ -407,11 +407,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } getIconId(ignoreOverride?: boolean): string { - return this.getSpeciesForm(ignoreOverride).getIconId(this.getGender(ignoreOverride) === Gender.FEMALE, this.formIndex, this.isShiny(), this.variant); + return this.getSpeciesForm(ignoreOverride).getIconId(this.getGender(ignoreOverride) === Gender.FEMALE, this.formIndex, this.shiny, this.variant); } getFusionIconId(ignoreOverride?: boolean): string { - return this.getFusionSpeciesForm(ignoreOverride).getIconId(this.getFusionGender(ignoreOverride) === Gender.FEMALE, this.fusionFormIndex, this.isShiny(), this.variant); + return this.getFusionSpeciesForm(ignoreOverride).getIconId(this.getFusionGender(ignoreOverride) === Gender.FEMALE, this.fusionFormIndex, this.fusionShiny, this.variant); } getSpeciesForm(ignoreOverride?: boolean): PokemonSpeciesForm { diff --git a/src/pipelines/sprite.ts b/src/pipelines/sprite.ts index bfbdcf48e..534c8d42d 100644 --- a/src/pipelines/sprite.ts +++ b/src/pipelines/sprite.ts @@ -410,7 +410,7 @@ export default class SpritePipeline extends FieldSpritePipeline { const flatBaseColors: integer[] = []; const flatVariantColors: number[] = []; - if ((sprite.parentContainer instanceof Pokemon ? sprite.parentContainer.isShiny() : !!data['shiny']) + if ((sprite.parentContainer instanceof Pokemon ? sprite.parentContainer.shiny : !!data['shiny']) && (variantColors = variantColorCache[sprite.parentContainer instanceof Pokemon ? sprite.parentContainer.getSprite().texture.key : data['spriteKey']]) && variantColors.hasOwnProperty(variant)) { const baseColors = Object.keys(variantColors[variant]); for (let c = 0; c < 32; c++) { diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 3450113d7..0fdd7606c 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -225,7 +225,7 @@ export default class SummaryUiHandler extends UiHandler { this.pokemonSprite.setPipelineData('teraColor', getTypeRgb(this.pokemon.getTeraType())); this.pokemonSprite.setPipelineData('ignoreTimeTint', true); this.pokemonSprite.setPipelineData('spriteKey', this.pokemon.getSpriteKey()); - this.pokemonSprite.setPipelineData('shiny', this.pokemon.isShiny()); + this.pokemonSprite.setPipelineData('shiny', this.pokemon.shiny); this.pokemonSprite.setPipelineData('variant', this.pokemon.variant); [ 'spriteColors', 'fusionSpriteColors' ].map(k => { delete this.pokemonSprite.pipelineData[`${k}Base`];