From d556f5aca13e1978bd3ab5fda220ee92715de926 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Wed, 5 Jul 2023 00:29:22 -0400 Subject: [PATCH] Add extra information to party screen --- src/battle-scene.ts | 1 + src/ui/party-ui-handler.ts | 50 +++++++++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 995fd8d96..09841dd89 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -167,6 +167,7 @@ export default class BattleScene extends Phaser.Scene { this.loadImage('overlay_exp', 'ui'); this.loadImage('icon_owned', 'ui'); this.loadImage('ability_bar', 'ui'); + this.loadImage('shiny', 'ui'); this.loadImage('party_bg', 'ui'); this.loadImage('party_bg_double', 'ui'); diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 9ca7c31d3..c362fb941 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -8,6 +8,8 @@ import { Mode } from "./ui"; import * as Utils from "../utils"; import { PokemonHeldItemModifier, SwitchEffectTransferModifier } from "../modifier/modifier"; import { Moves } from "../data/move"; +import { getGenderColor, getGenderSymbol } from "../data/gender"; +import { StatusEffect } from "../data/status-effect"; const defaultMessage = 'Choose a Pokémon.'; @@ -590,9 +592,6 @@ class PartySlot extends Phaser.GameObjects.Container { private slotBg: Phaser.GameObjects.Image; private slotPb: Phaser.GameObjects.Sprite; - private slotPokemonIcon: Phaser.GameObjects.Sprite; - private slotHpOverlay: Phaser.GameObjects.Sprite; - private slotTmLabel: Phaser.GameObjects.Text; constructor(scene: BattleScene, slotIndex: integer, pokemon: PlayerPokemon, partyUiMode: PartyUiMode, tmMoveId: Moves) { super(scene, slotIndex >= scene.currentBattle.getBattlerCount() ? 230.5 : 64, @@ -622,7 +621,6 @@ class PartySlot extends Phaser.GameObjects.Container { const pokemonIcon = this.scene.add.sprite(slotPb.x, slotPb.y, this.pokemon.species.getIconAtlasKey()); pokemonIcon.play(this.pokemon.getIconKey()); - this.slotPokemonIcon = pokemonIcon; this.add(pokemonIcon); @@ -630,7 +628,7 @@ class PartySlot extends Phaser.GameObjects.Container { this.add(slotInfoContainer); const slotName = addTextObject(this.scene, 0, 0, this.pokemon.name, TextStyle.PARTY); - slotName.setPositionRelative(slotBg, this.slotIndex >= battlerCount ? 21 : 24, this.slotIndex >= battlerCount ? 3 : 10); + slotName.setPositionRelative(slotBg, this.slotIndex >= battlerCount ? 21 : 24, this.slotIndex >= battlerCount ? 2 : 10); slotName.setOrigin(0, 0); const slotLevelLabel = this.scene.add.image(0, 0, 'party_slot_overlay_lv'); @@ -643,9 +641,38 @@ class PartySlot extends Phaser.GameObjects.Container { slotInfoContainer.add([ slotName, slotLevelLabel, slotLevelText ]); + const genderSymbol = getGenderSymbol(this.pokemon.gender); + + if (genderSymbol) { + const slotGenderText = addTextObject(this.scene, 0, 0, genderSymbol, TextStyle.PARTY); + slotGenderText.setColor(getGenderColor(this.pokemon.gender)); + slotGenderText.setShadowColor(getGenderColor(this.pokemon.gender, true)); + slotGenderText.setPositionRelative(slotName, this.slotIndex >= battlerCount ? 44 : 76, 3); + slotGenderText.setOrigin(0, 0.25); + + slotInfoContainer.add(slotGenderText); + } + + if (this.pokemon.status) { + const statusIndicator = this.scene.add.sprite(0, 0, 'statuses'); + statusIndicator.setFrame(StatusEffect[this.pokemon.status?.effect || StatusEffect.POISON].toLowerCase()); + statusIndicator.setOrigin(0, 0); + statusIndicator.setPositionRelative(slotLevelLabel, this.slotIndex >= battlerCount ? 43 : 55, 0); + + slotInfoContainer.add(statusIndicator); + } + + if (this.pokemon.shiny) { + const shinyStar = this.scene.add.image(0, 0, 'shiny'); + shinyStar.setOrigin(0, 0); + shinyStar.setPositionRelative(slotLevelLabel, this.slotIndex >= battlerCount ? 35 : 67, this.slotIndex >= battlerCount ? -1 : -18); + + slotInfoContainer.add(shinyStar); + } + if (partyUiMode !== PartyUiMode.TM_MODIFIER) { const slotHpBar = this.scene.add.image(0, 0, 'party_slot_hp_bar'); - slotHpBar.setPositionRelative(slotBg, this.slotIndex >= battlerCount ? 72 : 8, this.slotIndex >= battlerCount ? 7 : 31); + slotHpBar.setPositionRelative(slotBg, this.slotIndex >= battlerCount ? 72 : 8, this.slotIndex >= battlerCount ? 6 : 31); slotHpBar.setOrigin(0, 0); const hpRatio = this.pokemon.getHpRatio(); @@ -660,8 +687,6 @@ class PartySlot extends Phaser.GameObjects.Container { slotHpText.setOrigin(1, 0); slotInfoContainer.add([ slotHpBar, slotHpOverlay, slotHpText ]); - - this.slotHpOverlay = slotHpOverlay; } else { let slotTmText: string; switch (true) { @@ -675,11 +700,12 @@ class PartySlot extends Phaser.GameObjects.Container { slotTmText = 'ABLE'; break; } - this.slotTmLabel = addTextObject(this.scene, 0, 0, slotTmText, TextStyle.MESSAGE); - this.slotTmLabel.setPositionRelative(slotBg, this.slotIndex >= battlerCount ? 82 : 32, this.slotIndex >= battlerCount ? 16 : 46); - this.slotTmLabel.setOrigin(0, 1); - slotInfoContainer.add(this.slotTmLabel); + const slotTmLabel = addTextObject(this.scene, 0, 0, slotTmText, TextStyle.MESSAGE); + slotTmLabel.setPositionRelative(slotBg, this.slotIndex >= battlerCount ? 94 : 32, this.slotIndex >= battlerCount ? 16 : 46); + slotTmLabel.setOrigin(0, 1); + + slotInfoContainer.add(slotTmLabel); } }