code cleanup

This commit is contained in:
James Diefenbach 2024-09-02 09:25:26 +10:00
parent f5a46d9f26
commit 24687c352c
4 changed files with 14 additions and 23 deletions

View File

@ -359,7 +359,6 @@ export class EggHatchPhase extends Phase {
}); });
}); });
}, null, true, 3000); }, null, true, 3000);
//this.scene.time.delayedCall(Utils.fixedInt(4250), () => this.scene.playBgm());
}); });
}); });
this.scene.tweens.add({ this.scene.tweens.add({

View File

@ -91,7 +91,6 @@ export class EggLapsePhase extends Phase {
} }
this.loadsWaiting--; this.loadsWaiting--;
if (this.loadsWaiting === 0) { if (this.loadsWaiting === 0) {
console.timeEnd("hatch eggs"); console.timeEnd("hatch eggs");
} }

View File

@ -1627,14 +1627,13 @@ export class GameData {
}; };
if (newCatch && speciesStarters.hasOwnProperty(species.speciesId)) { if (newCatch && speciesStarters.hasOwnProperty(species.speciesId)) {
if (showMessage) { if (!showMessage) {
this.scene.playSound("level_up_fanfare");
console.log(`${species.name} has been\nadded as a starter!`);
this.scene.ui.showText(i18next.t("battle:addedAsAStarter", { pokemonName: species.name }), null, () => checkPrevolution(), null, true);
console.log("show text passed");
} else {
resolve(); resolve();
return;
} }
this.scene.playSound("level_up_fanfare");
console.log(`${species.name} has been\nadded as a starter!`);
this.scene.ui.showText(i18next.t("battle:addedAsAStarter", { pokemonName: species.name }), null, () => checkPrevolution(), null, true);
} else { } else {
checkPrevolution(); checkPrevolution();
} }
@ -1698,16 +1697,15 @@ export class GameData {
} }
this.starterData[speciesId].eggMoves |= value; this.starterData[speciesId].eggMoves |= value;
if (!showMessage) {
if (showMessage) {
this.scene.playSound("level_up_fanfare");
const moveName = allMoves[speciesEggMoves[speciesId][eggMoveIndex]].name;
this.scene.ui.showText(eggMoveIndex === 3 ? i18next.t("egg:rareEggMoveUnlock", { moveName: moveName }) : i18next.t("egg:eggMoveUnlock", { moveName: moveName }), null, (() => {
resolve(true);
}), null, true);
} else {
resolve(true); resolve(true);
return;
} }
this.scene.playSound("level_up_fanfare");
const moveName = allMoves[speciesEggMoves[speciesId][eggMoveIndex]].name;
this.scene.ui.showText(eggMoveIndex === 3 ? i18next.t("egg:rareEggMoveUnlock", { moveName: moveName }) : i18next.t("egg:eggMoveUnlock", { moveName: moveName }), null, (() => {
resolve(true);
}), null, true);
}); });
} }

View File

@ -21,14 +21,11 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
private pokemonListContainer: Phaser.GameObjects.Container; private pokemonListContainer: Phaser.GameObjects.Container;
private pokemonIconSpritesContainer: Phaser.GameObjects.Container; private pokemonIconSpritesContainer: Phaser.GameObjects.Container;
private pokemonIconsContainer: Phaser.GameObjects.Container; private pokemonIconsContainer: Phaser.GameObjects.Container;
private eggListMessageBoxContainer: Phaser.GameObjects.Container;
private eggHatchContainer: Phaser.GameObjects.Container; private eggHatchContainer: Phaser.GameObjects.Container;
private eggHatchBg: Phaser.GameObjects.Image; private eggHatchBg: Phaser.GameObjects.Image;
private infoContainer: PokemonHatchInfoContainer; private infoContainer: PokemonHatchInfoContainer;
private cursorObj: Phaser.GameObjects.Image; private cursorObj: Phaser.GameObjects.Image;
private iconAnimHandler: PokemonIconAnimHandler; private iconAnimHandler: PokemonIconAnimHandler;
@ -91,9 +88,9 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
this.pokemonIconSpritesContainer.removeAll(true); this.pokemonIconSpritesContainer.removeAll(true);
this.pokemonIconsContainer.removeAll(true); this.pokemonIconsContainer.removeAll(true);
this.eggHatchBg.setVisible(false); this.eggHatchBg.setVisible(false);
// this.currentPokemonSprite.setVisible(false);
// this.pokemonEggMovesContainer.setVisible(false);
this.getUi().hideTooltip(); this.getUi().hideTooltip();
const activeKeys = this.scene.getActiveKeys(); const activeKeys = this.scene.getActiveKeys();
// Removing unnecessary sprites from animation manager // Removing unnecessary sprites from animation manager
const animKeys = Object.keys(this.scene.anims["anims"]["entries"]); const animKeys = Object.keys(this.scene.anims["anims"]["entries"]);
@ -125,7 +122,6 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
if (args.length >= 1) { if (args.length >= 1) {
// this.pokemonHatched = args[0];
this.eggHatchData = args[0].sort(function sortHatchData(a: EggHatchData, b: EggHatchData) { this.eggHatchData = args[0].sort(function sortHatchData(a: EggHatchData, b: EggHatchData) {
const speciesA = a.pokemon.species; const speciesA = a.pokemon.species;
const speciesB = b.pokemon.species; const speciesB = b.pokemon.species;
@ -146,7 +142,6 @@ export default class EggSummaryUiHandler extends MessageUiHandler {
); );
} }
// this.pokemonHatched = [];
this.getUi().bringToTop(this.pokemonListContainer); this.getUi().bringToTop(this.pokemonListContainer);