mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-29 10:49:29 +02:00
Added form index to boss custom seed
This commit is contained in:
parent
4d83674d1c
commit
5f017597da
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user