Skip to content

Commit

Permalink
[Refactor] Descriptions for evolution and form change requirements (#…
Browse files Browse the repository at this point in the history
…5147)

* Adding extensions of the SpeciesEvolutionCondition class

* Commented out logs

* Introducing descriptions for form changes; new class SpeciesFormChangeAbilityTrigger which is functionally identical to SpeciesFormChangeManualTrigger but has appropriate description

* Fix in description of compound trigger

* Commenting out logs

* Small fixes, clearing logs, implementing suggestions

* Apply suggestions from code review

Trigger functions are declared with no arguments when not needed.

Co-authored-by: NightKev <[email protected]>

* Removed exports for new classes

---------

Co-authored-by: NightKev <[email protected]>
Co-authored-by: damocleas <[email protected]>
  • Loading branch information
3 people authored Jan 21, 2025
1 parent 271e51b commit d10b7c0
Show file tree
Hide file tree
Showing 6 changed files with 433 additions and 200 deletions.
12 changes: 6 additions & 6 deletions src/data/ability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type { ArenaTrapTag } from "./arena-tag";
import { ArenaTagSide } from "./arena-tag";
import { BerryModifier, HitHealModifier, PokemonHeldItemModifier } from "../modifier/modifier";
import { TerrainType } from "./terrain";
import { SpeciesFormChangeManualTrigger, SpeciesFormChangeRevertWeatherFormTrigger, SpeciesFormChangeWeatherTrigger } from "./pokemon-forms";
import { SpeciesFormChangeAbilityTrigger, SpeciesFormChangeRevertWeatherFormTrigger, SpeciesFormChangeWeatherTrigger } from "./pokemon-forms";
import i18next from "i18next";
import type { Localizable } from "#app/interfaces/locales";
import { Command } from "../ui/command-ui-handler";
Expand Down Expand Up @@ -232,7 +232,7 @@ export class PostBattleInitFormChangeAbAttr extends PostBattleInitAbAttr {
applyPostBattleInit(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
const formIndex = this.formFunc(pokemon);
if (formIndex !== pokemon.formIndex && !simulated) {
return globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeManualTrigger, false);
return globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeAbilityTrigger, false);
}

return false;
Expand Down Expand Up @@ -1875,7 +1875,7 @@ export class PostVictoryFormChangeAbAttr extends PostVictoryAbAttr {
const formIndex = this.formFunc(pokemon);
if (formIndex !== pokemon.formIndex) {
if (!simulated) {
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeManualTrigger, false);
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeAbilityTrigger, false);
}
return true;
}
Expand Down Expand Up @@ -2306,7 +2306,7 @@ export class PostSummonFormChangeAbAttr extends PostSummonAbAttr {
applyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
const formIndex = this.formFunc(pokemon);
if (formIndex !== pokemon.formIndex) {
return simulated || globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeManualTrigger, false);
return simulated || globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeAbilityTrigger, false);
}

return false;
Expand Down Expand Up @@ -2734,7 +2734,7 @@ export class PreSwitchOutFormChangeAbAttr extends PreSwitchOutAbAttr {
const formIndex = this.formFunc(pokemon);
if (formIndex !== pokemon.formIndex) {
if (!simulated) {
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeManualTrigger, false);
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeAbilityTrigger, false);
}
return true;
}
Expand Down Expand Up @@ -3704,7 +3704,7 @@ export class PostTurnFormChangeAbAttr extends PostTurnAbAttr {
const formIndex = this.formFunc(pokemon);
if (formIndex !== pokemon.formIndex) {
if (!simulated) {
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeManualTrigger, false);
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeAbilityTrigger, false);
}

return true;
Expand Down
Loading

0 comments on commit d10b7c0

Please sign in to comment.