Bit of refactoring, added check for classic mode.

This commit is contained in:
Jon Studders 2024-05-17 14:05:19 +01:00
parent 3872d6fb18
commit 0644ca85b7

View File

@ -270,11 +270,13 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
this.ownedIcon.setVisible(!!dexEntry.caughtAttr); this.ownedIcon.setVisible(!!dexEntry.caughtAttr);
const opponentPokemonDexAttr = pokemon.getDexAttr(); const opponentPokemonDexAttr = pokemon.getDexAttr();
if ((dexEntry.caughtAttr & opponentPokemonDexAttr) < opponentPokemonDexAttr || !(pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId()].abilityAttr & Math.pow(2, pokemon.abilityIndex))) { if (pokemon.scene.gameMode.isClassic) {
if (!dexEntry.caughtAttr) { if(pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId()].classicWinCount > 0 && pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId(true)].classicWinCount > 0) {
this.championRibbon.setPositionRelative(this.nameText, 0, 11.75); if (!dexEntry.caughtAttr) {
this.championRibbon.setPositionRelative(this.nameText, 0, 11.75);
}
this.championRibbon.setVisible(true);
} }
this.championRibbon.setVisible(true);
} }
// Check if Player owns all genders and forms of the Pokemon // Check if Player owns all genders and forms of the Pokemon
@ -294,13 +296,6 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
if (missingDexAttrs || !rootFormHasHiddenAbility) if (missingDexAttrs || !rootFormHasHiddenAbility)
this.ownedIcon.setTint(0x808080); this.ownedIcon.setTint(0x808080);
if(pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId()].classicWinCount > 0 && pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId(true)].classicWinCount > 0) {
if (!dexEntry.caughtAttr) {
this.championRibbon.setPositionRelative(this.nameText, 0, 11.75);
}
this.championRibbon.setVisible(true);
}
if (this.boss) if (this.boss)
this.updateBossSegmentDividers(pokemon as EnemyPokemon); this.updateBossSegmentDividers(pokemon as EnemyPokemon);
} }