From c710f85fd3bb133a814207fecc6bbd0f04d0ce62 Mon Sep 17 00:00:00 2001 From: innerthunder <168692175+innerthunder@users.noreply.github.com> Date: Sun, 8 Sep 2024 23:19:59 -0700 Subject: [PATCH] Fix `Pokemon.isTrapped` only checking enemy Pokemon for trapping abilities (#4124) --- src/field/pokemon.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index e2f238e29af..a1305b6b1b2 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1324,9 +1324,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } const trappedByAbility = new Utils.BooleanHolder(false); + const opposingField = this.isPlayer() ? this.scene.getEnemyField() : this.scene.getPlayerField(); - this.scene.getEnemyField()!.forEach(enemyPokemon => - applyCheckTrappedAbAttrs(CheckTrappedAbAttr, enemyPokemon, trappedByAbility, this, trappedAbMessages, simulated) + opposingField.forEach(opponent => + applyCheckTrappedAbAttrs(CheckTrappedAbAttr, opponent, trappedByAbility, this, trappedAbMessages, simulated) ); return (trappedByAbility.value || !!this.getTag(TrappedTag));