diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index d89f9f879d1..a5e1fc2ccd2 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -822,7 +822,7 @@ export class DrowsyTag extends BattlerTag { } canAdd(pokemon: Pokemon): boolean { - const isElectricTerrainProtected = pokemon.scene.arena.terrain?.terrainType === TerrainType.ELECTRIC && !pokemon.isGrounded(); + const isElectricTerrainProtected = (pokemon.scene.arena.terrain?.terrainType === TerrainType.ELECTRIC && pokemon.isGrounded()); if (isElectricTerrainProtected) { pokemon.scene.queueMessage(i18next.t("terrain:defaultBlockMessage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), terrainName: getTerrainName(TerrainType.ELECTRIC) })); } diff --git a/src/data/move.ts b/src/data/move.ts index fa5433b1199..1d6d1e9ee3e 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1954,12 +1954,8 @@ export class StatusEffectAttr extends MoveEffectAttr { } } - if (!pokemon.status || (pokemon.status.effect === this.effect && moveChance < 0)) { - pokemon.checkIfCanSetStatus(this.effect, false, false, user); - } - if ((!pokemon.status || (pokemon.status.effect === this.effect && moveChance < 0)) - && pokemon.trySetStatus(this.effect, true, user, this.cureTurn)) { + && pokemon.checkIfCanSetStatus(this.effect, false, false, user) && pokemon.trySetStatus(this.effect, true, user, this.cureTurn)) { applyPostAttackAbAttrs(ConfusionOnStatusEffectAbAttr, user, target, move, null, false, this.effect); return true; } diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index f8b24c7ee41..d23bdc8c92c 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2742,7 +2742,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return this.gender !== Gender.GENDERLESS && pokemon.gender === (this.gender === Gender.MALE ? Gender.FEMALE : Gender.MALE); } - // This function only checks if it is possible to set status. If will not apply anything or do anything, just check if possible. + /** + * Checks if it is possible for a pokemon to be afflicted with the given status + * @param effect {@linkcode StatusEffect} the status effect being checked. + * @param quiet a boolean value determining whether or not to show messages. + * @param overrideStatus a boolean value to determine whether a status should be overriden. If true, the pokemon cannot be statused essentially + * @param sourcePokemon {@linkcode Pokemon} The pokemon causing the status. The target pokemon is 'this'. + * @returns true if the pokemon can be affected by the status, false if not. + */ checkIfCanSetStatus(effect: StatusEffect | undefined, quiet: boolean = false, overrideStatus: boolean = false, sourcePokemon: Pokemon | null = null): boolean { if (effect !== StatusEffect.FAINT) { if (overrideStatus ? this.status?.effect === effect : this.status) { @@ -2807,12 +2814,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } break; } - - return true; } - + /** + * Checks if it is possible for a pokemon to be afflicted with the given status + * @param effect {@linkcode StatusEffect} the status effect being checked. + * @param quiet a boolean value that is sometimes used as the asPhase boolean which causes unshifting the phase. + * @param overrideStatus a boolean value to determine whether a status should be overriden. If true, the pokemon cannot be statused essentially + * @param sourcePokemon {@linkcode Pokemon} The pokemon causing the status. The target pokemon is 'this'. + * @returns true if the pokemon can be affected by the status, false if not. + */ canSetStatus(effect: StatusEffect | undefined, quiet: boolean = false, overrideStatus: boolean = false, sourcePokemon: Pokemon | null = null): boolean { const checker = this.checkIfCanSetStatus(effect, quiet, overrideStatus, sourcePokemon);