diff --git a/src/data/status-effect.ts b/src/data/status-effect.ts index 828c52cae13..4381db5c2c6 100644 --- a/src/data/status-effect.ts +++ b/src/data/status-effect.ts @@ -115,11 +115,11 @@ export function getRandomStatusEffect(statusEffectA: StatusEffect, statusEffectB * @param statusA The first Status * @param statusB The second Status */ -export function getRandomStatus(statusA: Status, statusB: Status): Status { - if (statusA === undefined || statusA.effect === StatusEffect.NONE || statusA.effect === StatusEffect.FAINT) { +export function getRandomStatus(statusA: Status | null, statusB: Status | null): Status | null { + if (!statusA || statusA.effect === StatusEffect.NONE || statusA.effect === StatusEffect.FAINT) { return statusB; } - if (statusB === undefined || statusB.effect === StatusEffect.NONE || statusB.effect === StatusEffect.FAINT) { + if (!statusB || statusB.effect === StatusEffect.NONE || statusB.effect === StatusEffect.FAINT) { return statusA; } diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index bf9cc6db42a..b4461c21354 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -3614,7 +3614,7 @@ export class PlayerPokemon extends Pokemon { if (!this.isFainted()) { // If this Pokemon hasn't fainted, make sure the HP wasn't set over the new maximum this.hp = Math.min(this.hp, this.stats[Stat.HP]); - this.status = getRandomStatus(this.status!, pokemon.status!); // Get a random valid status between the two // TODO: are the bangs correct? + this.status = getRandomStatus(this.status, pokemon.status); // Get a random valid status between the two } else if (!pokemon.isFainted()) { // If this Pokemon fainted but the other hasn't, make sure the HP wasn't set to zero this.hp = Math.max(this.hp, 1);