diff --git a/src/data/ability.ts b/src/data/ability.ts index 40c3d1e5a85..ff183a28432 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2356,7 +2356,7 @@ export class IncreasePpAbAttr extends AbAttr { } export class ForceSwitchOutImmunityAbAttr extends AbAttr { apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean { - pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` can't be switched out!`)) + cancelled.value = true; return true; } } diff --git a/src/data/move.ts b/src/data/move.ts index d303bea6d35..a268992ac7b 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -327,10 +327,12 @@ export default class Move implements Localizable { } getFailedText(user: Pokemon, target: Pokemon, move: Move, cancelled: Utils.BooleanHolder): string | null { - let failedText = null; - for (let attr of this.attrs) - failedText = attr.getFailedText(user, target, move, cancelled); - return failedText; + for (let attr of this.attrs) { + let failedText = attr.getFailedText(user, target, move, cancelled); + if (failedText !== null) + return failedText; + } + return null; } getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer { @@ -3035,8 +3037,9 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { } getFailedText(user: Pokemon, target: Pokemon, move: Move, cancelled: Utils.BooleanHolder): string | null { - applyAbAttrs(ForceSwitchOutImmunityAbAttr, target, cancelled); - return null; + const blockedByAbility = new Utils.BooleanHolder(false); + applyAbAttrs(ForceSwitchOutImmunityAbAttr, target, blockedByAbility); + return blockedByAbility.value ? getPokemonMessage(target, ` can't be switched out!`) : null; } getSwitchOutCondition(): MoveConditionFunc { diff --git a/src/phases.ts b/src/phases.ts index cc493ce980a..6e329bda650 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2278,7 +2278,7 @@ export class MovePhase extends BattlePhase { // Assume conditions affecting targets only apply to moves with a single target let success = this.move.getMove().applyConditions(this.pokemon, targets[0], this.move.getMove()); - let cancelled = new Utils.BooleanHolder(true); + let cancelled = new Utils.BooleanHolder(false); let failedText = this.move.getMove().getFailedText(this.pokemon, targets[0], this.move.getMove(), cancelled); if (success && this.scene.arena.isMoveWeatherCancelled(this.move.getMove())) success = false;