mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-15 06:15:20 +01:00
[Refactor] Remove unused PreSwitchOutClearWeatherAbAttr class
https://github.com/pagefaultgames/pokerogue/pull/6809
This commit is contained in:
parent
03cc0b1af2
commit
cce1653b70
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user