Fix various shiny checks for palettes

pull/193/head
Flashfyre 2024-04-19 11:11:19 -04:00
parent 5c367db8a3
commit bd80281859
4 changed files with 6 additions and 6 deletions

View File

@ -798,7 +798,7 @@ export abstract class BattleAnim {
sprite = scene.addPokemonSprite(isUser ? user : target, 0, 0, spriteSource.texture, spriteSource.frame.name, true); 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]); [ 'spriteColors', 'fusionSpriteColors' ].map(k => sprite.pipelineData[k] = (isUser ? user : target).getSprite().pipelineData[k]);
sprite.setPipelineData('spriteKey', (isUser ? user : target).getSpriteKey()); 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('variant', (isUser ? user : target).variant);
sprite.setPipelineData('ignoreFieldPos', true); sprite.setPipelineData('ignoreFieldPos', true);
spriteSource.on('animationupdate', (_anim, frame) => sprite.setFrame(frame.textureFrame)); spriteSource.on('animationupdate', (_anim, frame) => sprite.setFrame(frame.textureFrame));

View File

@ -306,7 +306,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.updateFusionPalette(true); this.updateFusionPalette(true);
resolve(); resolve();
}; };
if (this.isShiny()) { if (this.shiny) {
const populateVariantColors = (key: string, back: boolean = false): Promise<void> => { const populateVariantColors = (key: string, back: boolean = false): Promise<void> => {
return new Promise(resolve => { return new Promise(resolve => {
const battleSpritePath = this.getBattleSpriteAtlasPath(back, ignoreOverride); const battleSpritePath = this.getBattleSpriteAtlasPath(back, ignoreOverride);
@ -407,11 +407,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
getIconId(ignoreOverride?: boolean): string { 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 { 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 { getSpeciesForm(ignoreOverride?: boolean): PokemonSpeciesForm {

View File

@ -410,7 +410,7 @@ export default class SpritePipeline extends FieldSpritePipeline {
const flatBaseColors: integer[] = []; const flatBaseColors: integer[] = [];
const flatVariantColors: number[] = []; 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)) { && (variantColors = variantColorCache[sprite.parentContainer instanceof Pokemon ? sprite.parentContainer.getSprite().texture.key : data['spriteKey']]) && variantColors.hasOwnProperty(variant)) {
const baseColors = Object.keys(variantColors[variant]); const baseColors = Object.keys(variantColors[variant]);
for (let c = 0; c < 32; c++) { for (let c = 0; c < 32; c++) {

View File

@ -225,7 +225,7 @@ export default class SummaryUiHandler extends UiHandler {
this.pokemonSprite.setPipelineData('teraColor', getTypeRgb(this.pokemon.getTeraType())); this.pokemonSprite.setPipelineData('teraColor', getTypeRgb(this.pokemon.getTeraType()));
this.pokemonSprite.setPipelineData('ignoreTimeTint', true); this.pokemonSprite.setPipelineData('ignoreTimeTint', true);
this.pokemonSprite.setPipelineData('spriteKey', this.pokemon.getSpriteKey()); 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); this.pokemonSprite.setPipelineData('variant', this.pokemon.variant);
[ 'spriteColors', 'fusionSpriteColors' ].map(k => { [ 'spriteColors', 'fusionSpriteColors' ].map(k => {
delete this.pokemonSprite.pipelineData[`${k}Base`]; delete this.pokemonSprite.pipelineData[`${k}Base`];