This commit is contained in:
Jesse Chung 2024-09-01 23:51:21 -04:00
parent 8c6862e6e4
commit 29b1a6fe51
2 changed files with 9 additions and 10 deletions

View File

@ -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;
}

View File

@ -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);