Fix stack overflow
This commit is contained in:
parent
c49bac094f
commit
5413fd5c9c
|
@ -341,7 +341,7 @@ export class BlockWeatherDamageAttr extends PreWeatherDamageAbAttr {
|
|||
}
|
||||
|
||||
export class SuppressWeatherEffectAbAttr extends PreWeatherEffectAbAttr {
|
||||
private affectsImmutable: boolean;
|
||||
public affectsImmutable: boolean;
|
||||
|
||||
constructor(affectsImmutable?: boolean) {
|
||||
super();
|
||||
|
@ -565,7 +565,7 @@ export function applyPreStatChangeAbAttrs(attrType: { new(...args: any[]): PreSt
|
|||
}
|
||||
|
||||
export function applyPreWeatherEffectAbAttrs(attrType: { new(...args: any[]): PreWeatherEffectAbAttr },
|
||||
pokemon: Pokemon, weather: Weather, cancelled: Utils.BooleanHolder, silent?: boolean, ...args: any[]): void {
|
||||
pokemon: Pokemon, weather: Weather, cancelled: Utils.BooleanHolder, ...args: any[]): void {
|
||||
if (!pokemon.canApplyAbility())
|
||||
return;
|
||||
|
||||
|
@ -576,12 +576,10 @@ export function applyPreWeatherEffectAbAttrs(attrType: { new(...args: any[]): Pr
|
|||
continue;
|
||||
pokemon.scene.setPhaseQueueSplice();
|
||||
if (attr.applyPreWeatherEffect(pokemon, weather, cancelled, args)) {
|
||||
if (!silent) {
|
||||
pokemon.scene.abilityBar.showAbility(pokemon);
|
||||
const message = attr.getTriggerMessage(pokemon, weather);
|
||||
if (message)
|
||||
pokemon.scene.queueMessage(message);
|
||||
}
|
||||
pokemon.scene.abilityBar.showAbility(pokemon);
|
||||
const message = attr.getTriggerMessage(pokemon, weather);
|
||||
if (message)
|
||||
pokemon.scene.queueMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -616,6 +614,9 @@ export function applyPostWeatherLapseAbAttrs(attrType: { new(...args: any[]): Po
|
|||
if (!pokemon.canApplyAbility())
|
||||
return;
|
||||
|
||||
if (weather.isEffectSuppressed(pokemon.scene))
|
||||
return;
|
||||
|
||||
const ability = pokemon.getAbility();
|
||||
|
||||
const attrs = ability.getAttrs(attrType) as PostWeatherLapseAbAttr[];
|
||||
|
|
|
@ -103,15 +103,19 @@ export class Weather {
|
|||
const playerPokemon = scene.getPlayerPokemon();
|
||||
const enemyPokemon = scene.getEnemyPokemon();
|
||||
|
||||
const cancelled = new Utils.BooleanHolder(false);
|
||||
if (playerPokemon) {
|
||||
const suppressWeatherEffectAbAttr = playerPokemon.getAbility().getAttrs(SuppressWeatherEffectAbAttr).find(() => true) as SuppressWeatherEffectAbAttr;
|
||||
if (suppressWeatherEffectAbAttr && (!this.isImmutable() || suppressWeatherEffectAbAttr.affectsImmutable))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (playerPokemon)
|
||||
applyPreWeatherEffectAbAttrs(SuppressWeatherEffectAbAttr, playerPokemon, this, cancelled, true);
|
||||
if (enemyPokemon) {
|
||||
const suppressWeatherEffectAbAttr = enemyPokemon.getAbility().getAttrs(SuppressWeatherEffectAbAttr).find(() => true) as SuppressWeatherEffectAbAttr;
|
||||
if (suppressWeatherEffectAbAttr && (!this.isImmutable() || suppressWeatherEffectAbAttr.affectsImmutable))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (enemyPokemon)
|
||||
applyPreWeatherEffectAbAttrs(SuppressWeatherEffectAbAttr, enemyPokemon, this, cancelled, true);
|
||||
|
||||
return cancelled.value;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue