mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-22 01:24:13 +01:00
Fix tinted caught icon false positive (#892)
* Fix tinted caught icon false positive * Remove unused import * Rename and optimize * Block comment * use 3 equals
This commit is contained in:
parent
4362d49e6b
commit
edf3a6aa36
@ -260,8 +260,23 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
|||||||
if (!this.player) {
|
if (!this.player) {
|
||||||
const dexEntry = pokemon.scene.gameData.dexData[pokemon.species.speciesId];
|
const dexEntry = pokemon.scene.gameData.dexData[pokemon.species.speciesId];
|
||||||
this.ownedIcon.setVisible(!!dexEntry.caughtAttr);
|
this.ownedIcon.setVisible(!!dexEntry.caughtAttr);
|
||||||
const dexAttr = pokemon.getDexAttr();
|
const opponentPokemonDexAttr = pokemon.getDexAttr();
|
||||||
if ((dexEntry.caughtAttr & dexAttr) < dexAttr || !(pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId()].abilityAttr & Math.pow(2, pokemon.abilityIndex)))
|
|
||||||
|
// Check if Player owns all genders and forms of the Pokemon
|
||||||
|
const missingDexAttrs = ((dexEntry.caughtAttr & opponentPokemonDexAttr) < opponentPokemonDexAttr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the opposing Pokemon only has 1 normal ability and is using the hidden ability it should have the same behavior
|
||||||
|
* if it had 2 normal abilities. This code checks if that is the case and uses the correct opponent Pokemon abilityIndex (2)
|
||||||
|
* for calculations so it aligns with where the hidden ability is stored in the starter data's abilityAttr (4)
|
||||||
|
*/
|
||||||
|
const opponentPokemonOneNormalAbility = (pokemon.species.getAbilityCount() === 2);
|
||||||
|
const opponentPokemonAbilityIndex = (opponentPokemonOneNormalAbility && pokemon.abilityIndex === 1) ? 2 : pokemon.abilityIndex;
|
||||||
|
const opponentPokemonAbilityAttr = Math.pow(2, opponentPokemonAbilityIndex);
|
||||||
|
|
||||||
|
const rootFormHasHiddenAbility = pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId()].abilityAttr & opponentPokemonAbilityAttr;
|
||||||
|
|
||||||
|
if (missingDexAttrs || !rootFormHasHiddenAbility)
|
||||||
this.ownedIcon.setTint(0x808080);
|
this.ownedIcon.setTint(0x808080);
|
||||||
|
|
||||||
if (this.boss)
|
if (this.boss)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user