Merge branch 'beta' into reduce-gameData

This commit is contained in:
Wlowscha 2025-09-06 08:40:47 +02:00 committed by GitHub
commit 24bd210dc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 8 deletions

View File

@ -17,7 +17,7 @@ import { getIsInitialized, initI18n } from "#plugins/i18n";
import type { TrainerConfig } from "#trainers/trainer-config"; import type { TrainerConfig } from "#trainers/trainer-config";
import { trainerConfigs } from "#trainers/trainer-config"; import { trainerConfigs } from "#trainers/trainer-config";
import { TrainerPartyCompoundTemplate, type TrainerPartyTemplate } from "#trainers/trainer-party-template"; import { TrainerPartyCompoundTemplate, type TrainerPartyTemplate } from "#trainers/trainer-party-template";
import { randSeedInt, randSeedItem, randSeedWeightedItem } from "#utils/common"; import { randSeedInt, randSeedItem } from "#utils/common";
import { getRandomLocaleEntry } from "#utils/i18n"; import { getRandomLocaleEntry } from "#utils/i18n";
import { getPokemonSpecies } from "#utils/pokemon-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils";
import { toCamelCase } from "#utils/strings"; import { toCamelCase } from "#utils/strings";
@ -61,9 +61,7 @@ export class Trainer extends Phaser.GameObjects.Container {
this.variant = variant; this.variant = variant;
this.partyTemplateIndex = Math.min( this.partyTemplateIndex = Math.min(
partyTemplateIndex !== undefined partyTemplateIndex !== undefined ? partyTemplateIndex : randSeedItem(this.config.partyTemplates.map((_, i) => i)),
? partyTemplateIndex
: randSeedWeightedItem(this.config.partyTemplates.map((_, i) => i)),
this.config.partyTemplates.length - 1, this.config.partyTemplates.length - 1,
); );
// TODO: Rework this and add actual error handling for missing names // TODO: Rework this and add actual error handling for missing names

View File

@ -1619,6 +1619,7 @@ export class StarterSelectUiHandler extends MessageUiHandler {
if (!this.filterMode) { if (!this.filterMode) {
this.startCursorObj.setVisible(false); this.startCursorObj.setVisible(false);
this.starterIconsCursorObj.setVisible(false); this.starterIconsCursorObj.setVisible(false);
this.randomCursorObj.setVisible(false);
this.setSpecies(null); this.setSpecies(null);
this.filterBarCursor = 0; this.filterBarCursor = 0;
this.setFilterMode(true); this.setFilterMode(true);

View File

@ -133,10 +133,6 @@ export function randSeedItem<T>(items: T[]): T {
return items.length === 1 ? items[0] : Phaser.Math.RND.pick(items); return items.length === 1 ? items[0] : Phaser.Math.RND.pick(items);
} }
export function randSeedWeightedItem<T>(items: T[]): T {
return items.length === 1 ? items[0] : Phaser.Math.RND.weightedPick(items);
}
/** /**
* Shuffle a list using the seeded rng. Utilises the Fisher-Yates algorithm. * Shuffle a list using the seeded rng. Utilises the Fisher-Yates algorithm.
* @param {Array} items An array of items. * @param {Array} items An array of items.