From 6b5bb781101dbf9c1ebfbda6a54fead3241ae2df Mon Sep 17 00:00:00 2001 From: frutescens Date: Fri, 6 Sep 2024 18:05:33 -0700 Subject: [PATCH] Cleaned up how cry keys were retrieved --- src/battle-scene.ts | 8 ++++---- src/data/pokemon-species.ts | 6 +++--- src/field/pokemon.ts | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 9123a213f4c..4ceebf5693e 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -2765,18 +2765,18 @@ export default class BattleScene extends SceneBase { playerParty.forEach(p => { keys.push("pkmn__" + p.species.getSpriteId(p.gender === Gender.FEMALE, p.species.formIndex, p.shiny, p.variant)); keys.push("pkmn__" + p.species.getSpriteId(p.gender === Gender.FEMALE, p.species.formIndex, p.shiny, p.variant, true)); - keys.push("cry/" + p.species.getCryKey(p.species.formIndex)); + keys.push(p.species.getCryKey(p.species.formIndex)); if (p.fusionSpecies && p.getSpeciesForm() !== p.getFusionSpeciesForm()) { - keys.push("cry/"+p.getFusionSpeciesForm().getCryKey(p.fusionSpecies.formIndex)); + keys.push(p.getFusionSpeciesForm().getCryKey(p.fusionSpecies.formIndex)); } }); // enemyParty has to be operated on separately from playerParty because playerPokemon =/= enemyPokemon const enemyParty = this.getEnemyParty(); enemyParty.forEach(p => { keys.push(p.species.getSpriteKey(p.gender === Gender.FEMALE, p.species.formIndex, p.shiny, p.variant)); - keys.push("cry/" + p.species.getCryKey(p.species.formIndex)); + keys.push(p.species.getCryKey(p.species.formIndex)); if (p.fusionSpecies && p.getSpeciesForm() !== p.getFusionSpeciesForm()) { - keys.push("cry/"+p.getFusionSpeciesForm().getCryKey(p.fusionSpecies.formIndex)); + keys.push(p.getFusionSpeciesForm().getCryKey(p.fusionSpecies.formIndex)); } }); return keys; diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index 09448b332e4..a1fb6c7224c 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -432,7 +432,7 @@ export abstract class PokemonSpeciesForm { break; } } - return ret; + return `cry/${ret}`; } validateStarterMoveset(moveset: StarterMoveset, eggMoves: integer): boolean { @@ -460,7 +460,7 @@ export abstract class PokemonSpeciesForm { return new Promise(resolve => { const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant); scene.loadPokemonAtlas(spriteKey, this.getSpriteAtlasPath(female, formIndex, shiny, variant)); - scene.load.audio(`cry/${this.getCryKey(formIndex)}`, `audio/cry/${this.getCryKey(formIndex)}.m4a`); + scene.load.audio(`${this.getCryKey(formIndex)}`, `audio/${this.getCryKey(formIndex)}.m4a`); scene.load.once(Phaser.Loader.Events.COMPLETE, () => { const originalWarn = console.warn; // Ignore warnings for missing frames, because there will be a lot @@ -516,7 +516,7 @@ export abstract class PokemonSpeciesForm { if (cry?.pendingRemove) { cry = null; } - cry = scene.playSound(`cry/${(cry ?? cryKey)}`, soundConfig); + cry = scene.playSound(cry ?? cryKey, soundConfig); if (ignorePlay) { cry.stop(); } diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index f522d50f357..d082191a6d3 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2771,7 +2771,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return this.fusionFaintCry(callback); } - const key = `cry/${this.getSpeciesForm().getCryKey(this.formIndex)}`; + const key = this.getSpeciesForm().getCryKey(this.formIndex); //eslint-disable-next-line @typescript-eslint/no-unused-vars let i = 0; let rate = 0.85; @@ -2829,7 +2829,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } private fusionFaintCry(callback: Function): void { - const key = `cry/${this.getSpeciesForm().getCryKey(this.formIndex)}`; + const key = this.getSpeciesForm().getCryKey(this.formIndex); let i = 0; let rate = 0.85; const cry = this.scene.playSound(key, { rate: rate }) as AnySound; @@ -2837,7 +2837,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { const tintSprite = this.getTintSprite(); let duration = cry.totalDuration * 1000; - const fusionCryKey = `cry/${this.getFusionSpeciesForm().getCryKey(this.fusionFormIndex)}`; + const fusionCryKey = `${this.getFusionSpeciesForm().getCryKey(this.fusionFormIndex)}`; let fusionCry = this.scene.playSound(fusionCryKey, { rate: rate }) as AnySound; fusionCry.stop(); duration = Math.min(duration, fusionCry.totalDuration * 1000);