Update postWeatherChange

This commit is contained in:
Dean 2025-02-01 22:55:46 -08:00
parent 578052bdb0
commit 25965b34c0

View File

@ -3453,6 +3453,10 @@ export class PostWeatherLapseAbAttr extends AbAttr {
this.weatherTypes = weatherTypes;
}
willSucceedPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather | null, args: any[]): boolean {
return true;
}
applyPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather | null, args: any[]): boolean | Promise<boolean> {
return false;
}
@ -3471,8 +3475,11 @@ export class PostWeatherLapseHealAbAttr extends PostWeatherLapseAbAttr {
this.healFactor = healFactor;
}
willSucceedPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather | null, args: any[]): boolean {
return !pokemon.isFullHp();
}
applyPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather, args: any[]): boolean {
if (!pokemon.isFullHp()) {
const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name;
if (!simulated) {
globalScene.unshiftPhase(new PokemonHealPhase(pokemon.getBattlerIndex(),
@ -3480,9 +3487,6 @@ export class PostWeatherLapseHealAbAttr extends PostWeatherLapseAbAttr {
}
return true;
}
return false;
}
}
export class PostWeatherLapseDamageAbAttr extends PostWeatherLapseAbAttr {
@ -3494,11 +3498,11 @@ export class PostWeatherLapseDamageAbAttr extends PostWeatherLapseAbAttr {
this.damageFactor = damageFactor;
}
applyPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather, args: any[]): boolean {
if (pokemon.hasAbilityWithAttr(BlockNonDirectDamageAbAttr)) {
return false;
willSucceedPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather | null, args: any[]): boolean {
return !pokemon.hasAbilityWithAttr(BlockNonDirectDamageAbAttr);
}
applyPostWeatherLapse(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: Weather, args: any[]): boolean {
if (!simulated) {
const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name;
globalScene.queueMessage(i18next.t("abilityTriggers:postWeatherLapseDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName }));
@ -5384,7 +5388,8 @@ export function applyPostWeatherChangeAbAttrs(attrType: Constructor<PostWeatherC
export function applyPostWeatherLapseAbAttrs(attrType: Constructor<PostWeatherLapseAbAttr>,
pokemon: Pokemon, weather: Weather | null, simulated: boolean = false, ...args: any[]): Promise<void> {
return applyAbAttrsInternal<PostWeatherLapseAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostWeatherLapse(pokemon, passive, simulated, weather, args), args, false, simulated);
return applyAbAttrsInternal<PostWeatherLapseAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostWeatherLapse(pokemon, passive, simulated, weather, args),
(attr, passive) => attr.willSucceedPostWeatherLapse(pokemon, passive, simulated, weather, args), args, false, simulated);
}
export function applyPostTerrainChangeAbAttrs(attrType: Constructor<PostTerrainChangeAbAttr>,