From 83b85acd8a68991cd756782b29cde80d0dddc597 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Mon, 13 Nov 2023 08:20:31 -0500 Subject: [PATCH] Fix logic for checking starter attributes --- src/pokemon.ts | 2 +- src/system/game-data.ts | 4 ++-- src/ui/battle-info.ts | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pokemon.ts b/src/pokemon.ts index 4ce9c8a6bbf..10efb8e47ce 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -222,7 +222,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return !this.isFainted() && !!this.scene && (!onField || this.isOnField()); } - getDexAttrs(): bigint { + getDexAttr(): bigint { let ret = 0n; ret |= this.gender !== Gender.FEMALE ? DexAttr.MALE : DexAttr.FEMALE; ret |= !this.shiny ? DexAttr.NON_SHINY : DexAttr.SHINY; diff --git a/src/system/game-data.ts b/src/system/game-data.ts index c9d13110aa4..06632e2e9e1 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -356,7 +356,7 @@ export class GameData { setPokemonSeen(pokemon: Pokemon, incrementCount: boolean = true): void { const dexEntry = this.dexData[pokemon.species.speciesId]; - dexEntry.seenAttr |= pokemon.getDexAttrs(); + dexEntry.seenAttr |= pokemon.getDexAttr(); if (incrementCount) dexEntry.seenCount++; } @@ -369,7 +369,7 @@ export class GameData { return new Promise((resolve) => { const dexEntry = this.dexData[species.speciesId]; const caughtAttr = dexEntry.caughtAttr; - dexEntry.caughtAttr |= pokemon.getDexAttrs(); + dexEntry.caughtAttr |= pokemon.getDexAttr(); if (incrementCount) dexEntry.seenCount++; diff --git a/src/ui/battle-info.ts b/src/ui/battle-info.ts index 3f4e3ed2a87..b16f64049fd 100644 --- a/src/ui/battle-info.ts +++ b/src/ui/battle-info.ts @@ -131,7 +131,8 @@ export default class BattleInfo extends Phaser.GameObjects.Container { if (!this.player) { const dexEntry = pokemon.scene.gameData.dexData[pokemon.species.speciesId]; this.ownedIcon.setVisible(!!dexEntry.caughtAttr); - if (!(dexEntry.caughtAttr & pokemon.getDexAttrs())) + const dexAttr = pokemon.getDexAttr(); + if ((dexEntry.caughtAttr & dexAttr) < dexAttr) this.ownedIcon.setTint(0x808080); }