Added a champion ribbon on enemy pokemon if they have a classic win. (#881)

* Added a champion ribbon on enemy pokemon if they have a classic win.

* Refactored to check for other non-root starterDex entities.

* Check for caughtIcon, if false then move ribbon to the left.

* Fixed Merge.

* Bit of refactoring, added check for classic mode.

* Removed random newline and removed unused import.

* Removed overlapping ribbon.
This commit is contained in:
Jon Studders 2024-05-24 20:57:02 +01:00 committed by GitHub
parent 41751ab8df
commit 3670574342
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 0 deletions

View File

@ -35,6 +35,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
private nameText: Phaser.GameObjects.Text;
private genderText: Phaser.GameObjects.Text;
private ownedIcon: Phaser.GameObjects.Sprite;
private championRibbon: Phaser.GameObjects.Sprite;
private teraIcon: Phaser.GameObjects.Sprite;
private shinyIcon: Phaser.GameObjects.Sprite;
private fusionShinyIcon: Phaser.GameObjects.Sprite;
@ -96,6 +97,12 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
this.ownedIcon.setOrigin(0, 0);
this.ownedIcon.setPositionRelative(this.nameText, 0, 11.75);
this.add(this.ownedIcon);
this.championRibbon = this.scene.add.sprite(0, 0, "champion_ribbon");
this.championRibbon.setVisible(false);
this.championRibbon.setOrigin(0, 0);
this.championRibbon.setPositionRelative(this.nameText, 11.75, 11.75);
this.add(this.championRibbon);
}
this.teraIcon = this.scene.add.sprite(0, 0, "icon_tera");
@ -266,6 +273,11 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
const dexEntry = pokemon.scene.gameData.dexData[pokemon.species.speciesId];
this.ownedIcon.setVisible(!!dexEntry.caughtAttr);
const opponentPokemonDexAttr = pokemon.getDexAttr();
if (pokemon.scene.gameMode.isClassic) {
if(pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId()].classicWinCount > 0 && pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId(true)].classicWinCount > 0) {
this.championRibbon.setVisible(true);
}
}
// Check if Player owns all genders and forms of the Pokemon
const missingDexAttrs = ((dexEntry.caughtAttr & opponentPokemonDexAttr) < opponentPokemonDexAttr);