Allow for null user in end of move effect phase

This commit is contained in:
Flashfyre 2023-12-08 09:51:45 -05:00
parent 5441ecbd73
commit b29ee1be5e
1 changed files with 8 additions and 6 deletions

View File

@ -1739,12 +1739,14 @@ export class MoveEffectPhase extends PokemonPhase {
end() { end() {
const user = this.getUserPokemon(); const user = this.getUserPokemon();
if (--user.turnData.hitsLeft >= 1 && this.getTarget()?.isActive()) if (user) {
this.scene.unshiftPhase(this.getNewHitPhase()); if (--user.turnData.hitsLeft >= 1 && this.getTarget()?.isActive())
else { this.scene.unshiftPhase(this.getNewHitPhase());
if (user.turnData.hitCount - Math.max(user.turnData.hitsLeft, 0) > 1) else {
this.scene.queueMessage(`Hit ${user.turnData.hitCount} time(s)!`); if (user.turnData.hitCount - Math.max(user.turnData.hitsLeft, 0) > 1)
this.scene.applyModifiers(HitHealModifier, this.player, user); this.scene.queueMessage(`Hit ${user.turnData.hitCount} time(s)!`);
this.scene.applyModifiers(HitHealModifier, this.player, user);
}
} }
super.end(); super.end();