more isTrapped cleanup

This commit is contained in:
innerthunder 2024-08-31 00:40:13 -07:00
parent cdd1a274e2
commit b1fd71fdf5

View File

@ -1218,16 +1218,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* @param simulated `boolean` if `true`, applies abilities via simulated calls. * @param simulated `boolean` if `true`, applies abilities via simulated calls.
* @returns * @returns
*/ */
isTrapped(trappedAbMessages?: string[], simulated: boolean = true): boolean { isTrapped(trappedAbMessages: string[] = [], simulated: boolean = true): boolean {
if (this.isOfType(Type.GHOST)) { if (this.isOfType(Type.GHOST)) {
return false; return false;
} }
const trappedMessages = trappedAbMessages ?? [];
const trappedByAbility = new Utils.BooleanHolder(false); const trappedByAbility = new Utils.BooleanHolder(false);
this.scene.getEnemyField()!.forEach(enemyPokemon => this.scene.getEnemyField()!.forEach(enemyPokemon =>
applyCheckTrappedAbAttrs(CheckTrappedAbAttr, enemyPokemon, trappedByAbility, this, trappedMessages, simulated) applyCheckTrappedAbAttrs(CheckTrappedAbAttr, enemyPokemon, trappedByAbility, this, trappedAbMessages, simulated)
); );
return (trappedByAbility.value || !!this.getTag(TrappedTag)); return (trappedByAbility.value || !!this.getTag(TrappedTag));