From 5f017597dae5a671c4811e887d81c9b1201bf7ae Mon Sep 17 00:00:00 2001 From: Jimmybald1 <147992650+IBBCalc@users.noreply.github.com> Date: Sun, 10 Aug 2025 10:36:13 +0200 Subject: [PATCH] Added form index to boss custom seed --- src/data/daily-run.ts | 18 +++++++++--------- src/field/pokemon.ts | 6 ++++++ src/game-mode.ts | 4 +++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/data/daily-run.ts b/src/data/daily-run.ts index 139b0d78b76..1fa45c9d030 100644 --- a/src/data/daily-run.ts +++ b/src/data/daily-run.ts @@ -213,27 +213,27 @@ export function getDailyEventSeedStarters(seed: string): Starter[] | null { } /** - * Expects the seed to contain: /boss\d{4}/ - * Where the boss is 4 digits for the SpeciesId. - * Currently does not support form index. - * @returns A {@linkcode PokemonSpecies} containing the boss species or null if no valid match. + * Expects the seed to contain: /boss\d{4}\d{2}/ + * Where the boss is 4 digits for the SpeciesId and 2 digits for the form index + * @returns A {@linkcode PokemonSpeciesForm} containing the boss or null if no valid match. */ -export function getDailyEventSeedBoss(seed: string): PokemonSpecies | null { +export function getDailyEventSeedBoss(seed: string): PokemonSpeciesForm | null { if (!isDailyEventSeed(seed)) { return null; } - const match = /boss(\d{4})/g.exec(seed); - if (match && match.length === 2) { + const match = /boss(\d{4})(\d{2})/g.exec(seed); + if (match && match.length === 3) { const speciesId = Number.parseInt(match[1]) as SpeciesId; + const formIndex = Number.parseInt(match[2]); if (!Object.values(SpeciesId).includes(speciesId)) { // Incorrect event seed, abort. return null; } - const species = getPokemonSpecies(speciesId); - return species; + const starterForm = getPokemonSpeciesForm(speciesId, formIndex); + return starterForm; } return null; diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index fe85e92772c..29f775ad094 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -39,6 +39,7 @@ import { TrappedTag, TypeImmuneTag, } from "#data/battler-tags"; +import { getDailyEventSeedBoss } from "#data/daily-run"; import { allAbilities, allMoves } from "#data/data-lists"; import { getLevelTotalExp } from "#data/exp"; import { @@ -6256,6 +6257,11 @@ export class EnemyPokemon extends Pokemon { this.species.forms[Overrides.OPP_FORM_OVERRIDES[speciesId]] ) { this.formIndex = Overrides.OPP_FORM_OVERRIDES[speciesId]; + } else if (globalScene.gameMode.isDaily && globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex)) { + const eventBoss = getDailyEventSeedBoss(globalScene.seed); + if (!isNullOrUndefined(eventBoss)) { + this.formIndex = eventBoss.formIndex; + } } if (!dataSource) { diff --git a/src/game-mode.ts b/src/game-mode.ts index 7aa1588a383..b44e786b3d9 100644 --- a/src/game-mode.ts +++ b/src/game-mode.ts @@ -15,6 +15,7 @@ import type { Arena } from "#field/arena"; import { classicFixedBattles, type FixedBattleConfigs } from "#trainers/fixed-battle-configs"; import { applyChallenges } from "#utils/challenge-utils"; import { BooleanHolder, isNullOrUndefined, randSeedInt, randSeedItem } from "#utils/common"; +import { getPokemonSpecies } from "#utils/pokemon-utils"; import i18next from "i18next"; interface GameModeConfig { @@ -213,7 +214,8 @@ export class GameMode implements GameModeConfig { if (this.isDaily && this.isWaveFinal(waveIndex)) { const eventBoss = getDailyEventSeedBoss(globalScene.seed); if (!isNullOrUndefined(eventBoss)) { - return eventBoss; + // Cannot set form index here, it will be overriden when adding it as enemy pokemon. + return getPokemonSpecies(eventBoss.speciesId); } const allFinalBossSpecies = allSpecies.filter(