[Refactor] Remove unused PreSwitchOutClearWeatherAbAttr class

https://github.com/pagefaultgames/pokerogue/pull/6809
This commit is contained in:
Bertie690 2025-11-30 16:25:44 -05:00 committed by GitHub
parent 03cc0b1af2
commit cce1653b70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3361,6 +3361,7 @@ export class CommanderAbAttr extends AbAttr {
/**
* Base class for ability attributes that apply their effect when their user switches out.
*/
// TODO: Clarify the differences between this and `PreLeaveFieldAbAttr`
export abstract class PreSwitchOutAbAttr extends AbAttr {
constructor(showAbility = true) {
super(showAbility);
@ -3393,65 +3394,6 @@ export class PreSwitchOutResetStatusAbAttr extends PreSwitchOutAbAttr {
}
}
/**
* Clears Desolate Land/Primordial Sea/Delta Stream upon the Pokemon switching out.
*/
export class PreSwitchOutClearWeatherAbAttr extends PreSwitchOutAbAttr {
override apply({ pokemon, simulated }: AbAttrBaseParams): boolean {
// TODO: Evaluate why this is returning a boolean rather than relay
const weatherType = globalScene.arena.weather?.weatherType;
let turnOffWeather = false;
// Clear weather only if user's ability matches the weather and no other pokemon has the ability.
switch (weatherType) {
case WeatherType.HARSH_SUN:
if (
pokemon.hasAbility(AbilityId.DESOLATE_LAND)
&& globalScene
.getField(true)
.filter(p => p !== pokemon)
.filter(p => p.hasAbility(AbilityId.DESOLATE_LAND)).length === 0
) {
turnOffWeather = true;
}
break;
case WeatherType.HEAVY_RAIN:
if (
pokemon.hasAbility(AbilityId.PRIMORDIAL_SEA)
&& globalScene
.getField(true)
.filter(p => p !== pokemon)
.filter(p => p.hasAbility(AbilityId.PRIMORDIAL_SEA)).length === 0
) {
turnOffWeather = true;
}
break;
case WeatherType.STRONG_WINDS:
if (
pokemon.hasAbility(AbilityId.DELTA_STREAM)
&& globalScene
.getField(true)
.filter(p => p !== pokemon)
.filter(p => p.hasAbility(AbilityId.DELTA_STREAM)).length === 0
) {
turnOffWeather = true;
}
break;
}
if (simulated) {
return turnOffWeather;
}
if (turnOffWeather) {
globalScene.arena.trySetWeather(WeatherType.NONE);
return true;
}
return false;
}
}
export class PreSwitchOutHealAbAttr extends PreSwitchOutAbAttr {
override canApply({ pokemon }: AbAttrBaseParams): boolean {
return !pokemon.isFullHp();
@ -6730,7 +6672,6 @@ const AbilityAttrs = Object.freeze({
CommanderAbAttr,
PreSwitchOutAbAttr,
PreSwitchOutResetStatusAbAttr,
PreSwitchOutClearWeatherAbAttr,
PreSwitchOutHealAbAttr,
PreSwitchOutFormChangeAbAttr,
PreLeaveFieldAbAttr,