mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-27 18:52:19 +02:00
Cleaned up how cry keys were retrieved
This commit is contained in:
parent
ba212945de
commit
6b5bb78110
@ -2765,18 +2765,18 @@ export default class BattleScene extends SceneBase {
|
|||||||
playerParty.forEach(p => {
|
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));
|
||||||
keys.push("pkmn__" + p.species.getSpriteId(p.gender === Gender.FEMALE, p.species.formIndex, p.shiny, p.variant, true));
|
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()) {
|
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
|
// enemyParty has to be operated on separately from playerParty because playerPokemon =/= enemyPokemon
|
||||||
const enemyParty = this.getEnemyParty();
|
const enemyParty = this.getEnemyParty();
|
||||||
enemyParty.forEach(p => {
|
enemyParty.forEach(p => {
|
||||||
keys.push(p.species.getSpriteKey(p.gender === Gender.FEMALE, p.species.formIndex, p.shiny, p.variant));
|
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()) {
|
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;
|
return keys;
|
||||||
|
@ -432,7 +432,7 @@ export abstract class PokemonSpeciesForm {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return `cry/${ret}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
validateStarterMoveset(moveset: StarterMoveset, eggMoves: integer): boolean {
|
validateStarterMoveset(moveset: StarterMoveset, eggMoves: integer): boolean {
|
||||||
@ -460,7 +460,7 @@ export abstract class PokemonSpeciesForm {
|
|||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant);
|
const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant);
|
||||||
scene.loadPokemonAtlas(spriteKey, this.getSpriteAtlasPath(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, () => {
|
scene.load.once(Phaser.Loader.Events.COMPLETE, () => {
|
||||||
const originalWarn = console.warn;
|
const originalWarn = console.warn;
|
||||||
// Ignore warnings for missing frames, because there will be a lot
|
// Ignore warnings for missing frames, because there will be a lot
|
||||||
@ -516,7 +516,7 @@ export abstract class PokemonSpeciesForm {
|
|||||||
if (cry?.pendingRemove) {
|
if (cry?.pendingRemove) {
|
||||||
cry = null;
|
cry = null;
|
||||||
}
|
}
|
||||||
cry = scene.playSound(`cry/${(cry ?? cryKey)}`, soundConfig);
|
cry = scene.playSound(cry ?? cryKey, soundConfig);
|
||||||
if (ignorePlay) {
|
if (ignorePlay) {
|
||||||
cry.stop();
|
cry.stop();
|
||||||
}
|
}
|
||||||
|
@ -2771,7 +2771,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return this.fusionFaintCry(callback);
|
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
|
//eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let rate = 0.85;
|
let rate = 0.85;
|
||||||
@ -2829,7 +2829,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fusionFaintCry(callback: Function): void {
|
private fusionFaintCry(callback: Function): void {
|
||||||
const key = `cry/${this.getSpeciesForm().getCryKey(this.formIndex)}`;
|
const key = this.getSpeciesForm().getCryKey(this.formIndex);
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let rate = 0.85;
|
let rate = 0.85;
|
||||||
const cry = this.scene.playSound(key, { rate: rate }) as AnySound;
|
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();
|
const tintSprite = this.getTintSprite();
|
||||||
let duration = cry.totalDuration * 1000;
|
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;
|
let fusionCry = this.scene.playSound(fusionCryKey, { rate: rate }) as AnySound;
|
||||||
fusionCry.stop();
|
fusionCry.stop();
|
||||||
duration = Math.min(duration, fusionCry.totalDuration * 1000);
|
duration = Math.min(duration, fusionCry.totalDuration * 1000);
|
||||||
|
Loading…
Reference in New Issue
Block a user