From f19baef227dece669e20a4be59e2a6f4fdd4a1fe Mon Sep 17 00:00:00 2001 From: Jon Studders Date: Tue, 14 May 2024 23:18:09 +0100 Subject: [PATCH 1/3] Added a champion ribbon on enemy pokemon if they have a classic win. --- src/ui/battle-info.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ui/battle-info.ts b/src/ui/battle-info.ts index f2e48911e..82ca62bf4 100644 --- a/src/ui/battle-info.ts +++ b/src/ui/battle-info.ts @@ -8,6 +8,7 @@ import BattleScene from '../battle-scene'; import { Type, getTypeRgb } from '../data/type'; import { getVariantTint } from '#app/data/variant'; import { BattleStat } from '#app/data/battle-stat'; +import { StarterDataEntry } from '#app/system/game-data'; const battleStatOrder = [ BattleStat.ATK, BattleStat.DEF, BattleStat.SPATK, BattleStat.SPDEF, BattleStat.ACC, BattleStat.EVA, BattleStat.SPD ]; @@ -33,6 +34,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; @@ -93,6 +95,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'); @@ -260,10 +268,16 @@ 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); + const dexAttr = pokemon.getDexAttr(); if ((dexEntry.caughtAttr & dexAttr) < dexAttr || !(pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId()].abilityAttr & Math.pow(2, pokemon.abilityIndex))) this.ownedIcon.setTint(0x808080); + const starterDataEntry: StarterDataEntry = pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId()]; + if(starterDataEntry.classicWinCount > 0) { + this.championRibbon.setVisible(true); + } + if (this.boss) this.updateBossSegmentDividers(pokemon as EnemyPokemon); } From 0584ca0a4ecf5075ff974873f9f819820191221a Mon Sep 17 00:00:00 2001 From: Jon Studders Date: Tue, 14 May 2024 23:43:05 +0100 Subject: [PATCH 2/3] Refactored to check for other non-root starterDex entities. --- src/ui/battle-info.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ui/battle-info.ts b/src/ui/battle-info.ts index 82ca62bf4..4ba074644 100644 --- a/src/ui/battle-info.ts +++ b/src/ui/battle-info.ts @@ -273,8 +273,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container { if ((dexEntry.caughtAttr & dexAttr) < dexAttr || !(pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId()].abilityAttr & Math.pow(2, pokemon.abilityIndex))) this.ownedIcon.setTint(0x808080); - const starterDataEntry: StarterDataEntry = pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId()]; - if(starterDataEntry.classicWinCount > 0) { + if(pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId()].classicWinCount > 0 && pokemon.scene.gameData.starterData[pokemon.species.getRootSpeciesId(true)].classicWinCount > 0) { this.championRibbon.setVisible(true); } From a76435939c3428b2c16c9172020fdf58484acf61 Mon Sep 17 00:00:00 2001 From: Jon Studders Date: Wed, 15 May 2024 00:10:10 +0100 Subject: [PATCH 3/3] Check for caughtIcon, if false then move ribbon to the left. --- src/ui/battle-info.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ui/battle-info.ts b/src/ui/battle-info.ts index 4ba074644..2923540c8 100644 --- a/src/ui/battle-info.ts +++ b/src/ui/battle-info.ts @@ -274,6 +274,9 @@ export default class BattleInfo extends Phaser.GameObjects.Container { 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); }