diff --git a/src/data/daily-run.ts b/src/data/daily-run.ts index b86442fac0f..ea2852976e8 100644 --- a/src/data/daily-run.ts +++ b/src/data/daily-run.ts @@ -6,6 +6,7 @@ import { BiomeId } from "#enums/biome-id"; import { MoveId } from "#enums/move-id"; import { PartyMemberStrength } from "#enums/party-member-strength"; import { SpeciesId } from "#enums/species-id"; +import type { Variant } from "#sprites/variant"; import type { Starter, StarterMoveset } from "#types/save-data"; import { isBetween, randSeedGauss, randSeedInt, randSeedItem } from "#utils/common"; import { getEnumValues } from "#utils/enums"; @@ -283,6 +284,31 @@ export function getDailyEventSeedBoss(seed: string): PokemonSpeciesForm | null { return starterForm; } +/** + * Expects the seed to contain `/boss\d{4}\d{2}\d{2}/` + * where the first 4 digits are the species ID, the next 2 digits are the form index, and the last 2 digits are the variant. + * Only the last 2 digits matter for the variant, and it is clamped to 0-2. + * (left padded with `0`s as necessary). + * @returns A {@linkcode Variant} to be used for the boss, or `null` if no valid match. + */ +export function getDailyEventSeedBossVariant(seed: string): Variant | null { + if (!isDailyEventSeed(seed)) { + return null; + } + + const match = /boss\d{6}(\d{2})/g.exec(seed); + if (!match || match.length !== 2) { + return null; + } + + const variant = Number.parseInt(match[1]) as Variant; + if (variant > 2) { + return null; + } + + return variant; +} + /** * Expects the seed to contain `/biome\d{2}/` where the 2 digits are a biome ID (left padded with `0` if necessary). * @returns The biome to use or `null` if no valid match. diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 835b9d92c89..be85e2ebe3a 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -39,7 +39,7 @@ import { TrappedTag, TypeImmuneTag, } from "#data/battler-tags"; -import { getDailyEventSeedBoss } from "#data/daily-run"; +import { getDailyEventSeedBoss, getDailyEventSeedBossVariant } from "#data/daily-run"; import { allAbilities, allMoves } from "#data/data-lists"; import { getLevelTotalExp } from "#data/exp"; import { @@ -6387,8 +6387,13 @@ export class EnemyPokemon extends Pokemon { this.initShinySparkle(); } + const eventBossVariant = getDailyEventSeedBossVariant(globalScene.seed); + if (eventBossVariant != null && globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex)) { + this.shiny = true; + } + if (this.shiny) { - this.variant = this.generateShinyVariant(); + this.variant = eventBossVariant ?? this.generateShinyVariant(); if (Overrides.ENEMY_VARIANT_OVERRIDE !== null) { this.variant = Overrides.ENEMY_VARIANT_OVERRIDE; }