Apply suggestions from code review

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: MokaStitcher <54149968+MokaStitcher@users.noreply.github.com>
This commit is contained in:
Mumble 2024-10-04 17:07:23 -07:00 committed by GitHub
parent d01e28fdcc
commit 4969cdb99c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,7 @@ import { SessionSaveData } from "../system/game-data";
import { TextStyle, addTextObject, addBBCodeTextObject, getTextColor } from "./text";
import { Mode } from "./ui";
import { addWindow } from "./ui-theme";
import { getPokeballAtlasKey } from "../data/pokeball";
import { getPokeballAtlasKey } from "#app/data/pokeball";
import * as Utils from "../utils";
import PokemonData from "../system/pokemon-data";
import i18next from "i18next";
@ -24,7 +24,7 @@ import { Species } from "#enums/species";
import { PlayerGender } from "#enums/player-gender";
import { SettingKeyboard } from "#app/system/settings/settings-keyboard";
import { getBiomeName } from "#app/data/balance/biomes";
import { MysteryEncounterType } from "#app/enums/mystery-encounter-type";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
/**
* RunInfoUiMode indicates possible overlays of RunInfoUiHandler.
@ -247,8 +247,8 @@ export default class RunInfoUiHandler extends UiHandler {
}
/**
* This function is used when the Run Info UI is used to preview a Session
* It edits runResultContainer, but most importantly - does not display the negative results of a Mystery Encounter or any details of a trainer's party
* This function is used when the Run Info UI is used to preview a Session.
* It edits {@linkcode runResultContainer}, but most importantly - does not display the negative results of a Mystery Encounter or any details of a trainer's party.
* Trainer Parties are replaced with their sprites, names, and their party size.
* Mystery Encounters contain sprites associated with MEs + the title of the specific ME.
*/
@ -256,17 +256,12 @@ export default class RunInfoUiHandler extends UiHandler {
const runStatusText = addTextObject(this.scene, 6, 5, `${i18next.t("saveSlotSelectUiHandler:wave")} ${this.runInfo.waveIndex} - ${getBiomeName(this.runInfo.arena.biome)}`, TextStyle.WINDOW, {fontSize : "65px", lineSpacing: 0.1});
const enemyContainer = this.scene.add.container(0, 0);
// Wild - Single and Doubles
if (this.runInfo.battleType === BattleType.WILD) {
switch (this.runInfo.enemyParty.length) {
case 1:
// Wild - Singles
if (this.runInfo.enemyParty.length === 1) {
this.parseWildSingleDefeat(enemyContainer);
break;
case 2:
// Wild - Doubles
} else if (this.runInfo.enemyParty.length === 2) {
this.parseWildDoubleDefeat(enemyContainer);
break;
}
} else if (this.runInfo.battleType === BattleType.TRAINER) {
this.showTrainerSprites(enemyContainer);
@ -364,8 +359,8 @@ export default class RunInfoUiHandler extends UiHandler {
/**
* This loads the enemy sprites, positions, and scales them according to the current display mode of the RunInfo UI and then adds them to the container parameter.
* Used by parseRunStatus and parseTrainerDefeat
* @param {Phaser.GameObjects.Container} enemyContainer a Phaser Container that should hold enemy sprites
* Used by {@linkcode parseRunStatus} and {@linkcode parseTrainerDefeat}
* @param enemyContainer a Phaser Container that should hold enemy sprites
*/
private showTrainerSprites(enemyContainer: Phaser.GameObjects.Container) {
// Creating the trainer sprite and adding it to enemyContainer
@ -406,11 +401,11 @@ export default class RunInfoUiHandler extends UiHandler {
/**
* This edits a container to represent a loss from a defeat by a trainer battle.
* @param enemyContainer - container holding enemy visuals and level information
* The trainers are placed to the left of their party.
* Depending on the trainer icon, there may be overlap between the edges of the box or their party. (Capes...)
*
* Party Pokemon have their icons, terastalization status, and level shown.
* @param enemyContainer - container holding enemy visuals and level information
*/
private parseTrainerDefeat(enemyContainer: Phaser.GameObjects.Container) {
// Loads and adds trainer sprites to the UI