From b29ee1be5eea926c46b03b1766d294d67f1e57dc Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 8 Dec 2023 09:51:45 -0500 Subject: [PATCH] Allow for null user in end of move effect phase --- src/battle-phases.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/battle-phases.ts b/src/battle-phases.ts index fc710c90800..74cba4b6a65 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -1739,12 +1739,14 @@ export class MoveEffectPhase extends PokemonPhase { end() { const user = this.getUserPokemon(); - if (--user.turnData.hitsLeft >= 1 && this.getTarget()?.isActive()) - this.scene.unshiftPhase(this.getNewHitPhase()); - else { - if (user.turnData.hitCount - Math.max(user.turnData.hitsLeft, 0) > 1) - this.scene.queueMessage(`Hit ${user.turnData.hitCount} time(s)!`); - this.scene.applyModifiers(HitHealModifier, this.player, user); + if (user) { + if (--user.turnData.hitsLeft >= 1 && this.getTarget()?.isActive()) + this.scene.unshiftPhase(this.getNewHitPhase()); + else { + if (user.turnData.hitCount - Math.max(user.turnData.hitsLeft, 0) > 1) + this.scene.queueMessage(`Hit ${user.turnData.hitCount} time(s)!`); + this.scene.applyModifiers(HitHealModifier, this.player, user); + } } super.end();