From 5a096a799475b14ed475b7c20ff26d2c267097ef Mon Sep 17 00:00:00 2001 From: innerthunder Date: Mon, 9 Dec 2024 00:31:28 -0800 Subject: [PATCH] Apply suggestions from Kev's review --- src/data/move.ts | 8 +++---- src/phases/game-over-modifier-reward-phase.ts | 22 ++++++++++++------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index aa593001c54..f9238b50340 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -3335,7 +3335,7 @@ export class CutHpStatStageBoostAttr extends StatStageChangeAttr { override apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { user.damageAndUpdate(Utils.toDmgValue(user.getMaxHp() / this.cutRatio), HitResult.OTHER, false, true); - user.updateInfo(); // TODO: This is a Promise and might cause desync issues + user.updateInfo(); const ret = super.apply(user, target, move, args); if (this.messageCallback) { this.messageCallback(user); @@ -3452,7 +3452,7 @@ export class ResetStatsAttr extends MoveEffectAttr { for (const s of BATTLE_STATS) { pokemon.setStatStage(s, 0); } - pokemon.updateInfo(); // TODO: This is still a Promise and might cause desync issues + pokemon.updateInfo(); } } @@ -3526,7 +3526,7 @@ export class HpSplitAttr extends MoveEffectAttr { globalScene.damageNumberHandler.add(p, damage); } } - p.updateInfo(); // TODO: This is still a Promise + p.updateInfo(); }); return true; @@ -6016,7 +6016,7 @@ export class RevivalBlessingAttr extends MoveEffectAttr { */ override apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { // If user is player, checks if the user has fainted pokemon - if (user instanceof PlayerPokemon && globalScene.getPlayerParty().findIndex((p) => p.isFainted()) > -1) { + if (user instanceof PlayerPokemon) { globalScene.unshiftPhase(new RevivalBlessingPhase(user)); return true; } else if (user instanceof EnemyPokemon && user.hasTrainer() && globalScene.getEnemyParty().findIndex((p) => p.isFainted() && !p.isBoss()) > -1) { diff --git a/src/phases/game-over-modifier-reward-phase.ts b/src/phases/game-over-modifier-reward-phase.ts index c98bb5fff04..93f53bf38c0 100644 --- a/src/phases/game-over-modifier-reward-phase.ts +++ b/src/phases/game-over-modifier-reward-phase.ts @@ -12,16 +12,22 @@ export class GameOverModifierRewardPhase extends ModifierRewardPhase { doReward(): Promise { return new Promise(resolve => { const newModifier = this.modifierType.newModifier(); - globalScene.addModifier(newModifier).then(() => { - // Sound loaded into game as is - globalScene.playSound("level_up_fanfare"); - globalScene.ui.setMode(Mode.MESSAGE); - globalScene.ui.fadeIn(250).then(() => { - globalScene.ui.showText(i18next.t("battle:rewardGain", { modifierName: newModifier?.type.name }), null, () => { + globalScene.addModifier(newModifier); + // Sound loaded into game as is + globalScene.playSound("level_up_fanfare"); + globalScene.ui.setMode(Mode.MESSAGE); + globalScene.ui.fadeIn(250).then(() => { + globalScene.ui.showText( + i18next.t("battle:rewardGain", { modifierName: newModifier?.type.name }), + null, + () => { globalScene.time.delayedCall(1500, () => globalScene.arenaBg.setVisible(true)); resolve(); - }, null, true, 1500); - }); + }, + null, + true, + 1500, + ); }); }); }