Fix `Pokemon.isTrapped` only checking enemy Pokemon for trapping abilities (#4124)

This commit is contained in:
innerthunder 2024-09-08 23:19:59 -07:00 committed by GitHub
parent 39b6a72517
commit c710f85fd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

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