mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +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 {
|
export class PostWeatherLapseAbAttr extends AbAttr {
|
||||||
protected weatherTypes: WeatherType[];
|
protected weatherTypes: WeatherType[];
|
||||||
|
|
||||||
@ -4369,11 +4370,11 @@ export class PostWeatherLapseAbAttr extends AbAttr {
|
|||||||
this.weatherTypes = weatherTypes;
|
this.weatherTypes = weatherTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
canApply(_params: Closed<PreWeatherEffectAbAttrParams>): boolean {
|
canApply(_params: Closed<PostWeatherLapseAbAttrParams>): boolean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(_params: Closed<PreWeatherEffectAbAttrParams>): void {}
|
apply(_params: Closed<PostWeatherLapseAbAttrParams>): void {}
|
||||||
|
|
||||||
getCondition(): AbAttrCondition {
|
getCondition(): AbAttrCondition {
|
||||||
return getWeatherCondition(...this.weatherTypes);
|
return getWeatherCondition(...this.weatherTypes);
|
||||||
@ -4389,11 +4390,11 @@ export class PostWeatherLapseHealAbAttr extends PostWeatherLapseAbAttr {
|
|||||||
this.healFactor = healFactor;
|
this.healFactor = healFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
override canApply({ pokemon }: AbAttrBaseParams): boolean {
|
override canApply({ pokemon }: PostWeatherLapseAbAttrParams): boolean {
|
||||||
return !pokemon.isFullHp();
|
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;
|
const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name;
|
||||||
if (!simulated) {
|
if (!simulated) {
|
||||||
globalScene.phaseManager.unshiftNew(
|
globalScene.phaseManager.unshiftNew(
|
||||||
@ -4419,11 +4420,11 @@ export class PostWeatherLapseDamageAbAttr extends PostWeatherLapseAbAttr {
|
|||||||
this.damageFactor = damageFactor;
|
this.damageFactor = damageFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
override canApply({ pokemon }: PreWeatherEffectAbAttrParams): boolean {
|
override canApply({ pokemon }: PostWeatherLapseAbAttrParams): boolean {
|
||||||
return !pokemon.hasAbilityWithAttr("BlockNonDirectDamageAbAttr");
|
return !pokemon.hasAbilityWithAttr("BlockNonDirectDamageAbAttr");
|
||||||
}
|
}
|
||||||
|
|
||||||
override apply({ simulated, pokemon, passive }: PreWeatherEffectAbAttrParams): void {
|
override apply({ simulated, pokemon, passive }: PostWeatherLapseAbAttrParams): void {
|
||||||
if (!simulated) {
|
if (!simulated) {
|
||||||
const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name;
|
const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name;
|
||||||
globalScene.phaseManager.queueMessage(
|
globalScene.phaseManager.queueMessage(
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import {
|
import { applyAbAttrs } from "#app/data/abilities/apply-ab-attrs";
|
||||||
applyPreWeatherEffectAbAttrs,
|
|
||||||
applyAbAttrs,
|
|
||||||
applyPostWeatherLapseAbAttrs,
|
|
||||||
} from "#app/data/abilities/apply-ab-attrs";
|
|
||||||
import { CommonAnim } from "#enums/move-anims-common";
|
import { CommonAnim } from "#enums/move-anims-common";
|
||||||
import type { Weather } from "#app/data/weather";
|
import type { Weather } from "#app/data/weather";
|
||||||
import { getWeatherDamageMessage, getWeatherLapseMessage } 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);
|
const cancelled = new BooleanHolder(false);
|
||||||
|
|
||||||
this.executeForAll((pokemon: Pokemon) =>
|
this.executeForAll((pokemon: Pokemon) =>
|
||||||
applyPreWeatherEffectAbAttrs("SuppressWeatherEffectAbAttr", pokemon, this.weather, cancelled),
|
applyAbAttrs("SuppressWeatherEffectAbAttr", { pokemon, weather: this.weather, cancelled }),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!cancelled.value) {
|
if (!cancelled.value) {
|
||||||
const inflictDamage = (pokemon: Pokemon) => {
|
const inflictDamage = (pokemon: Pokemon) => {
|
||||||
const cancelled = new BooleanHolder(false);
|
const cancelled = new BooleanHolder(false);
|
||||||
|
|
||||||
applyPreWeatherEffectAbAttrs("PreWeatherDamageAbAttr", pokemon, this.weather, cancelled);
|
applyAbAttrs("PreWeatherDamageAbAttr", { pokemon, weather: this.weather, cancelled });
|
||||||
applyAbAttrs("BlockNonDirectDamageAbAttr", pokemon, cancelled);
|
applyAbAttrs("BlockNonDirectDamageAbAttr", { pokemon, cancelled });
|
||||||
|
|
||||||
if (
|
if (
|
||||||
cancelled.value ||
|
cancelled.value ||
|
||||||
@ -80,7 +76,7 @@ export class WeatherEffectPhase extends CommonAnimPhase {
|
|||||||
globalScene.ui.showText(getWeatherLapseMessage(this.weather.weatherType) ?? "", null, () => {
|
globalScene.ui.showText(getWeatherLapseMessage(this.weather.weatherType) ?? "", null, () => {
|
||||||
this.executeForAll((pokemon: Pokemon) => {
|
this.executeForAll((pokemon: Pokemon) => {
|
||||||
if (!pokemon.switchOutStatus) {
|
if (!pokemon.switchOutStatus) {
|
||||||
applyPostWeatherLapseAbAttrs("PostWeatherLapseAbAttr", pokemon, this.weather);
|
applyAbAttrs("PostWeatherLapseAbAttr", { pokemon, weather: this.weather });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user