From 64025954d627ac32ceace35a0547484613b9b334 Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Sat, 8 Feb 2025 22:48:35 -0600 Subject: [PATCH] Add back applyPreLeaveFieldAttrs Attribute was removed due to absence in a cherry-pick --- src/data/ability.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 0eaa0acbefb..465108ba6e3 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2841,7 +2841,7 @@ export class PreSwitchOutFormChangeAbAttr extends PreSwitchOutAbAttr { } export class PreLeaveFieldAbAttr extends AbAttr { - applyPreLeaveField(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean | Promise { + applyPreLeaveField(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean { return false; } } @@ -2856,7 +2856,7 @@ export class PreLeaveFieldClearWeatherAbAttr extends PreLeaveFieldAbAttr { * @param args N/A * @returns Returns `true` if the weather clears, otherwise `false`. */ - applyPreLeaveField(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean | Promise { + applyPreLeaveField(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean { const weatherType = globalScene.arena.weather?.weatherType; let turnOffWeather = false; @@ -5646,6 +5646,23 @@ export function applyPreSwitchOutAbAttrs( ); } +export function applyPreLeaveFieldAbAttrs( + attrType: Constructor, + pokemon: Pokemon, + simulated: boolean = false, + ...args: any[] +): void { + return applyAbAttrsInternal( + attrType, + pokemon, + (attr, passive) => + attr.applyPreLeaveField(pokemon, passive, simulated, args), + args, + true, + simulated + ); +} + export function applyPreStatStageChangeAbAttrs( attrType: Constructor, pokemon: Pokemon | null,