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