mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-03 23:12:20 +02:00
Merge branch 'egg-summary-2' of https://github.com/j-diefenbach/pokerogue_tinylad-fork into egg-summary-2
This commit is contained in:
commit
aaec973af3
@ -2732,6 +2732,28 @@ export default class BattleScene extends SceneBase {
|
||||
(window as any).gameInfo = gameInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function retrieves the sprite and audio keys for active Pokemon.
|
||||
* Active Pokemon include both enemy and player Pokemon of the current wave.
|
||||
* @returns a string array of active sprite and audio keys that should not be deleted
|
||||
*/
|
||||
getActiveKeys(): string[] {
|
||||
const keys: string[] = [];
|
||||
const playerParty = this.getParty();
|
||||
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));
|
||||
});
|
||||
// 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));
|
||||
});
|
||||
return keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialized the 2nd phase of the final boss (e.g. form-change for Eternatus)
|
||||
* @param pokemon The (enemy) pokemon
|
||||
|
@ -94,10 +94,26 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
|
||||
// this.currentPokemonSprite.setVisible(false);
|
||||
// this.pokemonEggMovesContainer.setVisible(false);
|
||||
this.getUi().hideTooltip();
|
||||
// TODO clear EggHatchData
|
||||
// TODO back sprites and extra sprites etc.
|
||||
const activeKeys = this.scene.getActiveKeys();
|
||||
// Removing unnecessary sprites from animation manager
|
||||
const animKeys = Object.keys(this.scene.anims["anims"]["entries"]);
|
||||
animKeys.forEach(key => {
|
||||
if (key.startsWith("pkmn__") && !activeKeys.includes(key)) {
|
||||
this.scene.anims.remove(key);
|
||||
}
|
||||
});
|
||||
// Removing unnecessary cries from audio cache
|
||||
const audioKeys = Object.keys(this.scene.cache.audio.entries.entries);
|
||||
audioKeys.forEach(key => {
|
||||
if (key.startsWith("cry/") && !activeKeys.includes(key)) {
|
||||
delete this.scene.cache.audio.entries.entries[key];
|
||||
}
|
||||
});
|
||||
// Clears eggHatchData in EggSummaryUiHandler
|
||||
this.eggHatchData.length = 0;
|
||||
// Removes Pokemon icons in EggSummaryUiHandler
|
||||
this.iconAnimHandler.removeAll();
|
||||
console.log("Egg Summary Handler cleared");
|
||||
|
||||
}
|
||||
|
||||
show(args: any[]): boolean {
|
||||
|
Loading…
Reference in New Issue
Block a user