From 29b1a6fe51c74372026e7b8403b185f46d46dbf1 Mon Sep 17 00:00:00 2001 From: Jesse Chung Date: Sun, 1 Sep 2024 23:51:21 -0400 Subject: [PATCH] Done --- src/data/move.ts | 2 +- src/field/pokemon.ts | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 4efdf74cb30..504794f4d8e 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1955,7 +1955,7 @@ export class StatusEffectAttr extends MoveEffectAttr { } 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 fa50c048578..15937774dba 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2788,7 +2788,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) { @@ -2864,14 +2871,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { * @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); - - - return true; - } - - canSetStatus(effect: StatusEffect | undefined, quiet: boolean = false, overrideStatus: boolean = false, sourcePokemon: Pokemon | null = null): boolean { const checker = this.checkIfCanSetStatus(effect, quiet, overrideStatus, sourcePokemon);