From e7c53827f7e51ed47371c5494377bd52d010b203 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Thu, 2 May 2024 00:55:42 -0700 Subject: [PATCH] Fixed a bug where a yawned target in a semi-vulnerable state would be stuck in that state --- src/field/pokemon.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index a966a24303f..4a9d13b4778 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1893,6 +1893,21 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { applyAbAttrs(ReduceStatusEffectDurationAbAttr, this, null, effect, statusCureTurn); this.setFrameRate(4); + + // If the user is invulnerable, lets remove their invulnerability when they fall asleep + const invulnerableTags = [ + BattlerTagType.UNDERGROUND, + BattlerTagType.UNDERWATER, + BattlerTagType.HIDDEN, + BattlerTagType.FLYING + ]; + + const tag = invulnerableTags.find((t) => this.getTag(t)); + + if (tag) { + this.removeTag(tag); + this.getMoveQueue().pop(); + } } this.status = new Status(effect, 0, statusCureTurn?.value);