From 06f1b66add2a7366203da88a9519a01704439293 Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Fri, 28 Mar 2025 19:12:19 -0500 Subject: [PATCH] Move TrainerSlot enum to its own file --- src/battle-scene.ts | 2 +- .../encounters/absolute-avarice-encounter.ts | 2 +- .../encounters/bug-type-superfan-encounter.ts | 2 +- .../encounters/dancing-lessons-encounter.ts | 2 +- .../encounters/fun-and-games-encounter.ts | 2 +- .../global-trade-system-encounter.ts | 2 +- .../encounters/safari-zone-encounter.ts | 2 +- .../teleporting-hijinks-encounter.ts | 2 +- .../utils/encounter-phase-utils.ts | 3 +- src/data/trainers/evil-admin-trainer-pools.ts | 2 +- src/data/trainers/trainer-config.ts | 37 +++++++------------ src/data/trainers/typedefs.ts | 32 ++-------------- src/enums/trainer-slot.ts | 5 +++ src/field/pokemon.ts | 2 +- src/field/trainer.ts | 8 +--- src/phases/battle-phase.ts | 2 +- src/phases/encounter-phase.ts | 2 +- src/phases/mystery-encounter-phases.ts | 2 +- src/phases/summon-phase.ts | 2 +- src/phases/switch-summon-phase.ts | 2 +- src/phases/trainer-victory-phase.ts | 2 +- src/system/pokemon-data.ts | 2 +- test/moves/effectiveness.test.ts | 2 +- 23 files changed, 43 insertions(+), 78 deletions(-) create mode 100644 src/enums/trainer-slot.ts diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 165a7cc3faa..5797fda5611 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -72,7 +72,7 @@ import { GameModes, getGameMode } from "#app/game-mode"; import FieldSpritePipeline from "#app/pipelines/field-sprite"; import SpritePipeline from "#app/pipelines/sprite"; import PartyExpBar from "#app/ui/party-exp-bar"; -import type { TrainerSlot } from "#app/data/trainers/trainer-config"; +import type { TrainerSlot } from "./enums/trainer-slot"; import { trainerConfigs } from "#app/data/trainers/trainer-config"; import Trainer, { TrainerVariant } from "#app/field/trainer"; import type TrainerData from "#app/system/trainer-data"; diff --git a/src/data/mystery-encounters/encounters/absolute-avarice-encounter.ts b/src/data/mystery-encounters/encounters/absolute-avarice-encounter.ts index 40bcd922d71..85f40a41e51 100644 --- a/src/data/mystery-encounters/encounters/absolute-avarice-encounter.ts +++ b/src/data/mystery-encounters/encounters/absolute-avarice-encounter.ts @@ -31,7 +31,7 @@ import { catchPokemon, getHighestLevelPlayerPokemon, } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils"; -import { TrainerSlot } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import { PokeballType } from "#enums/pokeball"; import type HeldModifierConfig from "#app/interfaces/held-modifier-config"; import type { BerryType } from "#enums/berry-type"; diff --git a/src/data/mystery-encounters/encounters/bug-type-superfan-encounter.ts b/src/data/mystery-encounters/encounters/bug-type-superfan-encounter.ts index 06108776a71..29e65a32bbc 100644 --- a/src/data/mystery-encounters/encounters/bug-type-superfan-encounter.ts +++ b/src/data/mystery-encounters/encounters/bug-type-superfan-encounter.ts @@ -14,8 +14,8 @@ import { trainerConfigs, TrainerPartyCompoundTemplate, TrainerPartyTemplate, - TrainerSlot, } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { PartyMemberStrength } from "#enums/party-member-strength"; import { globalScene } from "#app/global-scene"; diff --git a/src/data/mystery-encounters/encounters/dancing-lessons-encounter.ts b/src/data/mystery-encounters/encounters/dancing-lessons-encounter.ts index 4e10b739d71..75527e1f8c1 100644 --- a/src/data/mystery-encounters/encounters/dancing-lessons-encounter.ts +++ b/src/data/mystery-encounters/encounters/dancing-lessons-encounter.ts @@ -20,7 +20,7 @@ import { STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER, } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils"; import { getPokemonSpecies } from "#app/data/pokemon-species"; -import { TrainerSlot } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import type { PlayerPokemon } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; import { EnemyPokemon, PokemonMove } from "#app/field/pokemon"; diff --git a/src/data/mystery-encounters/encounters/fun-and-games-encounter.ts b/src/data/mystery-encounters/encounters/fun-and-games-encounter.ts index 094308ccba6..282c6c149ff 100644 --- a/src/data/mystery-encounters/encounters/fun-and-games-encounter.ts +++ b/src/data/mystery-encounters/encounters/fun-and-games-encounter.ts @@ -10,7 +10,7 @@ import { globalScene } from "#app/global-scene"; import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter"; import { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter"; import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option"; -import { TrainerSlot } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import type { PlayerPokemon } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; import { FieldPosition } from "#app/field/pokemon"; diff --git a/src/data/mystery-encounters/encounters/global-trade-system-encounter.ts b/src/data/mystery-encounters/encounters/global-trade-system-encounter.ts index ccd2666edeb..c13501c4511 100644 --- a/src/data/mystery-encounters/encounters/global-trade-system-encounter.ts +++ b/src/data/mystery-encounters/encounters/global-trade-system-encounter.ts @@ -3,7 +3,7 @@ import { selectPokemonForOption, setEncounterRewards, } from "#app/data/mystery-encounters/utils/encounter-phase-utils"; -import { TrainerSlot } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import { ModifierTier } from "#app/modifier/modifier-tier"; import { MusicPreference } from "#app/system/settings/settings"; import type { ModifierTypeOption } from "#app/modifier/modifier-type"; diff --git a/src/data/mystery-encounters/encounters/safari-zone-encounter.ts b/src/data/mystery-encounters/encounters/safari-zone-encounter.ts index f787e1ff777..8c45fde3079 100644 --- a/src/data/mystery-encounters/encounters/safari-zone-encounter.ts +++ b/src/data/mystery-encounters/encounters/safari-zone-encounter.ts @@ -10,7 +10,7 @@ import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounte import { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter"; import type MysteryEncounterOption from "#app/data/mystery-encounters/mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option"; -import { TrainerSlot } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import { HiddenAbilityRateBoosterModifier, IvScannerModifier } from "#app/modifier/modifier"; import type { EnemyPokemon } from "#app/field/pokemon"; import { PokeballType } from "#enums/pokeball"; diff --git a/src/data/mystery-encounters/encounters/teleporting-hijinks-encounter.ts b/src/data/mystery-encounters/encounters/teleporting-hijinks-encounter.ts index 185d61df1a3..806a89a7131 100644 --- a/src/data/mystery-encounters/encounters/teleporting-hijinks-encounter.ts +++ b/src/data/mystery-encounters/encounters/teleporting-hijinks-encounter.ts @@ -24,7 +24,7 @@ import { Biome } from "#enums/biome"; import { getBiomeKey } from "#app/field/arena"; import { PokemonType } from "#enums/pokemon-type"; import { getPartyLuckValue, modifierTypes } from "#app/modifier/modifier-type"; -import { TrainerSlot } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import { BattlerTagType } from "#enums/battler-tag-type"; import { getPokemonNameWithAffix } from "#app/messages"; import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase"; diff --git a/src/data/mystery-encounters/utils/encounter-phase-utils.ts b/src/data/mystery-encounters/utils/encounter-phase-utils.ts index 1f9b130890a..5c6acf43e26 100644 --- a/src/data/mystery-encounters/utils/encounter-phase-utils.ts +++ b/src/data/mystery-encounters/utils/encounter-phase-utils.ts @@ -44,7 +44,8 @@ import { initMoveAnim, loadMoveAnimAssets } from "#app/data/battle-anims"; import { MysteryEncounterMode } from "#enums/mystery-encounter-mode"; import { Status } from "#app/data/status-effect"; import type { TrainerConfig } from "#app/data/trainers/trainer-config"; -import { trainerConfigs, TrainerSlot } from "#app/data/trainers/trainer-config"; +import { trainerConfigs } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import type PokemonSpecies from "#app/data/pokemon-species"; import type { IEggOptions } from "#app/data/egg"; import { Egg } from "#app/data/egg"; diff --git a/src/data/trainers/evil-admin-trainer-pools.ts b/src/data/trainers/evil-admin-trainer-pools.ts index 1cca4beeed0..fc38edc4070 100644 --- a/src/data/trainers/evil-admin-trainer-pools.ts +++ b/src/data/trainers/evil-admin-trainer-pools.ts @@ -1,4 +1,4 @@ -import type { TrainerTierPools } from "./typedefs"; +import type { TrainerTierPools } from "#app/data/trainers/typedefs"; import { TrainerPoolTier } from "#enums/trainer-pool-tier"; import { Species } from "#enums/species"; diff --git a/src/data/trainers/trainer-config.ts b/src/data/trainers/trainer-config.ts index f78070a19ad..3aca435a585 100644 --- a/src/data/trainers/trainer-config.ts +++ b/src/data/trainers/trainer-config.ts @@ -13,7 +13,6 @@ import { getPokemonSpecies } from "#app/data/pokemon-species"; import { tmSpecies } from "#app/data/balance/tms"; import { PokemonType } from "#enums/pokemon-type"; import { doubleBattleDialogue } from "#app/data/dialogue"; -import type { PersistentModifier } from "#app/modifier/modifier"; import { TrainerVariant } from "#app/field/trainer"; import { getIsInitialized, initI18n } from "#app/plugins/i18n"; import i18next from "i18next"; @@ -26,6 +25,15 @@ import { signatureSpecies } from "../balance/signature-species"; import { Abilities } from "#enums/abilities"; import { TeraAIMode } from "#enums/tera-ai-mode"; import { TrainerPoolTier } from "#enums/trainer-pool-tier"; +import { TrainerSlot } from "#enums/trainer-slot"; +import type { + PartyMemberFunc, + GenModifiersFunc, + GenAIFunc, + PartyTemplateFunc, + TrainerTierPools, + TrainerConfigs, +} from "./typedefs"; /** Minimum BST for Pokemon generated onto the Elite Four's teams */ const ELITE_FOUR_MINIMUM_BST = 460; @@ -33,16 +41,6 @@ const ELITE_FOUR_MINIMUM_BST = 460; /** The wave at which (non-Paldean) Gym Leaders start having Tera mons*/ const GYM_LEADER_TERA_WAVE = 100; -export interface TrainerTierPools { - [key: number]: Species[]; -} - -export enum TrainerSlot { - NONE, - TRAINER, - TRAINER_PARTNER, -} - export class TrainerPartyTemplate { public size: number; public strength: PartyMemberStrength; @@ -69,6 +67,10 @@ export class TrainerPartyTemplate { } } +export interface PartyMemberFuncs { + [key: number]: PartyMemberFunc; +} + export class TrainerPartyCompoundTemplate extends TrainerPartyTemplate { public templates: TrainerPartyTemplate[]; @@ -257,15 +259,6 @@ export const trainerPartyTemplates = { ), }; -type PartyTemplateFunc = () => TrainerPartyTemplate; -type PartyMemberFunc = (level: number, strength: PartyMemberStrength) => EnemyPokemon; -type GenModifiersFunc = (party: EnemyPokemon[]) => PersistentModifier[]; -type GenAIFunc = (party: EnemyPokemon[]) => void; - -export interface PartyMemberFuncs { - [key: number]: PartyMemberFunc; -} - /** * Stores data and helper functions about a trainers AI options. */ @@ -1625,10 +1618,6 @@ export class TrainerConfig { let t = 0; -interface TrainerConfigs { - [key: number]: TrainerConfig; -} - /** * The function to get variable strength grunts * @returns the correct TrainerPartyTemplate diff --git a/src/data/trainers/typedefs.ts b/src/data/trainers/typedefs.ts index f839b591b8d..c3ae8e71418 100644 --- a/src/data/trainers/typedefs.ts +++ b/src/data/trainers/typedefs.ts @@ -2,6 +2,7 @@ import type { EnemyPokemon } from "#app/field/pokemon"; import type { PersistentModifier } from "#app/modifier/modifier"; import type { PartyMemberStrength } from "#enums/party-member-strength"; import type { Species } from "#enums/species"; +import type { TrainerPartyTemplate, TrainerConfig } from "./trainer-config"; export type PartyTemplateFunc = () => TrainerPartyTemplate; export type PartyMemberFunc = (level: number, strength: PartyMemberStrength) => EnemyPokemon; @@ -11,33 +12,6 @@ export type GenAIFunc = (party: EnemyPokemon[]) => void; export interface TrainerTierPools { [key: number]: Species[]; } - -export interface PartyMemberFuncs { - [key: number]: PartyMemberFunc; -} - -export class TrainerPartyTemplate { - public size: number; - public strength: PartyMemberStrength; - public sameSpecies: boolean; - public balanced: boolean; - - constructor(size: number, strength: PartyMemberStrength, sameSpecies?: boolean, balanced?: boolean) { - this.size = size; - this.strength = strength; - this.sameSpecies = !!sameSpecies; - this.balanced = !!balanced; - } - - getStrength(_index: number): PartyMemberStrength { - return this.strength; - } - - isSameSpecies(_index: number): boolean { - return this.sameSpecies; - } - - isBalanced(_index: number): boolean { - return this.balanced; - } +export interface TrainerConfigs { + [key: number]: TrainerConfig; } diff --git a/src/enums/trainer-slot.ts b/src/enums/trainer-slot.ts new file mode 100644 index 00000000000..2dfa468f74c --- /dev/null +++ b/src/enums/trainer-slot.ts @@ -0,0 +1,5 @@ +export enum TrainerSlot { + NONE, + TRAINER, + TRAINER_PARTNER +} diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index ae9cc17c655..aba13b2e51b 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -225,7 +225,7 @@ import { SpeciesFormChangeStatusEffectTrigger, } from "#app/data/pokemon-forms"; import { TerrainType } from "#app/data/terrain"; -import type { TrainerSlot } from "#app/data/trainers/trainer-config"; +import type { TrainerSlot } from "#enums/trainer-slot"; import Overrides from "#app/overrides"; import i18next from "i18next"; import { speciesEggMoves } from "#app/data/balance/egg-moves"; diff --git a/src/field/trainer.ts b/src/field/trainer.ts index a6b8b7aef29..47231d39d51 100644 --- a/src/field/trainer.ts +++ b/src/field/trainer.ts @@ -3,12 +3,8 @@ import { pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions"; import type PokemonSpecies from "#app/data/pokemon-species"; import { getPokemonSpecies } from "#app/data/pokemon-species"; import type { TrainerConfig, TrainerPartyTemplate } from "#app/data/trainers/trainer-config"; -import { - TrainerPartyCompoundTemplate, - TrainerSlot, - trainerConfigs, - trainerPartyTemplates, -} from "#app/data/trainers/trainer-config"; +import { TrainerPartyCompoundTemplate, trainerConfigs, trainerPartyTemplates } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import { TrainerPoolTier } from "#enums/trainer-pool-tier"; import { TeraAIMode } from "#enums/tera-ai-mode"; import type { EnemyPokemon } from "#app/field/pokemon"; diff --git a/src/phases/battle-phase.ts b/src/phases/battle-phase.ts index 90c9adc59c8..72bcc85bc62 100644 --- a/src/phases/battle-phase.ts +++ b/src/phases/battle-phase.ts @@ -1,5 +1,5 @@ import { globalScene } from "#app/global-scene"; -import { TrainerSlot } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import { Phase } from "#app/phase"; export class BattlePhase extends Phase { diff --git a/src/phases/encounter-phase.ts b/src/phases/encounter-phase.ts index d3018f2c905..ad2bf689e38 100644 --- a/src/phases/encounter-phase.ts +++ b/src/phases/encounter-phase.ts @@ -7,7 +7,7 @@ import { getCharVariantFromDialogue } from "#app/data/dialogue"; import { getEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils"; import { doTrainerExclamation } from "#app/data/mystery-encounters/utils/encounter-phase-utils"; import { getGoldenBugNetSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils"; -import { TrainerSlot } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import { getRandomWeatherType } from "#app/data/weather"; import { EncounterPhaseEvent } from "#app/events/battle-scene"; import type Pokemon from "#app/field/pokemon"; diff --git a/src/phases/mystery-encounter-phases.ts b/src/phases/mystery-encounter-phases.ts index 55aac8bc690..eb187617e69 100644 --- a/src/phases/mystery-encounter-phases.ts +++ b/src/phases/mystery-encounter-phases.ts @@ -22,7 +22,7 @@ import { globalScene } from "#app/global-scene"; import { getCharVariantFromDialogue } from "../data/dialogue"; import type { OptionSelectSettings } from "../data/mystery-encounters/utils/encounter-phase-utils"; import { transitionMysteryEncounterIntroVisuals } from "../data/mystery-encounters/utils/encounter-phase-utils"; -import { TrainerSlot } from "../data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import { IvScannerModifier } from "../modifier/modifier"; import { Phase } from "../phase"; import { Mode } from "../ui/ui"; diff --git a/src/phases/summon-phase.ts b/src/phases/summon-phase.ts index fcd94a4b7b8..621c8c8c2a9 100644 --- a/src/phases/summon-phase.ts +++ b/src/phases/summon-phase.ts @@ -1,7 +1,7 @@ import { BattleType } from "#app/battle"; import { getPokeballAtlasKey, getPokeballTintColor } from "#app/data/pokeball"; import { SpeciesFormChangeActiveTrigger } from "#app/data/pokemon-forms"; -import { TrainerSlot } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import { PlayerGender } from "#app/enums/player-gender"; import { addPokeballOpenParticles } from "#app/field/anims"; import type Pokemon from "#app/field/pokemon"; diff --git a/src/phases/switch-summon-phase.ts b/src/phases/switch-summon-phase.ts index b2576267cb1..16868bf9bc0 100644 --- a/src/phases/switch-summon-phase.ts +++ b/src/phases/switch-summon-phase.ts @@ -3,7 +3,7 @@ import { applyPreSwitchOutAbAttrs, PostDamageForceSwitchAbAttr, PreSwitchOutAbAt import { allMoves, ForceSwitchOutAttr } from "#app/data/moves/move"; import { getPokeballTintColor } from "#app/data/pokeball"; import { SpeciesFormChangeActiveTrigger } from "#app/data/pokemon-forms"; -import { TrainerSlot } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import type Pokemon from "#app/field/pokemon"; import { getPokemonNameWithAffix } from "#app/messages"; import { SwitchEffectTransferModifier } from "#app/modifier/modifier"; diff --git a/src/phases/trainer-victory-phase.ts b/src/phases/trainer-victory-phase.ts index 7089cb4437a..f7b2eb2bb66 100644 --- a/src/phases/trainer-victory-phase.ts +++ b/src/phases/trainer-victory-phase.ts @@ -7,7 +7,7 @@ import * as Utils from "#app/utils"; import { BattlePhase } from "./battle-phase"; import { ModifierRewardPhase } from "./modifier-reward-phase"; import { MoneyRewardPhase } from "./money-reward-phase"; -import { TrainerSlot } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import { globalScene } from "#app/global-scene"; import { Biome } from "#app/enums/biome"; import { achvs } from "#app/system/achv"; diff --git a/src/system/pokemon-data.ts b/src/system/pokemon-data.ts index 3169129c0d6..a1d27394d9f 100644 --- a/src/system/pokemon-data.ts +++ b/src/system/pokemon-data.ts @@ -6,7 +6,7 @@ import type { PokeballType } from "#enums/pokeball"; import { getPokemonSpecies, getPokemonSpeciesForm } from "../data/pokemon-species"; import { Status } from "../data/status-effect"; import Pokemon, { EnemyPokemon, PokemonMove, PokemonSummonData } from "../field/pokemon"; -import { TrainerSlot } from "../data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import type { Variant } from "#app/data/variant"; import { loadBattlerTag } from "../data/battler-tags"; import type { Biome } from "#enums/biome"; diff --git a/test/moves/effectiveness.test.ts b/test/moves/effectiveness.test.ts index 8d0c849e25e..fb03f1c10a0 100644 --- a/test/moves/effectiveness.test.ts +++ b/test/moves/effectiveness.test.ts @@ -1,6 +1,6 @@ import { allMoves } from "#app/data/moves/move"; import { getPokemonSpecies } from "#app/data/pokemon-species"; -import { TrainerSlot } from "#app/data/trainers/trainer-config"; +import { TrainerSlot } from "#enums/trainer-slot"; import { PokemonType } from "#enums/pokemon-type"; import { Abilities } from "#app/enums/abilities"; import { Moves } from "#app/enums/moves";