Fix wild shiny luck generation

battle-stats
Flashfyre 2024-04-26 19:36:27 -04:00
parent 6b9542511f
commit f281605146
1 changed files with 4 additions and 3 deletions

View File

@ -194,7 +194,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
} }
this.luck = (this.shiny ? (this.variant + 1) : 0) + (this.fusionShiny ? this.fusionVariant + 1 : 0); this.luck = (this.shiny ? this.variant + 1 : 0) + (this.fusionShiny ? this.fusionVariant + 1 : 0);
} }
this.generateName(); this.generateName();
@ -693,7 +693,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
getLuck(): integer { getLuck(): integer {
return this.luck + this.fusionLuck; return this.luck + (this.isFusion() ? this.fusionLuck : 0);
} }
isFusion(): boolean { isFusion(): boolean {
@ -2111,7 +2111,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (variantColors) { if (variantColors) {
const color = Utils.rgbaToInt([r, g, b, a]); const color = Utils.rgbaToInt([r, g, b, a]);
if (variantColorSet.has(color)) { if (variantColorSet.has(color)) {
console.log(color);
const mappedPixel = variantColorSet.get(color); const mappedPixel = variantColorSet.get(color);
[ r, g, b, a ] = mappedPixel; [ r, g, b, a ] = mappedPixel;
} }
@ -2550,6 +2549,8 @@ export class EnemyPokemon extends Pokemon {
if (this.shiny) if (this.shiny)
this.variant = this.generateVariant(); this.variant = this.generateVariant();
this.luck = (this.shiny ? this.variant + 1 : 0) + (this.fusionShiny ? this.fusionVariant + 1 : 0);
let prevolution: Species; let prevolution: Species;
let speciesId = species.speciesId; let speciesId = species.speciesId;
while ((prevolution = pokemonPrevolutions[speciesId])) { while ((prevolution = pokemonPrevolutions[speciesId])) {