mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-20 16:42:45 +02:00
format with biome and remove cancelled from weather lapse
This commit is contained in:
parent
f432f8cbf6
commit
ef9a410920
@ -4360,6 +4360,7 @@ export class PostWeatherChangeAddBattlerTagAttr extends PostWeatherChangeAbAttr
|
||||
}
|
||||
}
|
||||
|
||||
export type PostWeatherLapseAbAttrParams = Omit<PreWeatherEffectAbAttrParams, "cancelled">;
|
||||
export class PostWeatherLapseAbAttr extends AbAttr {
|
||||
protected weatherTypes: WeatherType[];
|
||||
|
||||
@ -4369,11 +4370,11 @@ export class PostWeatherLapseAbAttr extends AbAttr {
|
||||
this.weatherTypes = weatherTypes;
|
||||
}
|
||||
|
||||
canApply(_params: Closed<PreWeatherEffectAbAttrParams>): boolean {
|
||||
canApply(_params: Closed<PostWeatherLapseAbAttrParams>): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
apply(_params: Closed<PreWeatherEffectAbAttrParams>): void {}
|
||||
apply(_params: Closed<PostWeatherLapseAbAttrParams>): 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(
|
||||
|
@ -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 });
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user