mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-21 15:52:18 +02:00
Update postWeatherChange
This commit is contained in:
parent
cb7a1b6c7f
commit
578052bdb0
@ -3361,6 +3361,10 @@ export class FriskAbAttr extends PostSummonAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostWeatherChangeAbAttr extends AbAttr {
|
export class PostWeatherChangeAbAttr extends AbAttr {
|
||||||
|
willSucceedPostWeatherChange(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: WeatherType, args: any[]): boolean {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
applyPostWeatherChange(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: WeatherType, args: any[]): boolean {
|
applyPostWeatherChange(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: WeatherType, args: any[]): boolean {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -3382,6 +3386,13 @@ export class PostWeatherChangeFormChangeAbAttr extends PostWeatherChangeAbAttr {
|
|||||||
this.formRevertingWeathers = formRevertingWeathers;
|
this.formRevertingWeathers = formRevertingWeathers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
willSucceedPostWeatherChange(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: WeatherType, args: any[]): boolean {
|
||||||
|
const isCastformWithForecast = (pokemon.species.speciesId === Species.CASTFORM && this.ability === Abilities.FORECAST);
|
||||||
|
const isCherrimWithFlowerGift = (pokemon.species.speciesId === Species.CHERRIM && this.ability === Abilities.FLOWER_GIFT);
|
||||||
|
|
||||||
|
return isCastformWithForecast || isCherrimWithFlowerGift;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls {@linkcode Arena.triggerWeatherBasedFormChangesToNormal | triggerWeatherBasedFormChangesToNormal} when the
|
* Calls {@linkcode Arena.triggerWeatherBasedFormChangesToNormal | triggerWeatherBasedFormChangesToNormal} when the
|
||||||
* weather changed to form-reverting weather, otherwise calls {@linkcode Arena.triggerWeatherBasedFormChanges | triggerWeatherBasedFormChanges}
|
* weather changed to form-reverting weather, otherwise calls {@linkcode Arena.triggerWeatherBasedFormChanges | triggerWeatherBasedFormChanges}
|
||||||
@ -3392,10 +3403,6 @@ export class PostWeatherChangeFormChangeAbAttr extends PostWeatherChangeAbAttr {
|
|||||||
* @returns whether the form change was triggered
|
* @returns whether the form change was triggered
|
||||||
*/
|
*/
|
||||||
applyPostWeatherChange(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: WeatherType, args: any[]): boolean {
|
applyPostWeatherChange(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: WeatherType, args: any[]): boolean {
|
||||||
const isCastformWithForecast = (pokemon.species.speciesId === Species.CASTFORM && this.ability === Abilities.FORECAST);
|
|
||||||
const isCherrimWithFlowerGift = (pokemon.species.speciesId === Species.CHERRIM && this.ability === Abilities.FLOWER_GIFT);
|
|
||||||
|
|
||||||
if (isCastformWithForecast || isCherrimWithFlowerGift) {
|
|
||||||
if (simulated) {
|
if (simulated) {
|
||||||
return simulated;
|
return simulated;
|
||||||
}
|
}
|
||||||
@ -3409,8 +3416,6 @@ export class PostWeatherChangeFormChangeAbAttr extends PostWeatherChangeAbAttr {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PostWeatherChangeAddBattlerTagAttr extends PostWeatherChangeAbAttr {
|
export class PostWeatherChangeAddBattlerTagAttr extends PostWeatherChangeAbAttr {
|
||||||
@ -3426,12 +3431,11 @@ export class PostWeatherChangeAddBattlerTagAttr extends PostWeatherChangeAbAttr
|
|||||||
this.weatherTypes = weatherTypes;
|
this.weatherTypes = weatherTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
applyPostWeatherChange(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: WeatherType, args: any[]): boolean {
|
willSucceedPostWeatherChange(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: WeatherType, args: any[]): boolean {
|
||||||
console.log(this.weatherTypes.find(w => weather === w), WeatherType[weather]);
|
return !this.weatherTypes.find(w => weather === w) && pokemon.canAddTag(this.tagType);
|
||||||
if (!this.weatherTypes.find(w => weather === w)) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyPostWeatherChange(pokemon: Pokemon, passive: boolean, simulated: boolean, weather: WeatherType, args: any[]): boolean {
|
||||||
if (simulated) {
|
if (simulated) {
|
||||||
return pokemon.canAddTag(this.tagType);
|
return pokemon.canAddTag(this.tagType);
|
||||||
} else {
|
} else {
|
||||||
@ -5374,7 +5378,8 @@ export function applyPostTurnAbAttrs(attrType: Constructor<PostTurnAbAttr>,
|
|||||||
|
|
||||||
export function applyPostWeatherChangeAbAttrs(attrType: Constructor<PostWeatherChangeAbAttr>,
|
export function applyPostWeatherChangeAbAttrs(attrType: Constructor<PostWeatherChangeAbAttr>,
|
||||||
pokemon: Pokemon, weather: WeatherType, simulated: boolean = false, ...args: any[]): Promise<void> {
|
pokemon: Pokemon, weather: WeatherType, simulated: boolean = false, ...args: any[]): Promise<void> {
|
||||||
return applyAbAttrsInternal<PostWeatherChangeAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostWeatherChange(pokemon, passive, simulated, weather, args), args, false, simulated);
|
return applyAbAttrsInternal<PostWeatherChangeAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostWeatherChange(pokemon, passive, simulated, weather, args),
|
||||||
|
(attr, passive) => attr.willSucceedPostWeatherChange(pokemon, passive, simulated, weather, args), args, false, simulated);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function applyPostWeatherLapseAbAttrs(attrType: Constructor<PostWeatherLapseAbAttr>,
|
export function applyPostWeatherLapseAbAttrs(attrType: Constructor<PostWeatherLapseAbAttr>,
|
||||||
|
Loading…
Reference in New Issue
Block a user