diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 032e1fee69c..a25a2f807f3 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -65,7 +65,7 @@ Do the reviewers need to do something special in order to test your changes? - [ ] The PR is self-contained and cannot be split into smaller PRs? - [ ] Have I provided a clear explanation of the changes? - [ ] Have I tested the changes manually? -- [ ] Are all unit tests still passing? (`npm run test`) +- [ ] Are all unit tests still passing? (`npm run test:silent`) - [ ] Have I created new automated tests (`npm run create-test`) or updated existing tests related to the PR's changes? - [ ] Have I provided screenshots/videos of the changes (if applicable)? - [ ] Have I made sure that any UI change works for both UI themes (default and legacy)? diff --git a/biome.jsonc b/biome.jsonc index 9d0e6a9b5ff..a433470cd90 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -38,6 +38,9 @@ "src/data/balance/tms.ts" ] }, + + // While it'd be nice to enable consistent sorting, enabling this causes issues due to circular import resolution order + // TODO: Remove if we ever get down to 0 circular imports "organizeImports": { "enabled": false }, "linter": { "ignore": [ @@ -55,13 +58,13 @@ }, "style": { "noVar": "error", - "useEnumInitializers": "off", + "useEnumInitializers": "off", // large enums like Moves/Species would make this cumbersome "useBlockStatements": "error", "useConst": "error", "useImportType": "error", - "noNonNullAssertion": "off", // TODO: Turn this on ASAP and fix all non-null assertions + "noNonNullAssertion": "off", // TODO: Turn this on ASAP and fix all non-null assertions in non-test files "noParameterAssign": "off", - "useExponentiationOperator": "off", + "useExponentiationOperator": "off", // Too typo-prone and easy to mixup with standard multiplication (* vs **) "useDefaultParameterLast": "off", // TODO: Fix spots in the codebase where this flag would be triggered, and then enable "useSingleVarDeclarator": "off", "useNodejsImportProtocol": "off", @@ -70,17 +73,20 @@ }, "suspicious": { "noDoubleEquals": "error", + // While this would be a nice rule to enable, the current structure of the codebase makes this infeasible + // due to being used for move/ability `args` params and save data-related code. + // This can likely be enabled for all non-utils files once these are eventually reworked, but until then we leave it off. "noExplicitAny": "off", "noAssignInExpressions": "off", "noPrototypeBuiltins": "off", - "noFallthroughSwitchClause": "off", - "noImplicitAnyLet": "info", // TODO: Refactor and make this an error - "noRedeclare": "off", // TODO: Refactor and make this an error + "noFallthroughSwitchClause": "error", // Prevents accidental automatic fallthroughs in switch cases (use disable comment if needed) + "noImplicitAnyLet": "warn", // TODO: Refactor and make this an error + "noRedeclare": "info", // TODO: Refactor and make this an error "noGlobalIsNan": "off", "noAsyncPromiseExecutor": "warn" // TODO: Refactor and make this an error }, "complexity": { - "noExcessiveCognitiveComplexity": "warn", + "noExcessiveCognitiveComplexity": "warn", // TODO: Refactor and make this an error "useLiteralKeys": "off", "noForEach": "off", // Foreach vs for of is not that simple. "noUselessSwitchCase": "off", // Explicit > Implicit diff --git a/eslint.config.js b/eslint.config.js index a97e3902411..aebcab7feae 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,9 +1,10 @@ -import tseslint from "@typescript-eslint/eslint-plugin"; +/** @ts-check */ +import tseslint from "typescript-eslint"; import stylisticTs from "@stylistic/eslint-plugin-ts"; import parser from "@typescript-eslint/parser"; import importX from "eslint-plugin-import-x"; -export default [ +export default tseslint.config( { name: "eslint-config", files: ["src/**/*.{ts,tsx,js,jsx}", "test/**/*.{ts,tsx,js,jsx}"], @@ -14,12 +15,11 @@ export default [ plugins: { "import-x": importX, "@stylistic/ts": stylisticTs, - "@typescript-eslint": tseslint, + "@typescript-eslint": tseslint.plugin, }, rules: { - "prefer-const": "error", // Enforces the use of `const` for variables that are never reassigned "no-undef": "off", // Disables the rule that disallows the use of undeclared variables (TypeScript handles this) - "no-extra-semi": ["error"], // Disallows unnecessary semicolons for TypeScript-specific syntax + "no-extra-semi": "error", // Disallows unnecessary semicolons for TypeScript-specific syntax "import-x/extensions": ["error", "never", { json: "always" }], // Enforces no extension for imports unless json }, }, @@ -33,11 +33,11 @@ export default [ }, }, plugins: { - "@typescript-eslint": tseslint, + "@typescript-eslint": tseslint.plugin, }, rules: { "@typescript-eslint/no-floating-promises": "error", // Require Promise-like statements to be handled appropriately. - https://typescript-eslint.io/rules/no-floating-promises/ "@typescript-eslint/no-misused-promises": "error", // Disallow Promises in places not designed to handle them. - https://typescript-eslint.io/rules/no-misused-promises/ }, }, -]; +); diff --git a/package.json b/package.json index 341bca80c2e..938d362f263 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "build": "vite build", "build:beta": "vite build --mode beta", "preview": "vite preview", - "test": "vitest run", + "test": "vitest run --no-isolate", "test:cov": "vitest run --coverage --no-isolate", "test:watch": "vitest watch --coverage --no-isolate", "test:silent": "vitest run --silent --no-isolate", diff --git a/public/locales b/public/locales index 18c1963ef30..833dc40ec74 160000 --- a/public/locales +++ b/public/locales @@ -1 +1 @@ -Subproject commit 18c1963ef309612a5a7fef76f9879709a7202189 +Subproject commit 833dc40ec7409031fcea147ccbc45ec9c0ba0213 diff --git a/src/data/balance/pokemon-level-moves.ts b/src/data/balance/pokemon-level-moves.ts index dcbc2fb0c0d..0b0ba1b5f71 100644 --- a/src/data/balance/pokemon-level-moves.ts +++ b/src/data/balance/pokemon-level-moves.ts @@ -19383,6 +19383,44 @@ export const pokemonFormLevelMoves: PokemonSpeciesFormLevelMoves = { [ 100, Moves.SEED_FLARE ], ] }, + [Species.BASCULIN]: { + 1: [ + [ 1, Moves.TAIL_WHIP ], + [ 1, Moves.WATER_GUN ], + [ 4, Moves.TACKLE ], + [ 8, Moves.FLAIL ], + [ 12, Moves.AQUA_JET ], + [ 16, Moves.BITE ], + [ 20, Moves.SCARY_FACE ], + [ 24, Moves.HEADBUTT ], + [ 28, Moves.SOAK ], + [ 32, Moves.CRUNCH ], + [ 36, Moves.TAKE_DOWN ], + [ 40, Moves.FINAL_GAMBIT ], + [ 44, Moves.WAVE_CRASH ], + [ 48, Moves.THRASH ], + [ 52, Moves.DOUBLE_EDGE ], + [ 56, Moves.HEAD_SMASH ], + ], + 2: [ + [ 1, Moves.TAIL_WHIP ], + [ 1, Moves.WATER_GUN ], + [ 4, Moves.TACKLE ], + [ 8, Moves.FLAIL ], + [ 12, Moves.AQUA_JET ], + [ 16, Moves.BITE ], + [ 20, Moves.SCARY_FACE ], + [ 24, Moves.HEADBUTT ], + [ 28, Moves.SOAK ], + [ 32, Moves.CRUNCH ], + [ 36, Moves.TAKE_DOWN ], + [ 40, Moves.UPROAR ], + [ 44, Moves.WAVE_CRASH ], + [ 48, Moves.THRASH ], + [ 52, Moves.DOUBLE_EDGE ], + [ 56, Moves.HEAD_SMASH ], + ] + }, [Species.KYUREM]: { 1: [ [ 1, Moves.DRAGON_BREATH ], diff --git a/src/data/balance/signature-species.ts b/src/data/balance/signature-species.ts index e2fecaa12ff..fb8f33d4435 100644 --- a/src/data/balance/signature-species.ts +++ b/src/data/balance/signature-species.ts @@ -4,12 +4,19 @@ export type SignatureSpecies = { [key in string]: (Species | Species[])[]; }; -/* +/** * The signature species for each Gym Leader, Elite Four member, and Champion. * The key is the trainer type, and the value is an array of Species or Species arrays. * This is in a separate const so it can be accessed from other places and not just the trainerConfigs + * + * @remarks + * The `Proxy` object allows us to define a handler that will intercept + * the property access and return an empty array if the property does not exist in the object. + * + * This means that accessing `signatureSpecies` will not throw an error if the property does not exist, + * but instead default to an empty array. */ -export const signatureSpecies: SignatureSpecies = { +export const signatureSpecies: SignatureSpecies = new Proxy({ // Gym Leaders- Kanto BROCK: [Species.ONIX, Species.GEODUDE, [Species.OMANYTE, Species.KABUTO], Species.AERODACTYL], MISTY: [Species.STARYU, Species.PSYDUCK, Species.WOOPER, Species.LAPRAS], @@ -92,71 +99,8 @@ export const signatureSpecies: SignatureSpecies = { RYME: [Species.TOXEL, Species.GREAVARD, Species.SHUPPET, Species.MIMIKYU], // Tera Ghost Toxel TULIP: [Species.FLABEBE, Species.FLITTLE, Species.RALTS, Species.GIRAFARIG], // Tera Psychic Flabebe GRUSHA: [Species.SWABLU, Species.CETODDLE, Species.SNOM, Species.CUBCHOO], // Tera Ice Swablu - - // Elite Four- Kanto - LORELEI: [ - Species.JYNX, - [Species.SLOWBRO, Species.GALAR_SLOWBRO], - Species.LAPRAS, - [Species.CLOYSTER, Species.ALOLA_SANDSLASH], - ], - BRUNO: [Species.MACHAMP, Species.HITMONCHAN, Species.HITMONLEE, [Species.GOLEM, Species.ALOLA_GOLEM]], - AGATHA: [Species.GENGAR, [Species.ARBOK, Species.WEEZING], Species.CROBAT, Species.ALOLA_MAROWAK], - LANCE: [Species.DRAGONITE, Species.GYARADOS, Species.AERODACTYL, Species.ALOLA_EXEGGUTOR], - // Elite Four- Johto (Bruno included) - WILL: [Species.XATU, Species.JYNX, [Species.SLOWBRO, Species.SLOWKING], Species.EXEGGUTOR], - KOGA: [[Species.MUK, Species.WEEZING], [Species.VENOMOTH, Species.ARIADOS], Species.CROBAT, Species.TENTACRUEL], - KAREN: [Species.UMBREON, Species.HONCHKROW, Species.HOUNDOOM, Species.WEAVILE], - // Elite Four- Hoenn - SIDNEY: [ - [Species.SHIFTRY, Species.CACTURNE], - [Species.SHARPEDO, Species.CRAWDAUNT], - Species.ABSOL, - Species.MIGHTYENA, - ], - PHOEBE: [Species.SABLEYE, Species.DUSKNOIR, Species.BANETTE, [Species.DRIFBLIM, Species.MISMAGIUS]], - GLACIA: [Species.GLALIE, Species.WALREIN, Species.FROSLASS, Species.ABOMASNOW], - DRAKE: [Species.ALTARIA, Species.SALAMENCE, Species.FLYGON, Species.KINGDRA], - // Elite Four- Sinnoh - AARON: [[Species.SCIZOR, Species.KLEAVOR], Species.HERACROSS, [Species.VESPIQUEN, Species.YANMEGA], Species.DRAPION], - BERTHA: [Species.WHISCASH, Species.HIPPOWDON, Species.GLISCOR, Species.RHYPERIOR], - FLINT: [ - [Species.RAPIDASH, Species.FLAREON], - Species.MAGMORTAR, - [Species.STEELIX, Species.LOPUNNY], - Species.INFERNAPE, - ], // Tera Fire Steelix or Lopunny - LUCIAN: [Species.MR_MIME, Species.GALLADE, Species.BRONZONG, [Species.ALAKAZAM, Species.ESPEON]], - // Elite Four- Unova - SHAUNTAL: [Species.COFAGRIGUS, Species.CHANDELURE, Species.GOLURK, Species.JELLICENT], - MARSHAL: [Species.CONKELDURR, Species.MIENSHAO, Species.THROH, Species.SAWK], - GRIMSLEY: [Species.LIEPARD, Species.KINGAMBIT, Species.SCRAFTY, Species.KROOKODILE], - CAITLIN: [Species.MUSHARNA, Species.GOTHITELLE, Species.SIGILYPH, Species.REUNICLUS], - // Elite Four- Kalos - MALVA: [Species.PYROAR, Species.TORKOAL, Species.CHANDELURE, Species.TALONFLAME], - SIEBOLD: [Species.CLAWITZER, Species.GYARADOS, Species.BARBARACLE, Species.STARMIE], - WIKSTROM: [Species.KLEFKI, Species.PROBOPASS, Species.SCIZOR, Species.AEGISLASH], - DRASNA: [Species.DRAGALGE, Species.DRUDDIGON, Species.ALTARIA, Species.NOIVERN], - // Elite Four- Alola - HALA: [Species.HARIYAMA, Species.BEWEAR, Species.CRABOMINABLE, [Species.POLIWRATH, Species.ANNIHILAPE]], - MOLAYNE: [Species.KLEFKI, Species.MAGNEZONE, Species.METAGROSS, Species.ALOLA_DUGTRIO], - OLIVIA: [Species.RELICANTH, Species.CARBINK, Species.ALOLA_GOLEM, Species.LYCANROC], - ACEROLA: [[Species.BANETTE, Species.DRIFBLIM], Species.MIMIKYU, Species.DHELMISE, Species.PALOSSAND], - KAHILI: [[Species.BRAVIARY, Species.MANDIBUZZ], Species.HAWLUCHA, Species.ORICORIO, Species.TOUCANNON], - // Elite Four- Galar - MARNIE_ELITE: [Species.MORPEKO, Species.LIEPARD, [Species.TOXICROAK, Species.SCRAFTY], Species.GRIMMSNARL], - NESSA_ELITE: [Species.GOLISOPOD, [Species.QUAGSIRE, Species.PELIPPER], Species.TOXAPEX, Species.DREDNAW], - BEA_ELITE: [Species.HAWLUCHA, [Species.GRAPPLOCT, Species.SIRFETCHD], Species.FALINKS, Species.MACHAMP], - ALLISTER_ELITE: [Species.DUSKNOIR, [Species.POLTEAGEIST, Species.RUNERIGUS], Species.CURSOLA, Species.GENGAR], - RAIHAN_ELITE: [Species.GOODRA, [Species.TORKOAL, Species.TURTONATOR], Species.FLYGON, Species.ARCHALUDON], - // Elite Four- Paldea - RIKA: [Species.CLODSIRE, [Species.DUGTRIO, Species.DONPHAN], Species.CAMERUPT, Species.WHISCASH], // Tera Ground Clodsire - POPPY: [Species.TINKATON, Species.BRONZONG, Species.CORVIKNIGHT, Species.COPPERAJAH], // Tera Steel Tinkaton - LARRY_ELITE: [Species.FLAMIGO, Species.STARAPTOR, [Species.ALTARIA, Species.TROPIUS], Species.ORICORIO], // Tera Flying Flamigo; random Oricorio - HASSEL: [Species.BAXCALIBUR, [Species.FLAPPLE, Species.APPLETUN], Species.DRAGALGE, Species.NOIVERN], // Tera Dragon Baxcalibur - // Elite Four- BBL - CRISPIN: [Species.BLAZIKEN, Species.MAGMORTAR, [Species.CAMERUPT, Species.TALONFLAME], Species.ROTOM], // Tera Fire Blaziken; Heat Rotom - AMARYS: [Species.METAGROSS, Species.SCIZOR, Species.EMPOLEON, Species.SKARMORY], // Tera Steel Metagross - LACEY: [Species.EXCADRILL, Species.PRIMARINA, [Species.WHIMSICOTT, Species.ALCREMIE], Species.GRANBULL], // Tera Fairy Excadrill - DRAYTON: [Species.ARCHALUDON, Species.DRAGONITE, Species.HAXORUS, Species.SCEPTILE], // Tera Dragon Archaludon -}; +}, { + get(target, prop: string) { + return target[prop as keyof SignatureSpecies] ?? []; + } +}); diff --git a/src/data/balance/tms.ts b/src/data/balance/tms.ts index 62199fd6968..69aef9b135d 100644 --- a/src/data/balance/tms.ts +++ b/src/data/balance/tms.ts @@ -5724,7 +5724,6 @@ export const tmSpecies: TmSpecies = { Species.SCOLIPEDE, Species.WHIMSICOTT, Species.LILLIGANT, - Species.BASCULIN, Species.KROOKODILE, Species.DARMANITAN, Species.CRUSTLE, @@ -6023,6 +6022,11 @@ export const tmSpecies: TmSpecies = { Species.HISUI_DECIDUEYE, Species.PALDEA_TAUROS, Species.BLOODMOON_URSALUNA, + [ + Species.BASCULIN, + "blue-striped", + "red-striped", + ] ], [Moves.LOW_KICK]: [ Species.SANDSHREW, @@ -19335,7 +19339,6 @@ export const tmSpecies: TmSpecies = { Species.CONKELDURR, Species.THROH, Species.SAWK, - Species.BASCULIN, Species.DARMANITAN, Species.SCRAFTY, Species.ESCAVALIER, @@ -19449,6 +19452,11 @@ export const tmSpecies: TmSpecies = { Species.HISUI_BRAVIARY, Species.HISUI_DECIDUEYE, Species.PALDEA_TAUROS, + [ + Species.BASCULIN, + "blue-striped", + "red-striped", + ], ], [Moves.SPITE]: [ Species.EKANS, @@ -51341,7 +51349,6 @@ export const tmSpecies: TmSpecies = { Species.SCOLIPEDE, Species.WHIMSICOTT, Species.LILLIGANT, - Species.BASCULIN, Species.KROOKODILE, Species.DARMANITAN, Species.CRUSTLE, @@ -51655,6 +51662,11 @@ export const tmSpecies: TmSpecies = { Species.HISUI_DECIDUEYE, Species.PALDEA_TAUROS, Species.BLOODMOON_URSALUNA, + [ + Species.BASCULIN, + "blue-striped", + "red-striped", + ], ], [Moves.NASTY_PLOT]: [ Species.PIKACHU, diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index bc047762fb6..f02c98fad1f 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -652,7 +652,7 @@ export default class Move implements Localizable { break; case MoveFlags.IGNORE_ABILITIES: if (user.hasAbilityWithAttr(MoveAbilityBypassAbAttr)) { - const abilityEffectsIgnored = new BooleanHolder(false); + const abilityEffectsIgnored = new BooleanHolder(false); applyAbAttrs(MoveAbilityBypassAbAttr, user, abilityEffectsIgnored, false, this); if (abilityEffectsIgnored.value) { return true; @@ -2463,7 +2463,7 @@ export class StatusEffectAttr extends MoveEffectAttr { return false; } if (((!pokemon.status || this.overrideStatus) || (pokemon.status.effect === this.effect && moveChance < 0)) - && pokemon.trySetStatus(this.effect, true, user, this.turnsRemaining, null, this.overrideStatus)) { + && pokemon.trySetStatus(this.effect, true, user, this.turnsRemaining, null, this.overrideStatus, false)) { applyPostAttackAbAttrs(ConfusionOnStatusEffectAbAttr, user, target, move, null, false, this.effect); return true; } @@ -3160,7 +3160,7 @@ export class StatStageChangeAttr extends MoveEffectAttr { private get showMessage () { return this.options?.showMessage ?? true; } - + /** * Attempts to change stats of the user or target (depending on value of selfTarget) if conditions are met * @param user {@linkcode Pokemon} the user of the move @@ -6326,11 +6326,11 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { if (!allyPokemon?.isActive(true) && switchOutTarget.hp) { globalScene.pushPhase(new BattleEndPhase(false)); - + if (globalScene.gameMode.hasRandomBiomes || globalScene.isNewBiome()) { globalScene.pushPhase(new SelectBiomePhase()); } - + globalScene.pushPhase(new NewBattlePhase()); } } @@ -8618,7 +8618,9 @@ export function initMoves() { .condition((user, target, move) => !target.summonData?.illusion && !user.summonData?.illusion) // transforming from or into fusion pokemon causes various problems (such as crashes) .condition((user, target, move) => !target.getTag(BattlerTagType.SUBSTITUTE) && !user.fusionSpecies && !target.fusionSpecies) - .ignoresProtect(), + .ignoresProtect() + // Transforming should copy the target's rage fist hit count + .edgeCase(), new AttackMove(Moves.BUBBLE, PokemonType.WATER, MoveCategory.SPECIAL, 40, 100, 30, 10, 0, 1) .attr(StatStageChangeAttr, [ Stat.SPD ], -1) .target(MoveTarget.ALL_NEAR_ENEMIES), diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index 2fff2b562c0..5a9a6ee9b3d 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -488,6 +488,7 @@ export abstract class PokemonSpeciesForm { if (formSpriteKey.startsWith("behemoth")) { formSpriteKey = "crowned"; } + // biome-ignore lint/suspicious/no-fallthrough: Falls through default: ret += `-${formSpriteKey}`; break; diff --git a/src/data/trainers/trainer-config.ts b/src/data/trainers/trainer-config.ts index a2e62e6761b..50acf84efa6 100644 --- a/src/data/trainers/trainer-config.ts +++ b/src/data/trainers/trainer-config.ts @@ -707,11 +707,11 @@ export class TrainerConfig { /** * Initializes the trainer configuration for an Elite Four member. - * @param {Species | Species[]} signatureSpecies The signature species for the Elite Four member. - * @param isMale Whether the Elite Four Member is Male or Female (for localization of the title). - * @param specialtyType {PokemonType} The specialty type for the Elite Four member. - * @param teraSlot Optional, sets the party member in this slot to Terastallize. - * @returns {TrainerConfig} The updated TrainerConfig instance. + * @param signatureSpecies - The signature species for the Elite Four member. + * @param isMale - Whether the Elite Four Member is Male or Female (for localization of the title). + * @param specialtyType - The specialty type for the Elite Four member. + * @param teraSlot - Optional, sets the party member in this slot to Terastallize. + * @returns The updated TrainerConfig instance. **/ initForEliteFour( signatureSpecies: (Species | Species[])[], @@ -2853,146 +2853,688 @@ export const trainerConfigs: TrainerConfigs = { .setMixedBattleBgm("battle_paldea_gym"), [TrainerType.LORELEI]: new TrainerConfig((t = TrainerType.LORELEI)) - .initForEliteFour(signatureSpecies["LORELEI"], false, PokemonType.ICE) + .initForEliteFour(signatureSpecies["LORELEI"], false, PokemonType.ICE, 2) .setBattleBgm("battle_kanto_gym") - .setMixedBattleBgm("battle_kanto_gym"), + .setMixedBattleBgm("battle_kanto_gym") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.DEWGONG], TrainerSlot.TRAINER, true, p => { + p.abilityIndex = 0; // Thick Fat + p.generateAndPopulateMoveset(); + }), + ) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.SLOWBRO, Species.GALAR_SLOWBRO], TrainerSlot.TRAINER, true, p => { // Tera Ice Slowbro/G-Slowbro + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.ICE_BEAM)) { // Check if Ice Beam is in the moveset, if not, replace the third move with Ice Beam. + p.moveset[2] = new PokemonMove(Moves.ICE_BEAM); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.JYNX])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.CLOYSTER, Species.ALOLA_SANDSLASH])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.LAPRAS], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.BRUNO]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["BRUNO"], true, PokemonType.FIGHTING) + .initForEliteFour(signatureSpecies["BRUNO"], true, PokemonType.FIGHTING, 2) .setBattleBgm("battle_kanto_gym") - .setMixedBattleBgm("battle_kanto_gym"), + .setMixedBattleBgm("battle_kanto_gym") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.HITMONLEE, Species.HITMONCHAN, Species.HITMONTOP])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.STEELIX], TrainerSlot.TRAINER, true, p => { // Tera Fighting Steelix + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.BODY_PRESS)) { // Check if Body Press is in the moveset, if not, replace the third move with Body Press. + p.moveset[2] = new PokemonMove(Moves.BODY_PRESS); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.POLIWRATH])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.ANNIHILAPE])) + .setPartyMemberFunc( + 5, + getRandomPartyMemberFunc([Species.MACHAMP], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.AGATHA]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["AGATHA"], false, PokemonType.GHOST) + .initForEliteFour(signatureSpecies["AGATHA"], false, PokemonType.GHOST, 2) .setBattleBgm("battle_kanto_gym") - .setMixedBattleBgm("battle_kanto_gym"), + .setMixedBattleBgm("battle_kanto_gym") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.MISMAGIUS])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.ARBOK, Species.WEEZING], TrainerSlot.TRAINER, true, p => { // Tera Ghost Arbok/Weezing + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.TERA_BLAST)) { // Check if Tera Blast is in the moveset, if not, replace the third move with Tera Blast. + p.moveset[2] = new PokemonMove(Moves.TERA_BLAST); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.ALOLA_MAROWAK])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.CURSOLA])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.GENGAR], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.LANCE]: new TrainerConfig(++t) .setName("Lance") - .initForEliteFour(signatureSpecies["LANCE"], true, PokemonType.DRAGON) + .initForEliteFour(signatureSpecies["LANCE"], true, PokemonType.DRAGON, 2) .setBattleBgm("battle_kanto_gym") - .setMixedBattleBgm("battle_kanto_gym"), + .setMixedBattleBgm("battle_kanto_gym") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.KINGDRA])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.GYARADOS, Species.AERODACTYL], TrainerSlot.TRAINER, true, p => { // Tera Dragon Gyarados/Aerodactyl + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.TERA_BLAST)) { // Check if Tera Blast is in the moveset, if not, replace the third move with Tera Blast. + p.moveset[2] = new PokemonMove(Moves.TERA_BLAST); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.ALOLA_EXEGGUTOR])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.SALAMENCE])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.DRAGONITE], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.WILL]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["WILL"], true, PokemonType.PSYCHIC) + .initForEliteFour(signatureSpecies["WILL"], true, PokemonType.PSYCHIC, 2) .setBattleBgm("battle_johto_gym") - .setMixedBattleBgm("battle_johto_gym"), + .setMixedBattleBgm("battle_johto_gym") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.JYNX])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.SLOWKING, Species.GALAR_SLOWKING])) // Tera Psychic Slowking/G-Slowking + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.EXEGGUTOR])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.WYRDEER, Species.FARIGIRAF])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.XATU], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.KOGA]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["KOGA"], true, PokemonType.POISON) + .initForEliteFour(signatureSpecies["KOGA"], true, PokemonType.POISON, 2) .setBattleBgm("battle_johto_gym") - .setMixedBattleBgm("battle_johto_gym"), + .setMixedBattleBgm("battle_johto_gym") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.VENOMOTH], TrainerSlot.TRAINER, true, p => { + p.abilityIndex = 1; // Tinted Lens + p.generateAndPopulateMoveset(); + }), + ) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.MUK, Species.WEEZING])) // Tera Poison Muk/Weezing + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.TENTACRUEL])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.SNEASLER, Species.OVERQWIL])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.CROBAT], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.KAREN]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["KAREN"], false, PokemonType.DARK) + .initForEliteFour(signatureSpecies["KAREN"], false, PokemonType.DARK, 2) .setBattleBgm("battle_johto_gym") - .setMixedBattleBgm("battle_johto_gym"), + .setMixedBattleBgm("battle_johto_gym") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.UMBREON])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.GENGAR], TrainerSlot.TRAINER, true, p => { // Tera Dark Gengar + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.DARK_PULSE)) { // Check if Dark Pulse is in the moveset, if not, replace the third move with Dark Pulse. + p.moveset[2] = new PokemonMove(Moves.DARK_PULSE); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.HONCHKROW])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.WEAVILE])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.HOUNDOOM], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.SIDNEY]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["SIDNEY"], true, PokemonType.DARK) - .setMixedBattleBgm("battle_hoenn_elite"), + .initForEliteFour(signatureSpecies["SIDNEY"], true, PokemonType.DARK, 2) + .setMixedBattleBgm("battle_hoenn_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.MIGHTYENA], TrainerSlot.TRAINER, true, p => { + p.abilityIndex = 0; // Intimidate + p.generateAndPopulateMoveset(); + }), + ) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.OBSTAGOON])) // Tera Dark Obstagoon + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.SHIFTRY, Species.CACTURNE])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.SHARPEDO, Species.CRAWDAUNT])) + .setPartyMemberFunc( + 5, + getRandomPartyMemberFunc([Species.ABSOL], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.PHOEBE]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["PHOEBE"], false, PokemonType.GHOST) - .setMixedBattleBgm("battle_hoenn_elite"), + .initForEliteFour(signatureSpecies["PHOEBE"], false, PokemonType.GHOST, 2) + .setMixedBattleBgm("battle_hoenn_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.SABLEYE])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.BANETTE])) // Tera Ghost Banette + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.DRIFBLIM, Species.MISMAGIUS])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.ORICORIO, Species.ALOLA_MAROWAK], TrainerSlot.TRAINER, true, p => { + p.generateAndPopulateMoveset(); + p.formIndex = p.species.speciesId === Species.ORICORIO ? 3 : 0; // Oricorio-Sensu + }), + ) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.DUSKNOIR], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.GLACIA]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["GLACIA"], false, PokemonType.ICE) - .setMixedBattleBgm("battle_hoenn_elite"), + .initForEliteFour(signatureSpecies["GLACIA"], false, PokemonType.ICE, 2) + .setMixedBattleBgm("battle_hoenn_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.ABOMASNOW], TrainerSlot.TRAINER, true, p => { + p.abilityIndex = 0; // Snow Warning + p.generateAndPopulateMoveset(); + }), + ) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.GLALIE])) // Tera Ice Glalie + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.FROSLASS])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.ALOLA_NINETALES])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.WALREIN], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.DRAKE]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["DRAKE"], true, PokemonType.DRAGON) - .setMixedBattleBgm("battle_hoenn_elite"), + .initForEliteFour(signatureSpecies["DRAKE"], true, PokemonType.DRAGON, 2) + .setMixedBattleBgm("battle_hoenn_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.ALTARIA])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.DHELMISE], TrainerSlot.TRAINER, true, p => { // Tera Dragon Dhelmise + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.TERA_BLAST)) { // Check if Tera Blast is in the moveset, if not, replace the third move with Tera Blast. + p.moveset[2] = new PokemonMove(Moves.TERA_BLAST); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.FLYGON])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.KINGDRA])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.SALAMENCE], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.AARON]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["AARON"], true, PokemonType.BUG) + .initForEliteFour(signatureSpecies["AARON"], true, PokemonType.BUG, 5) .setBattleBgm("battle_sinnoh_gym") - .setMixedBattleBgm("battle_sinnoh_gym"), + .setMixedBattleBgm("battle_sinnoh_gym") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.YANMEGA])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.HERACROSS])) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.VESPIQUEN])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.SCIZOR, Species.KLEAVOR])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.DRAPION], TrainerSlot.TRAINER, true, p => { // Tera Bug Drapion + p.setBoss(true, 2); + p.abilityIndex = 1; // Sniper + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.X_SCISSOR)) { // Check if X-Scissor is in the moveset, if not, replace the third move with X-Scissor. + p.moveset[2] = new PokemonMove(Moves.X_SCISSOR); + } + }), + ), [TrainerType.BERTHA]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["BERTHA"], false, PokemonType.GROUND) + .initForEliteFour(signatureSpecies["BERTHA"], false, PokemonType.GROUND, 2) .setBattleBgm("battle_sinnoh_gym") - .setMixedBattleBgm("battle_sinnoh_gym"), + .setMixedBattleBgm("battle_sinnoh_gym") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.WHISCASH])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.HIPPOWDON], TrainerSlot.TRAINER, true, p => { // Tera Ground Hippowdon + p.abilityIndex = 0; // Sand Stream + p.generateAndPopulateMoveset(); + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.GLISCOR])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.MAMOSWINE, Species.URSALUNA])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.RHYPERIOR], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.abilityIndex = 1; // Solid Rock + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.FLINT]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["FLINT"], true, PokemonType.FIRE, 3) + .initForEliteFour(signatureSpecies["FLINT"], true, PokemonType.FIRE, 2) .setBattleBgm("battle_sinnoh_gym") - .setMixedBattleBgm("battle_sinnoh_gym"), + .setMixedBattleBgm("battle_sinnoh_gym") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.RAPIDASH])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.STEELIX, Species.LOPUNNY], TrainerSlot.TRAINER, true, p => { // Tera Fire Steelix/Lopunny + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.TERA_BLAST)) { // Check if Tera Blast is in the moveset, if not, replace the third move with Tera Blast. + p.moveset[2] = new PokemonMove(Moves.TERA_BLAST); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.INFERNAPE])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.ARCANINE, Species.HISUI_ARCANINE])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.MAGMORTAR], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.LUCIAN]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["LUCIAN"], true, PokemonType.PSYCHIC) + .initForEliteFour(signatureSpecies["LUCIAN"], true, PokemonType.PSYCHIC, 2) .setBattleBgm("battle_sinnoh_gym") - .setMixedBattleBgm("battle_sinnoh_gym"), + .setMixedBattleBgm("battle_sinnoh_gym") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.ESPEON, Species.ALAKAZAM])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.FARIGIRAF])) // Tera Psychic Farigiraf + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.BRONZONG])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.MR_RIME, Species.HISUI_BRAVIARY])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.GALLADE], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.abilityIndex = 1; // Sharpness + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.SHAUNTAL]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["SHAUNTAL"], false, PokemonType.GHOST) - .setMixedBattleBgm("battle_unova_elite"), + .initForEliteFour(signatureSpecies["SHAUNTAL"], false, PokemonType.GHOST, 2) + .setMixedBattleBgm("battle_unova_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.COFAGRIGUS])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.GOLURK])) // Tera Ghost Golurk + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.JELLICENT])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.MISMAGIUS, Species.FROSLASS ])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.CHANDELURE], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.MARSHAL]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["MARSHAL"], true, PokemonType.FIGHTING) - .setMixedBattleBgm("battle_unova_elite"), + .initForEliteFour(signatureSpecies["MARSHAL"], true, PokemonType.FIGHTING, 2) + .setMixedBattleBgm("battle_unova_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.THROH, Species.SAWK])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.MIENSHAO])) // Tera Fighting Mienshao + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.EMBOAR])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.BRELOOM, Species.TOXICROAK])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.CONKELDURR], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.GRIMSLEY]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["GRIMSLEY"], true, PokemonType.DARK) - .setMixedBattleBgm("battle_unova_elite"), + .initForEliteFour(signatureSpecies["GRIMSLEY"], true, PokemonType.DARK, 2) + .setMixedBattleBgm("battle_unova_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.LIEPARD])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.KROOKODILE])) // Tera Dark Krookodile + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.SCRAFTY])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.ZOROARK, Species.HISUI_SAMUROTT])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.KINGAMBIT], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.CAITLIN]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["CAITLIN"], false, PokemonType.PSYCHIC) - .setMixedBattleBgm("battle_unova_elite"), + .initForEliteFour(signatureSpecies["CAITLIN"], false, PokemonType.PSYCHIC, 2) + .setMixedBattleBgm("battle_unova_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.MUSHARNA])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.REUNICLUS])) // Tera Psychic Reuniclus + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.GALLADE], TrainerSlot.TRAINER, true, p => { + p.abilityIndex = 1; // Sharpness + p.generateAndPopulateMoveset(); + }), + ) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.SIGILYPH, Species.HISUI_BRAVIARY])) + .setPartyMemberFunc( + 5, + getRandomPartyMemberFunc([Species.GOTHITELLE], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.MALVA]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["MALVA"], false, PokemonType.FIRE) - .setMixedBattleBgm("battle_kalos_elite"), + .initForEliteFour(signatureSpecies["MALVA"], false, PokemonType.FIRE, 2) + .setMixedBattleBgm("battle_kalos_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.PYROAR], TrainerSlot.TRAINER, true, p => { + p.generateAndPopulateMoveset(); + p.gender = Gender.FEMALE; + }), + ) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.HOUNDOOM])) // Tera Fire Houndoom + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.TORKOAL], TrainerSlot.TRAINER, true, p => { + p.abilityIndex = 1; // Drought + p.generateAndPopulateMoveset(); + }), + ) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.CHANDELURE, Species.DELPHOX])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.TALONFLAME], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.SIEBOLD]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["SIEBOLD"], true, PokemonType.WATER) - .setMixedBattleBgm("battle_kalos_elite"), + .initForEliteFour(signatureSpecies["SIEBOLD"], true, PokemonType.WATER, 2) + .setMixedBattleBgm("battle_kalos_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.CLAWITZER])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.GYARADOS])) // Tera Water Gyarados + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.STARMIE])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.BLASTOISE, Species.DONDOZO])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.BARBARACLE], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.abilityIndex = 1; // Tough Claws + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.WIKSTROM]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["WIKSTROM"], true, PokemonType.STEEL) - .setMixedBattleBgm("battle_kalos_elite"), + .initForEliteFour(signatureSpecies["WIKSTROM"], true, PokemonType.STEEL, 2) + .setMixedBattleBgm("battle_kalos_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.KLEFKI])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.CERULEDGE], TrainerSlot.TRAINER, true, p => { // Tera Steel Ceruledge + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.IRON_HEAD)) { // Check if Iron Head is in the moveset, if not, replace the third move with Iron Head. + p.moveset[2] = new PokemonMove(Moves.IRON_HEAD); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.SCIZOR])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.CORVIKNIGHT])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.AEGISLASH], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.DRASNA]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["DRASNA"], false, PokemonType.DRAGON) - .setMixedBattleBgm("battle_kalos_elite"), + .initForEliteFour(signatureSpecies["DRASNA"], false, PokemonType.DRAGON, 2) + .setMixedBattleBgm("battle_kalos_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.DRAGALGE])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.GARCHOMP])) // Tera Dragon Garchomp + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.ALTARIA])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.DRUDDIGON])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.NOIVERN], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.HALA]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["HALA"], true, PokemonType.FIGHTING) - .setMixedBattleBgm("battle_alola_elite"), + .initForEliteFour(signatureSpecies["HALA"], true, PokemonType.FIGHTING, 2) + .setMixedBattleBgm("battle_alola_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.HARIYAMA])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.INCINEROAR], TrainerSlot.TRAINER, true, p => { // Tera Fighting Incineroar + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.CROSS_CHOP)) { // Check if Cross Chop is in the moveset, if not, replace the third move with Cross Chop. + p.moveset[2] = new PokemonMove(Moves.CROSS_CHOP); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.BEWEAR])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.POLIWRATH, Species.ANNIHILAPE])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.CRABOMINABLE], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.MOLAYNE]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["MOLAYNE"], true, PokemonType.STEEL) - .setMixedBattleBgm("battle_alola_elite"), + .initForEliteFour(signatureSpecies["MOLAYNE"], true, PokemonType.STEEL, 2) + .setMixedBattleBgm("battle_alola_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.KLEFKI])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.ALOLA_SANDSLASH])) // Tera Steel A-Sandslash + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.MAGNEZONE])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.METAGROSS, Species.KINGAMBIT])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.ALOLA_DUGTRIO], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.OLIVIA]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["OLIVIA"], false, PokemonType.ROCK) - .setMixedBattleBgm("battle_alola_elite"), + .initForEliteFour(signatureSpecies["OLIVIA"], false, PokemonType.ROCK, 2) + .setMixedBattleBgm("battle_alola_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.GIGALITH], TrainerSlot.TRAINER, true, p => { + p.abilityIndex = 1; // Sand Stream + p.generateAndPopulateMoveset(); + }), + ) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.PROBOPASS])) // Tera Rock Probopass + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.ALOLA_GOLEM])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.RELICANTH, Species.CARBINK])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.LYCANROC], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.formIndex = 1; + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.ACEROLA]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["ACEROLA"], false, PokemonType.GHOST) - .setMixedBattleBgm("battle_alola_elite"), + .initForEliteFour(signatureSpecies["ACEROLA"], false, PokemonType.GHOST, 2) + .setMixedBattleBgm("battle_alola_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.DRIFBLIM])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.MIMIKYU])) // Tera Ghost Mimikyu + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.DHELMISE])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.FROSLASS])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.PALOSSAND], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.KAHILI]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["KAHILI"], false, PokemonType.FLYING) - .setMixedBattleBgm("battle_alola_elite"), + .initForEliteFour(signatureSpecies["KAHILI"], false, PokemonType.FLYING, 2) + .setMixedBattleBgm("battle_alola_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.HAWLUCHA])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.DECIDUEYE], TrainerSlot.TRAINER, true, p => { // Tera Flying Decidueye + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.BRAVE_BIRD)) { // Check if Brave Bird is in the moveset, if not, replace the third move with Brave Bird. + p.moveset[2] = new PokemonMove(Moves.BRAVE_BIRD); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.BRAVIARY, Species.MANDIBUZZ])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.ORICORIO])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.TOUCANNON], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.MARNIE_ELITE]: new TrainerConfig(++t) .setName("Marnie") - .initForEliteFour(signatureSpecies["MARNIE_ELITE"], false, PokemonType.DARK) - .setMixedBattleBgm("battle_galar_elite"), + .initForEliteFour(signatureSpecies["MARNIE_ELITE"], false, PokemonType.DARK, 2) + .setMixedBattleBgm("battle_galar_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.LIEPARD])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.TOXICROAK], TrainerSlot.TRAINER, true, p => { // Tera Dark Toxicroak + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.SUCKER_PUNCH)) { + // Check if Sucker Punch is in the moveset, if not, replace the third move with Sucker Punch. + p.moveset[2] = new PokemonMove(Moves.SUCKER_PUNCH); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.SCRAFTY, Species.PANGORO])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.MORPEKO])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.GRIMMSNARL], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.NESSA_ELITE]: new TrainerConfig(++t) .setName("Nessa") - .initForEliteFour(signatureSpecies["NESSA_ELITE"], false, PokemonType.WATER) - .setMixedBattleBgm("battle_galar_elite"), + .initForEliteFour(signatureSpecies["NESSA_ELITE"], false, PokemonType.WATER, 2) + .setMixedBattleBgm("battle_galar_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.GOLISOPOD])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.EISCUE], TrainerSlot.TRAINER, true, p => { // Tera Water Eiscue + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.LIQUIDATION)) { // Check if Liquidation is in the moveset, if not, replace the third move with Liquidation. + p.moveset[2] = new PokemonMove(Moves.LIQUIDATION); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.PELIPPER], TrainerSlot.TRAINER, true, p => { + p.abilityIndex = 1; // Drizzle + p.generateAndPopulateMoveset(); + }), + ) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.TOXAPEX])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.DREDNAW], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.BEA_ELITE]: new TrainerConfig(++t) .setName("Bea") - .initForEliteFour(signatureSpecies["BEA_ELITE"], false, PokemonType.FIGHTING) - .setMixedBattleBgm("battle_galar_elite"), + .initForEliteFour(signatureSpecies["BEA_ELITE"], false, PokemonType.FIGHTING, 2) + .setMixedBattleBgm("battle_galar_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.HAWLUCHA])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.SIRFETCHD])) // Tera Fighting Sirfetch'd + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.GRAPPLOCT, Species.FALINKS])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.HITMONTOP])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.MACHAMP], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.ALLISTER_ELITE]: new TrainerConfig(++t) .setName("Allister") - .initForEliteFour(signatureSpecies["ALLISTER_ELITE"], true, PokemonType.GHOST) - .setMixedBattleBgm("battle_galar_elite"), + .initForEliteFour(signatureSpecies["ALLISTER_ELITE"], true, PokemonType.GHOST, 2) + .setMixedBattleBgm("battle_galar_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.DUSKNOIR])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.RUNERIGUS])) // Tera Ghost Runerigus + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.POLTEAGEIST, Species.SINISTCHA])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.CURSOLA])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.GENGAR], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.RAIHAN_ELITE]: new TrainerConfig(++t) .setName("Raihan") - .initForEliteFour(signatureSpecies["RAIHAN_ELITE"], true, PokemonType.DRAGON) - .setMixedBattleBgm("battle_galar_elite"), + .initForEliteFour(signatureSpecies["RAIHAN_ELITE"], true, PokemonType.DRAGON, 2) + .setMixedBattleBgm("battle_galar_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.FLYGON])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.TORKOAL], TrainerSlot.TRAINER, true, p => { // Tera Dragon Torkoal + p.abilityIndex = 1; // Drought + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.TERA_BLAST)) { // Check if Tera Blast is in the moveset, if not, replace the third move with Tera Blast. + p.moveset[2] = new PokemonMove(Moves.TERA_BLAST); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.GOODRA])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.TURTONATOR])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.ARCHALUDON], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.RIKA]: new TrainerConfig(++t) .initForEliteFour(signatureSpecies["RIKA"], false, PokemonType.GROUND, 5) - .setMixedBattleBgm("battle_paldea_elite"), + .setMixedBattleBgm("battle_paldea_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.DUGTRIO])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.DONPHAN])) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.SWAMPERT, Species.TORTERRA])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.CAMERUPT])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.CLODSIRE], TrainerSlot.TRAINER, true, p => { // Tera Ground Clodsire + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.POPPY]: new TrainerConfig(++t) .initForEliteFour(signatureSpecies["POPPY"], false, PokemonType.STEEL, 5) - .setMixedBattleBgm("battle_paldea_elite"), + .setMixedBattleBgm("battle_paldea_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.COPPERAJAH])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.MAGNEZONE])) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.BRONZONG, Species.CORVIKNIGHT], TrainerSlot.TRAINER, true, p => { + p.abilityIndex = p.species.speciesId === Species.BRONZONG ? 0 : 1; // Levitate Bronzong, Unnerve Corviknight + p.generateAndPopulateMoveset(); + }), + ) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.STEELIX])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.TINKATON], TrainerSlot.TRAINER, true, p => { // Tera Steel Tinkaton + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.LARRY_ELITE]: new TrainerConfig(++t) .setName("Larry") .initForEliteFour(signatureSpecies["LARRY_ELITE"], true, PokemonType.FLYING, 5) - .setMixedBattleBgm("battle_paldea_elite"), + .setMixedBattleBgm("battle_paldea_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.ALTARIA])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.BOMBIRDIER])) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.TROPIUS])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.STARAPTOR])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.FLAMIGO], TrainerSlot.TRAINER, true, p => { // Tera Flying Flamigo + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.HASSEL]: new TrainerConfig(++t) .initForEliteFour(signatureSpecies["HASSEL"], true, PokemonType.DRAGON, 5) - .setMixedBattleBgm("battle_paldea_elite"), + .setMixedBattleBgm("battle_paldea_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.NOIVERN])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.DRAGALGE])) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.FLAPPLE, Species.APPLETUN, Species.HYDRAPPLE])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.HAXORUS])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.BAXCALIBUR], TrainerSlot.TRAINER, true, p => { // Tera Dragon Baxcalibur + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.CRISPIN]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["CRISPIN"], true, PokemonType.FIRE, 5) - .setMixedBattleBgm("battle_bb_elite"), + .initForEliteFour(signatureSpecies["CRISPIN"], true, PokemonType.FIRE, 2) + .setMixedBattleBgm("battle_bb_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.ROTOM], TrainerSlot.TRAINER, true, p => { + p.formIndex = 1; // Heat Rotom + p.generateAndPopulateMoveset(); + }), + ) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.EXEGGUTOR], TrainerSlot.TRAINER, true, p => { // Tera Fire Exeggutor + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.TERA_BLAST)) { // Check if Tera Blast is in the moveset, if not, replace the third move with Tera Blast. + p.moveset[2] = new PokemonMove(Moves.TERA_BLAST); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.TALONFLAME], TrainerSlot.TRAINER, true, p => { + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.SUNNY_DAY)) { // Check if Sunny Day is in the moveset, if not, replace the third move with Sunny Day. + p.moveset[2] = new PokemonMove(Moves.SUNNY_DAY); + } + }), + ) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.MAGMORTAR])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.BLAZIKEN], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.AMARYS]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["AMARYS"], false, PokemonType.STEEL, 5) - .setMixedBattleBgm("battle_bb_elite"), + .initForEliteFour(signatureSpecies["AMARYS"], false, PokemonType.STEEL, 2) + .setMixedBattleBgm("battle_bb_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.SKARMORY])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.REUNICLUS], TrainerSlot.TRAINER, true, p => { // Tera Steel Reuniclus + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.FLASH_CANNON)) { // Check if Flash Cannon is in the moveset, if not, replace the third move with Flash Cannon. + p.moveset[2] = new PokemonMove(Moves.FLASH_CANNON); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.EMPOLEON])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.SCIZOR])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.METAGROSS], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.LACEY]: new TrainerConfig(++t) .initForEliteFour(signatureSpecies["LACEY"], false, PokemonType.FAIRY, 5) - .setMixedBattleBgm("battle_bb_elite"), + .setMixedBattleBgm("battle_bb_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.WHIMSICOTT])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.PRIMARINA])) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.GRANBULL])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.ALCREMIE])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.EXCADRILL], TrainerSlot.TRAINER, true, p => { // Tera Fairy Excadrill + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.TERA_BLAST)) { // Check if Tera Blast is in the moveset, if not, replace the third move with Tera Blast. + p.moveset[2] = new PokemonMove(Moves.TERA_BLAST); + } + }), + ), [TrainerType.DRAYTON]: new TrainerConfig(++t) - .initForEliteFour(signatureSpecies["DRAYTON"], true, PokemonType.DRAGON, 5) - .setMixedBattleBgm("battle_bb_elite"), + .initForEliteFour(signatureSpecies["DRAYTON"], true, PokemonType.DRAGON, 2) + .setMixedBattleBgm("battle_bb_elite") + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.DRAGONITE])) + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.SCEPTILE], TrainerSlot.TRAINER, true, p => { // Tera Dragon Sceptile + p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.DUAL_CHOP)) { // Check if Dual Chop is in the moveset, if not, replace the third move with Dual Chop. + p.moveset[2] = new PokemonMove(Moves.DUAL_CHOP); + } + }), + ) + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.HAXORUS])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.KINGDRA, Species.DRACOVISH])) + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.ARCHALUDON], TrainerSlot.TRAINER, true, p => { + p.setBoss(true, 2); + p.generateAndPopulateMoveset(); + }), + ), [TrainerType.BLUE]: new TrainerConfig((t = TrainerType.BLUE)) .initForChampion(true) @@ -3003,29 +3545,18 @@ export const trainerConfigs: TrainerConfigs = { .setDoubleTitle("champion_double") .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.ALAKAZAM])) .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.MACHAMP])) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.HO_OH], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.HO_OH], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.MASTER_BALL; }), ) - .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.RHYPERIOR, Species.ELECTIVIRE, Species.MAGMORTAR])) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc( - [Species.ARCANINE, Species.EXEGGUTOR, Species.GYARADOS], - TrainerSlot.TRAINER, - true, - p => { + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.RHYPERIOR, Species.ELECTIVIRE])) + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.ARCANINE, Species.EXEGGUTOR, Species.GYARADOS], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.setBoss(true, 2); - }, - ), + }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.PIDGEOT], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.PIDGEOT], TrainerSlot.TRAINER, true, p => { p.formIndex = 1; // Mega Pidgeot p.generateAndPopulateMoveset(); p.generateName(); @@ -3040,9 +3571,7 @@ export const trainerConfigs: TrainerConfigs = { .setHasDouble("red_blue_double") .setDoubleTrainerType(TrainerType.BLUE) .setDoubleTitle("champion_double") - .setPartyMemberFunc( - 0, - getRandomPartyMemberFunc([Species.PIKACHU], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.PIKACHU], TrainerSlot.TRAINER, true, p => { p.formIndex = 8; // G-Max Pikachu p.generateAndPopulateMoveset(); p.generateName(); @@ -3050,34 +3579,24 @@ export const trainerConfigs: TrainerConfigs = { }), ) .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.ESPEON, Species.UMBREON, Species.SYLVEON])) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.LUGIA], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.LUGIA], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.MASTER_BALL; }), ) .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR])) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc([Species.SNORLAX], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.SNORLAX], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.setBoss(true, 2); }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc( - [Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE], - TrainerSlot.TRAINER, - true, - p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc( + [Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE], TrainerSlot.TRAINER, true, p => { p.formIndex = 1; // Mega Venusaur, Mega Charizard X, or Mega Blastoise p.generateAndPopulateMoveset(); p.generateName(); p.gender = Gender.MALE; - }, - ), + }), ) .setInstantTera(3), // Tera Grass Meganium / Fire Typhlosion / Water Feraligatr [TrainerType.LANCE_CHAMPION]: new TrainerConfig(++t) @@ -3087,25 +3606,20 @@ export const trainerConfigs: TrainerConfigs = { .setMixedBattleBgm("battle_johto_champion") .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.GYARADOS, Species.KINGDRA])) .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.AERODACTYL])) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.SALAMENCE], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.SALAMENCE], TrainerSlot.TRAINER, true, p => { p.formIndex = 1; // Mega Salamence p.generateAndPopulateMoveset(); p.generateName(); }), ) .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.CHARIZARD])) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc([Species.TYRANITAR, Species.GARCHOMP, Species.KOMMO_O], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.TYRANITAR, Species.GARCHOMP, Species.KOMMO_O], TrainerSlot.TRAINER, true, p => { p.teraType = PokemonType.DRAGON; + p.generateAndPopulateMoveset(); p.abilityIndex = p.species.speciesId === Species.KOMMO_O ? 1 : 2; // Soundproof Kommo-o, Unnerve Tyranitar, Rough Skin Garchomp }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.DRAGONITE], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.DRAGONITE], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.gender = Gender.MALE; p.setBoss(true, 2); @@ -3121,24 +3635,18 @@ export const trainerConfigs: TrainerConfigs = { .setDoubleTitle("champion_double") .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.SKARMORY])) .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.CRADILY, Species.ARMALDO])) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.AGGRON], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.AGGRON], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.setBoss(true, 2); }), ) .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.GOLURK, Species.RUNERIGUS])) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc([Species.REGIROCK, Species.REGICE, Species.REGISTEEL], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.REGIROCK, Species.REGICE, Species.REGISTEEL], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.ULTRA_BALL; }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.METAGROSS], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.METAGROSS], TrainerSlot.TRAINER, true, p => { p.formIndex = 1; // Mega Metagross p.generateAndPopulateMoveset(); p.generateName(); @@ -3152,17 +3660,13 @@ export const trainerConfigs: TrainerConfigs = { .setHasDouble("wallace_steven_double") .setDoubleTrainerType(TrainerType.STEVEN) .setDoubleTitle("champion_double") - .setPartyMemberFunc( - 0, - getRandomPartyMemberFunc([Species.PELIPPER], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.PELIPPER], TrainerSlot.TRAINER, true, p => { p.abilityIndex = 1; // Drizzle p.generateAndPopulateMoveset(); }), ) .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.LUDICOLO])) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.LATIAS, Species.LATIOS], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.LATIAS, Species.LATIOS], TrainerSlot.TRAINER, true, p => { p.formIndex = 1; // Mega Latios or Mega Latias p.generateAndPopulateMoveset(); p.generateName(); @@ -3170,16 +3674,12 @@ export const trainerConfigs: TrainerConfigs = { }), ) .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.SWAMPERT, Species.GASTRODON, Species.SEISMITOAD])) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc([Species.REGIELEKI, Species.REGIDRAGO], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.REGIELEKI, Species.REGIDRAGO], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.ULTRA_BALL; }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.MILOTIC], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.MILOTIC], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.gender = Gender.FEMALE; p.setBoss(true, 2); @@ -3190,41 +3690,24 @@ export const trainerConfigs: TrainerConfigs = { .initForChampion(false) .setBattleBgm("battle_sinnoh_champion") .setMixedBattleBgm("battle_sinnoh_champion") - .setPartyMemberFunc( - 0, - getRandomPartyMemberFunc([Species.SPIRITOMB], TrainerSlot.TRAINER, true, p => { - p.generateAndPopulateMoveset(); - }), - ) + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.SPIRITOMB])) .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.LUCARIO])) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.GIRATINA], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.GIRATINA], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.MASTER_BALL; }), ) - .setPartyMemberFunc( - 3, - getRandomPartyMemberFunc( - [Species.MILOTIC, Species.ROSERADE, Species.HISUI_ARCANINE], - TrainerSlot.TRAINER, - true, - p => { - p.teraType = p.species.type1; - }, - ), + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.MILOTIC, Species.ROSERADE, Species.HISUI_ARCANINE], TrainerSlot.TRAINER, true, p => { + p.generateAndPopulateMoveset(); + p.teraType = p.species.type1; + }), ) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc([Species.TOGEKISS], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.TOGEKISS], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.setBoss(true, 2); }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.GARCHOMP], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.GARCHOMP], TrainerSlot.TRAINER, true, p => { p.formIndex = 1; // Mega Garchomp p.generateAndPopulateMoveset(); p.generateName(); @@ -3240,46 +3723,28 @@ export const trainerConfigs: TrainerConfigs = { .setBattleBgm("battle_champion_alder") .setMixedBattleBgm("battle_champion_alder") .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.BOUFFALANT, Species.BRAVIARY])) - .setPartyMemberFunc( - 1, - getRandomPartyMemberFunc( - [Species.HISUI_LILLIGANT, Species.HISUI_ZOROARK, Species.BASCULEGION], - TrainerSlot.TRAINER, - true, - p => { + .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.HISUI_LILLIGANT, Species.HISUI_ZOROARK, Species.BASCULEGION], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.ROGUE_BALL; - }, - ), + }), ) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.ZEKROM], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.ZEKROM], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.MASTER_BALL; }), ) - .setPartyMemberFunc( - 3, - getRandomPartyMemberFunc([Species.KELDEO], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.KELDEO], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.ULTRA_BALL; }), ) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc( - [Species.CHANDELURE, Species.KROOKODILE, Species.REUNICLUS, Species.CONKELDURR], - TrainerSlot.TRAINER, - true, - p => { - p.teraType = p.species.speciesId === Species.KROOKODILE ? PokemonType.DARK : p.species.type1; - }, - ), + .setPartyMemberFunc(4, getRandomPartyMemberFunc( + [Species.CHANDELURE, Species.KROOKODILE, Species.REUNICLUS, Species.CONKELDURR], TrainerSlot.TRAINER, true, p => { + p.generateAndPopulateMoveset(); + p.teraType = p.species.speciesId === Species.KROOKODILE ? PokemonType.DARK : p.species.type1; + }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.VOLCARONA], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.VOLCARONA], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.gender = Gender.MALE; p.setBoss(true, 2); @@ -3295,35 +3760,23 @@ export const trainerConfigs: TrainerConfigs = { .setDoubleTitle("champion_double") .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.DRUDDIGON])) .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.ARCHEOPS])) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.RESHIRAM], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.RESHIRAM], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.MASTER_BALL; }), ) - .setPartyMemberFunc( - 3, - getRandomPartyMemberFunc( - [Species.SALAMENCE, Species.HYDREIGON, Species.ARCHALUDON], - TrainerSlot.TRAINER, - true, - p => { - p.teraType = PokemonType.DRAGON; - }, - ), + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.SALAMENCE, Species.HYDREIGON, Species.ARCHALUDON], TrainerSlot.TRAINER, true, p => { + p.generateAndPopulateMoveset(); + p.teraType = PokemonType.DRAGON; + }), ) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc([Species.LAPRAS], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.LAPRAS], TrainerSlot.TRAINER, true, p => { p.formIndex = 1; // G-Max Lapras p.generateAndPopulateMoveset(); p.generateName(); }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.HAXORUS], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.HAXORUS], TrainerSlot.TRAINER, true, p => { p.abilityIndex = 1; // Mold Breaker p.generateAndPopulateMoveset(); p.gender = Gender.FEMALE; @@ -3334,38 +3787,28 @@ export const trainerConfigs: TrainerConfigs = { [TrainerType.DIANTHA]: new TrainerConfig(++t) .initForChampion(false) .setMixedBattleBgm("battle_kalos_champion") - .setPartyMemberFunc( - 0, - getRandomPartyMemberFunc([Species.HAWLUCHA], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.HAWLUCHA], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); }), ) .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.TREVENANT, Species.GOURGEIST])) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.XERNEAS], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.XERNEAS], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.MASTER_BALL; }), ) - .setPartyMemberFunc( - 3, - getRandomPartyMemberFunc([Species.TYRANTRUM, Species.AURORUS], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.TYRANTRUM, Species.AURORUS], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.abilityIndex = 2; // Rock Head Tyrantrum, Snow Warning Aurorus p.teraType = p.species.type2!; }), ) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc([Species.GOODRA], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.GOODRA], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.setBoss(true, 2); }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.GARDEVOIR], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.GARDEVOIR], TrainerSlot.TRAINER, true, p => { p.formIndex = 1; // Mega Gardevoir p.generateAndPopulateMoveset(); p.generateName(); @@ -3376,45 +3819,29 @@ export const trainerConfigs: TrainerConfigs = { [TrainerType.KUKUI]: new TrainerConfig(++t) .initForChampion(true) .setMixedBattleBgm("battle_champion_kukui") - .setPartyMemberFunc( - 0, - getRandomPartyMemberFunc([Species.LYCANROC], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.LYCANROC], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.formIndex = 2; // Dusk Lycanroc }), ) .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.MAGNEZONE, Species.ALOLA_NINETALES])) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc( - [Species.TORNADUS, Species.THUNDURUS, Species.LANDORUS], - TrainerSlot.TRAINER, - true, - p => { - p.formIndex = 1; // Therian Formes + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.TORNADUS, Species.THUNDURUS, Species.LANDORUS], TrainerSlot.TRAINER, true, p => { p.formIndex = 1; // Therian Formes p.generateAndPopulateMoveset(); p.pokeball = PokeballType.ULTRA_BALL; - }, - ), + }), ) - .setPartyMemberFunc( - 3, - getRandomPartyMemberFunc([Species.TAPU_KOKO, Species.TAPU_FINI], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.TAPU_KOKO, Species.TAPU_FINI], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.setBoss(true, 2); p.pokeball = PokeballType.ULTRA_BALL; }), ) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc([Species.SNORLAX], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.SNORLAX], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.formIndex = 1; // G-Max Snorlax }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.INCINEROAR, Species.HISUI_DECIDUEYE], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.INCINEROAR, Species.HISUI_DECIDUEYE], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.gender = Gender.MALE; p.teraType = p.species.type2!; @@ -3424,39 +3851,26 @@ export const trainerConfigs: TrainerConfigs = { [TrainerType.HAU]: new TrainerConfig(++t) .initForChampion(true) .setMixedBattleBgm("battle_alola_champion") - .setPartyMemberFunc( - 0, - getRandomPartyMemberFunc([Species.ALOLA_RAICHU], TrainerSlot.TRAINER, true, p => { - p.generateAndPopulateMoveset(); - }), - ) + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.ALOLA_RAICHU])) .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.NOIVERN])) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.SOLGALEO], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.SOLGALEO], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.MASTER_BALL; }), ) - .setPartyMemberFunc( - 3, - getRandomPartyMemberFunc([Species.TAPU_LELE, Species.TAPU_BULU], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.TAPU_LELE, Species.TAPU_BULU], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.ULTRA_BALL; p.teraType = p.species.type1; }), ) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc([Species.ZYGARDE], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.ZYGARDE], TrainerSlot.TRAINER, true, p => { p.formIndex = 1; // Zygarde 10% forme, Aura Break p.generateAndPopulateMoveset(); p.pokeball = PokeballType.ROGUE_BALL; }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.DECIDUEYE, Species.PRIMARINA], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.DECIDUEYE, Species.PRIMARINA], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.setBoss(true, 2); p.gender = p.species.speciesId === Species.PRIMARINA ? Gender.FEMALE : Gender.MALE; @@ -3466,36 +3880,20 @@ export const trainerConfigs: TrainerConfigs = { [TrainerType.LEON]: new TrainerConfig(++t) .initForChampion(true) .setMixedBattleBgm("battle_galar_champion") - .setPartyMemberFunc( - 0, - getRandomPartyMemberFunc([Species.AEGISLASH], TrainerSlot.TRAINER, true, p => { - p.generateAndPopulateMoveset(); - }), - ) + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.AEGISLASH])) .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.RHYPERIOR, Species.SEISMITOAD, Species.MR_RIME])) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.ZACIAN], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.ZACIAN], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.MASTER_BALL; }), ) .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.DRAGAPULT])) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc( - [Species.RILLABOOM, Species.CINDERACE, Species.INTELEON], - TrainerSlot.TRAINER, - true, - p => { + .setPartyMemberFunc(4,getRandomPartyMemberFunc([Species.RILLABOOM, Species.CINDERACE, Species.INTELEON], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.setBoss(true, 2); - }, - ), + }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.CHARIZARD], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.CHARIZARD], TrainerSlot.TRAINER, true, p => { p.formIndex = 3; // G-Max Charizard p.generateAndPopulateMoveset(); p.generateName(); @@ -3506,46 +3904,34 @@ export const trainerConfigs: TrainerConfigs = { [TrainerType.MUSTARD]: new TrainerConfig(++t) .initForChampion(true) .setMixedBattleBgm("battle_mustard") - .setPartyMemberFunc( - 0, - getRandomPartyMemberFunc([Species.CORVIKNIGHT], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.CORVIKNIGHT], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.ULTRA_BALL; }), ) - .setPartyMemberFunc( - 1, - getRandomPartyMemberFunc([Species.KOMMO_O], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.KOMMO_O], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.ULTRA_BALL; }), ) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.GALAR_SLOWBRO, Species.GALAR_SLOWKING], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.GALAR_SLOWBRO, Species.GALAR_SLOWKING], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.ULTRA_BALL; - p.teraType = PokemonType.PSYCHIC; + p.teraType = p.species.type1; }), ) - .setPartyMemberFunc( - 3, - getRandomPartyMemberFunc([Species.GALAR_DARMANITAN], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.GALAR_DARMANITAN], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.ULTRA_BALL; }), ) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc([Species.BLASTOISE, Species.VENUSAUR], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.BLASTOISE, Species.VENUSAUR], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.setBoss(true, 2); p.pokeball = PokeballType.ULTRA_BALL; }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.URSHIFU], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.URSHIFU], TrainerSlot.TRAINER, true, p => { p.formIndex = randSeedInt(2, 2); // Random G-Max Urshifu p.generateAndPopulateMoveset(); p.generateName(); @@ -3553,32 +3939,30 @@ export const trainerConfigs: TrainerConfigs = { p.pokeball = PokeballType.ULTRA_BALL; }), ) - .setInstantTera(2), // Tera Psychic Galar-Slowbro / Galar-Slowking + .setInstantTera(2), // Tera Poison Galar-Slowbro / Galar-Slowking [TrainerType.GEETA]: new TrainerConfig(++t) .initForChampion(false) .setMixedBattleBgm("battle_champion_geeta") - .setPartyMemberFunc( - 0, - getRandomPartyMemberFunc([Species.GLIMMORA], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.GLIMMORA], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.gender = Gender.MALE; p.setBoss(true, 2); }), ) .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.ESPATHRA, Species.VELUZA])) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.MIRAIDON], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.MIRAIDON], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.MASTER_BALL; }), ) .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.BAXCALIBUR])) .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.CHESNAUGHT, Species.DELPHOX, Species.GRENINJA])) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.KINGAMBIT], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.KINGAMBIT], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); + if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.TERA_BLAST)) { + // Check if Tera Blast is in the moveset, if not, replace the third move with Tera Blast. + p.moveset[2] = new PokemonMove(Moves.TERA_BLAST); + } p.abilityIndex = 1; // Supreme Overlord p.teraType = PokemonType.FLYING; }), @@ -3587,75 +3971,50 @@ export const trainerConfigs: TrainerConfigs = { [TrainerType.NEMONA]: new TrainerConfig(++t) .initForChampion(false) .setMixedBattleBgm("battle_champion_nemona") - .setPartyMemberFunc( - 0, - getRandomPartyMemberFunc([Species.LYCANROC], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.LYCANROC], TrainerSlot.TRAINER, true, p => { p.formIndex = 0; // Midday form p.generateAndPopulateMoveset(); }), ) .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.PAWMOT])) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.KORAIDON], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.KORAIDON], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.MASTER_BALL; }), ) .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.GHOLDENGO])) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc([Species.ARMAROUGE, Species.CERULEDGE], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.ARMAROUGE, Species.CERULEDGE], TrainerSlot.TRAINER, true, p => { + p.generateAndPopulateMoveset(); p.teraType = p.species.type2!; }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc( - [Species.MEOWSCARADA, Species.SKELEDIRGE, Species.QUAQUAVAL], - TrainerSlot.TRAINER, - true, - p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.MEOWSCARADA, Species.SKELEDIRGE, Species.QUAQUAVAL], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.gender = Gender.MALE; p.setBoss(true, 2); - }, - ), + }), ) .setInstantTera(4), // Tera Psychic Armarouge / Ghost Ceruledge [TrainerType.KIERAN]: new TrainerConfig(++t) .initForChampion(true) .setMixedBattleBgm("battle_champion_kieran") - .setPartyMemberFunc( - 0, - getRandomPartyMemberFunc([Species.POLIWRATH, Species.POLITOED], TrainerSlot.TRAINER, true, p => { - p.generateAndPopulateMoveset(); - }), - ) - .setPartyMemberFunc( - 1, - getRandomPartyMemberFunc([Species.INCINEROAR, Species.GRIMMSNARL], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(0, getRandomPartyMemberFunc([Species.POLIWRATH, Species.POLITOED])) + .setPartyMemberFunc(1, getRandomPartyMemberFunc([Species.INCINEROAR, Species.GRIMMSNARL], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.abilityIndex = p.species.speciesId === Species.INCINEROAR ? 2 : 0; // Intimidate Incineroar, Prankster Grimmsnarl }), ) - .setPartyMemberFunc( - 2, - getRandomPartyMemberFunc([Species.TERAPAGOS], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(2, getRandomPartyMemberFunc([Species.TERAPAGOS], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.MASTER_BALL; }), ) - .setPartyMemberFunc( - 3, - getRandomPartyMemberFunc([Species.URSALUNA, Species.BLOODMOON_URSALUNA], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(3, getRandomPartyMemberFunc([Species.URSALUNA, Species.BLOODMOON_URSALUNA], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.pokeball = PokeballType.ULTRA_BALL; }), ) - .setPartyMemberFunc( - 4, - getRandomPartyMemberFunc([Species.OGERPON], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(4, getRandomPartyMemberFunc([Species.OGERPON], TrainerSlot.TRAINER, true, p => { p.formIndex = randSeedInt(4); // Random Ogerpon Tera Mask p.generateAndPopulateMoveset(); p.pokeball = PokeballType.ULTRA_BALL; @@ -3665,9 +4024,7 @@ export const trainerConfigs: TrainerConfigs = { } }), ) - .setPartyMemberFunc( - 5, - getRandomPartyMemberFunc([Species.HYDRAPPLE], TrainerSlot.TRAINER, true, p => { + .setPartyMemberFunc(5, getRandomPartyMemberFunc([Species.HYDRAPPLE], TrainerSlot.TRAINER, true, p => { p.generateAndPopulateMoveset(); p.gender = Gender.MALE; p.setBoss(true, 2); @@ -4830,7 +5187,7 @@ export const trainerConfigs: TrainerConfigs = { p.pokeball = PokeballType.ULTRA_BALL; p.formIndex = randSeedInt(4, 1); // Shock, Burn, Chill, or Douse Drive if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.TECHNO_BLAST)) { - // Check if Techno Blast is in the moveset, if not, replace the first move with Techno Blast. + // Check if Techno Blast is in the moveset, if not, replace the third move with Techno Blast. p.moveset[2] = new PokemonMove(Moves.TECHNO_BLAST); } }), diff --git a/src/data/weather.ts b/src/data/weather.ts index 81559304661..be9107798df 100644 --- a/src/data/weather.ts +++ b/src/data/weather.ts @@ -369,6 +369,7 @@ export function getRandomWeatherType(arena: Arena): WeatherType { if (hasSun) { weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 2 }); } + break; case Biome.VOLCANO: weatherPool = [ { diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index f6810ad38e1..492856b4b52 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -5529,9 +5529,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { sourcePokemon: Pokemon | null = null, turnsRemaining = 0, sourceText: string | null = null, - overrideStatus?: boolean + overrideStatus?: boolean, + quiet = true, ): boolean { - if (!this.canSetStatus(effect, false, overrideStatus, sourcePokemon)) { + if (!this.canSetStatus(effect, quiet, overrideStatus, sourcePokemon)) { return false; } if (this.isFainted() && effect !== StatusEffect.FAINT) { diff --git a/src/phases/game-over-phase.ts b/src/phases/game-over-phase.ts index 304d876a99e..3a3305fd45e 100644 --- a/src/phases/game-over-phase.ts +++ b/src/phases/game-over-phase.ts @@ -31,6 +31,7 @@ import ChallengeData from "#app/system/challenge-data"; import TrainerData from "#app/system/trainer-data"; import ArenaData from "#app/system/arena-data"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; +import { MessagePhase } from "./message-phase"; export class GameOverPhase extends BattlePhase { private isVictory: boolean; @@ -122,7 +123,7 @@ export class GameOverPhase extends BattlePhase { globalScene.disableMenu = true; globalScene.time.delayedCall(1000, () => { let firstClear = false; - if (this.isVictory && newClear) { + if (this.isVictory) { if (globalScene.gameMode.isClassic) { firstClear = globalScene.validateAchv(achvs.CLASSIC_VICTORY); globalScene.validateAchv(achvs.UNEVOLVED_CLASSIC_VICTORY); @@ -226,7 +227,17 @@ export class GameOverPhase extends BattlePhase { isVictory: this.isVictory, clientSessionId: clientSessionId, }) - .then(success => doGameOver(!!success)); + .then(success => doGameOver(!globalScene.gameMode.isDaily || !!success)) + .catch(_err => { + globalScene.clearPhaseQueue(); + globalScene.clearPhaseQueueSplice(); + globalScene.unshiftPhase(new MessagePhase(i18next.t("menu:serverCommunicationFailed"), 2500)); + // force the game to reload after 2 seconds. + setTimeout(() => { + window.location.reload(); + }, 2000); + this.end(); + }); } else if (this.isVictory) { globalScene.gameData.offlineNewClear().then(result => { doGameOver(result); diff --git a/src/plugins/api/pokerogue-session-savedata-api.ts b/src/plugins/api/pokerogue-session-savedata-api.ts index e703d55a242..aac8b9b93ad 100644 --- a/src/plugins/api/pokerogue-session-savedata-api.ts +++ b/src/plugins/api/pokerogue-session-savedata-api.ts @@ -20,17 +20,20 @@ export class PokerogueSessionSavedataApi extends ApiBase { * *This is **NOT** the same as {@linkcode clear | clear()}.* * @param params The {@linkcode NewClearSessionSavedataRequest} to send * @returns The raw savedata as `string`. + * @throws Error if the request fails */ public async newclear(params: NewClearSessionSavedataRequest) { try { const urlSearchParams = this.toUrlSearchParams(params); const response = await this.doGet(`/savedata/session/newclear?${urlSearchParams}`); const json = await response.json(); - - return Boolean(json); + if (response.ok) { + return Boolean(json); + } + throw new Error("Could not newclear session!"); } catch (err) { console.warn("Could not newclear session!", err); - return false; + throw new Error("Could not newclear session!"); } } diff --git a/src/system/settings/settings.ts b/src/system/settings/settings.ts index 31faf2b6283..8bbba267bd6 100644 --- a/src/system/settings/settings.ts +++ b/src/system/settings/settings.ts @@ -804,6 +804,7 @@ export function setSetting(setting: string, value: number): boolean { break; case SettingKeys.Candy_Upgrade_Display: globalScene.candyUpgradeDisplay = value; + break; case SettingKeys.Money_Format: switch (Setting[index].options[value].value) { case "Normal": diff --git a/src/ui-inputs.ts b/src/ui-inputs.ts index bf4f51e5af7..0c13cdb9512 100644 --- a/src/ui-inputs.ts +++ b/src/ui-inputs.ts @@ -176,11 +176,13 @@ export class UiInputs { return; } switch (globalScene.ui?.getMode()) { - case UiMode.MESSAGE: + case UiMode.MESSAGE: { const messageHandler = globalScene.ui.getHandler(); if (!messageHandler.pendingPrompt || messageHandler.isTextAnimationInProgress()) { return; } + // biome-ignore lint/suspicious/noFallthroughSwitchClause: falls through to show menu overlay + } case UiMode.TITLE: case UiMode.COMMAND: case UiMode.MODIFIER_SELECT: diff --git a/test/abilities/illusion.test.ts b/test/abilities/illusion.test.ts index c743a59ef00..1d8ce58ab38 100644 --- a/test/abilities/illusion.test.ts +++ b/test/abilities/illusion.test.ts @@ -23,18 +23,18 @@ describe("Abilities - Illusion", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleStyle("single"); - game.override.enemySpecies(Species.ZORUA); - game.override.enemyAbility(Abilities.ILLUSION); - game.override.enemyMoveset(Moves.TACKLE); - game.override.enemyHeldItems([{ name: "WIDE_LENS", count: 3 }]); - - game.override.moveset([Moves.WORRY_SEED, Moves.SOAK, Moves.TACKLE]); - game.override.startingHeldItems([{ name: "WIDE_LENS", count: 3 }]); + game.override + .battleStyle("single") + .enemySpecies(Species.ZORUA) + .enemyAbility(Abilities.ILLUSION) + .enemyMoveset(Moves.TACKLE) + .enemyHeldItems([{ name: "WIDE_LENS", count: 3 }]) + .moveset([Moves.WORRY_SEED, Moves.SOAK, Moves.TACKLE]) + .startingHeldItems([{ name: "WIDE_LENS", count: 3 }]); }); it("creates illusion at the start", async () => { - await game.classicMode.startBattle([Species.ZOROARK, Species.AXEW]); + await game.classicMode.startBattle([Species.ZOROARK, Species.FEEBAS]); const zoroark = game.scene.getPlayerPokemon()!; const zorua = game.scene.getEnemyPokemon()!; @@ -43,7 +43,7 @@ describe("Abilities - Illusion", () => { }); it("break after receiving damaging move", async () => { - await game.classicMode.startBattle([Species.AXEW]); + await game.classicMode.startBattle([Species.FEEBAS]); game.move.select(Moves.TACKLE); await game.phaseInterceptor.to("TurnEndPhase"); @@ -55,7 +55,7 @@ describe("Abilities - Illusion", () => { }); it("break after getting ability changed", async () => { - await game.classicMode.startBattle([Species.AXEW]); + await game.classicMode.startBattle([Species.FEEBAS]); game.move.select(Moves.WORRY_SEED); await game.phaseInterceptor.to("TurnEndPhase"); @@ -76,7 +76,7 @@ describe("Abilities - Illusion", () => { it("causes enemy AI to consider the illusion's type instead of the actual type when considering move effectiveness", async () => { game.override.enemyMoveset([Moves.FLAMETHROWER, Moves.PSYCHIC, Moves.TACKLE]); - await game.classicMode.startBattle([Species.ZOROARK, Species.AXEW]); + await game.classicMode.startBattle([Species.ZOROARK, Species.FEEBAS]); const enemy = game.scene.getEnemyPokemon()!; const zoroark = game.scene.getPlayerPokemon()!; diff --git a/test/plugins/api/pokerogue-session-savedata-api.test.ts b/test/plugins/api/pokerogue-session-savedata-api.test.ts index d4c235ac51a..4d4774f2283 100644 --- a/test/plugins/api/pokerogue-session-savedata-api.test.ts +++ b/test/plugins/api/pokerogue-session-savedata-api.test.ts @@ -57,9 +57,7 @@ describe("Pokerogue Session Savedata API", () => { it("should return false and report a warning on ERROR", async () => { server.use(http.get(`${apiBase}/savedata/session/newclear`, () => HttpResponse.error())); - const success = await sessionSavedataApi.newclear(params); - - expect(success).toBe(false); + await expect(sessionSavedataApi.newclear(params)).rejects.toThrow("Could not newclear session!"); expect(console.warn).toHaveBeenCalledWith("Could not newclear session!", expect.any(Error)); }); }); diff --git a/tsconfig.json b/tsconfig.json index 30e208745b9..6af3e9ce650 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,7 @@ "esModuleInterop": true, "strictNullChecks": true, "sourceMap": false, - "strict": false, + "strict": false, // TODO: Enable this eventually "rootDir": ".", "baseUrl": "./src", "paths": {