mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 00:52:47 +02:00
Fix PostSummonFormChangeByWeatherAbAttr
This commit is contained in:
parent
4d092dd908
commit
3920669e69
@ -25,7 +25,7 @@ import { allMoves } from "../data-lists";
|
||||
import { ArenaTagSide } from "#enums/arena-tag-side";
|
||||
import { BerryModifier, HitHealModifier, PokemonHeldItemModifier } from "#app/modifier/modifier";
|
||||
import { TerrainType } from "#app/data/terrain";
|
||||
import {
|
||||
import { pokemonFormChanges,
|
||||
SpeciesFormChangeRevertWeatherFormTrigger,
|
||||
SpeciesFormChangeWeatherTrigger,
|
||||
} from "../pokemon-forms/form-change-triggers";
|
||||
@ -3970,27 +3970,32 @@ export class PostSummonFormChangeByWeatherAbAttr extends PostSummonAbAttr {
|
||||
this.ability = ability;
|
||||
}
|
||||
|
||||
override canApplyPostSummon(pokemon: Pokemon, _passive: boolean, _simulated: boolean, _args: any[]): boolean {
|
||||
const isCastformWithForecast =
|
||||
pokemon.species.speciesId === SpeciesId.CASTFORM && this.ability === AbilityId.FORECAST;
|
||||
const isCherrimWithFlowerGift =
|
||||
pokemon.species.speciesId === SpeciesId.CHERRIM && this.ability === AbilityId.FLOWER_GIFT;
|
||||
return isCastformWithForecast || isCherrimWithFlowerGift;
|
||||
/**
|
||||
* Determine if the pokemon has a forme change that is triggered by the weather
|
||||
*
|
||||
* @param pokemon - The pokemon with the forme change ability
|
||||
* @param passive - unused
|
||||
* @param simulated - unused
|
||||
* @param args - unused
|
||||
*/
|
||||
override canApplyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
|
||||
const fc = (pokemonFormChanges[pokemon.species.speciesId]?.filter(
|
||||
fc => fc.findTrigger(SpeciesFormChangeWeatherTrigger) && fc.canChange(pokemon)
|
||||
) || [])[0];
|
||||
return !isNullOrUndefined(fc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the {@linkcode BattleScene.triggerPokemonFormChange | triggerPokemonFormChange} for both
|
||||
* {@linkcode SpeciesFormChange.SpeciesFormChangeWeatherTrigger | SpeciesFormChangeWeatherTrigger} and
|
||||
* {@linkcode SpeciesFormChange.SpeciesFormChangeWeatherTrigger | SpeciesFormChangeRevertWeatherFormTrigger} if it
|
||||
* is the specific Pokemon and ability
|
||||
* @param {Pokemon} pokemon the Pokemon with this ability
|
||||
* @param _passive n/a
|
||||
* @param _args n/a
|
||||
* Trigger the pokemon's forme change by invoking
|
||||
* {@linkcode BattleScene.triggerPokemonFormChange | triggerPokemonFormChange}
|
||||
*
|
||||
* @param pokemon - The Pokemon with this ability
|
||||
* @param _passive - unused
|
||||
* @param _args - unused
|
||||
*/
|
||||
override applyPostSummon(pokemon: Pokemon, _passive: boolean, simulated: boolean, _args: any[]): void {
|
||||
if (!simulated) {
|
||||
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeWeatherTrigger);
|
||||
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeRevertWeatherFormTrigger);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5312,6 +5317,7 @@ export class PostWeatherChangeFormChangeAbAttr extends PostWeatherChangeAbAttr {
|
||||
_weather: WeatherType,
|
||||
_args: any[],
|
||||
): void {
|
||||
console.log("Inside applyPostWeatherChange");
|
||||
if (simulated) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user