From ef9a410920df74b9d82df66ba29607ea1e0509dc Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Tue, 17 Jun 2025 11:08:25 -0500 Subject: [PATCH] format with biome and remove cancelled from weather lapse --- src/data/abilities/ability.ts | 13 +++++++------ src/phases/weather-effect-phase.ts | 14 +++++--------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index ede114236d6..2dd8c2964db 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -4360,6 +4360,7 @@ export class PostWeatherChangeAddBattlerTagAttr extends PostWeatherChangeAbAttr } } +export type PostWeatherLapseAbAttrParams = Omit; export class PostWeatherLapseAbAttr extends AbAttr { protected weatherTypes: WeatherType[]; @@ -4369,11 +4370,11 @@ export class PostWeatherLapseAbAttr extends AbAttr { this.weatherTypes = weatherTypes; } - canApply(_params: Closed): boolean { + canApply(_params: Closed): boolean { return true; } - apply(_params: Closed): void {} + apply(_params: Closed): void {} getCondition(): AbAttrCondition { return getWeatherCondition(...this.weatherTypes); @@ -4389,11 +4390,11 @@ export class PostWeatherLapseHealAbAttr extends PostWeatherLapseAbAttr { this.healFactor = healFactor; } - override canApply({ pokemon }: AbAttrBaseParams): boolean { + override canApply({ pokemon }: PostWeatherLapseAbAttrParams): boolean { return !pokemon.isFullHp(); } - override apply({ pokemon, passive, simulated }: PreWeatherEffectAbAttrParams): void { + override apply({ pokemon, passive, simulated }: PostWeatherLapseAbAttrParams): void { const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name; if (!simulated) { globalScene.phaseManager.unshiftNew( @@ -4419,11 +4420,11 @@ export class PostWeatherLapseDamageAbAttr extends PostWeatherLapseAbAttr { this.damageFactor = damageFactor; } - override canApply({ pokemon }: PreWeatherEffectAbAttrParams): boolean { + override canApply({ pokemon }: PostWeatherLapseAbAttrParams): boolean { return !pokemon.hasAbilityWithAttr("BlockNonDirectDamageAbAttr"); } - override apply({ simulated, pokemon, passive }: PreWeatherEffectAbAttrParams): void { + override apply({ simulated, pokemon, passive }: PostWeatherLapseAbAttrParams): void { if (!simulated) { const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name; globalScene.phaseManager.queueMessage( diff --git a/src/phases/weather-effect-phase.ts b/src/phases/weather-effect-phase.ts index d9239220376..5476ac67672 100644 --- a/src/phases/weather-effect-phase.ts +++ b/src/phases/weather-effect-phase.ts @@ -1,9 +1,5 @@ import { globalScene } from "#app/global-scene"; -import { - applyPreWeatherEffectAbAttrs, - applyAbAttrs, - applyPostWeatherLapseAbAttrs, -} from "#app/data/abilities/apply-ab-attrs"; +import { applyAbAttrs } from "#app/data/abilities/apply-ab-attrs"; import { CommonAnim } from "#enums/move-anims-common"; import type { Weather } from "#app/data/weather"; import { getWeatherDamageMessage, getWeatherLapseMessage } from "#app/data/weather"; @@ -41,15 +37,15 @@ export class WeatherEffectPhase extends CommonAnimPhase { const cancelled = new BooleanHolder(false); this.executeForAll((pokemon: Pokemon) => - applyPreWeatherEffectAbAttrs("SuppressWeatherEffectAbAttr", pokemon, this.weather, cancelled), + applyAbAttrs("SuppressWeatherEffectAbAttr", { pokemon, weather: this.weather, cancelled }), ); if (!cancelled.value) { const inflictDamage = (pokemon: Pokemon) => { const cancelled = new BooleanHolder(false); - applyPreWeatherEffectAbAttrs("PreWeatherDamageAbAttr", pokemon, this.weather, cancelled); - applyAbAttrs("BlockNonDirectDamageAbAttr", pokemon, cancelled); + applyAbAttrs("PreWeatherDamageAbAttr", { pokemon, weather: this.weather, cancelled }); + applyAbAttrs("BlockNonDirectDamageAbAttr", { pokemon, cancelled }); if ( cancelled.value || @@ -80,7 +76,7 @@ export class WeatherEffectPhase extends CommonAnimPhase { globalScene.ui.showText(getWeatherLapseMessage(this.weather.weatherType) ?? "", null, () => { this.executeForAll((pokemon: Pokemon) => { if (!pokemon.switchOutStatus) { - applyPostWeatherLapseAbAttrs("PostWeatherLapseAbAttr", pokemon, this.weather); + applyAbAttrs("PostWeatherLapseAbAttr", { pokemon, weather: this.weather }); } });