mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-15 06:15:20 +01:00
[Misc] Allow setting daily boss variant via custom seed (#6714)
* Add option to set shiny boss * Update src/data/daily-run.ts Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
This commit is contained in:
parent
a05bd90eb3
commit
8650aebd40
@ -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.
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user