Remove tsdocs referencing scene params

Remove missed instances of `.scene`
This commit is contained in:
NightKev 2024-12-17 18:35:28 -08:00
parent 0208956b95
commit 64f4a037d7
49 changed files with 67 additions and 187 deletions

View File

@ -1064,7 +1064,7 @@ export default class BattleScene extends SceneBase {
/** /**
* Generates a random number using the current battle's seed * Generates a random number using the current battle's seed
* *
* This calls {@linkcode Battle.randSeedInt}(`scene`, {@linkcode range}, {@linkcode min}) in `src/battle.ts` * This calls {@linkcode Battle.randSeedInt}({@linkcode range}, {@linkcode min}) in `src/battle.ts`
* which calls {@linkcode Utils.randSeedInt randSeedInt}({@linkcode range}, {@linkcode min}) in `src/utils.ts` * which calls {@linkcode Utils.randSeedInt randSeedInt}({@linkcode range}, {@linkcode min}) in `src/utils.ts`
* *
* @param range How large of a range of random numbers to choose from. If {@linkcode range} <= 1, returns {@linkcode min} * @param range How large of a range of random numbers to choose from. If {@linkcode range} <= 1, returns {@linkcode min}
@ -2864,9 +2864,7 @@ export default class BattleScene extends SceneBase {
updatePartyForModifiers(party: Pokemon[], instant?: boolean): Promise<void> { updatePartyForModifiers(party: Pokemon[], instant?: boolean): Promise<void> {
return new Promise(resolve => { return new Promise(resolve => {
Promise.allSettled(party.map(p => { Promise.allSettled(party.map(p => {
if (p.scene) {
p.calculateStats(); p.calculateStats();
}
return p.updateInfo(instant); return p.updateInfo(instant);
})).then(() => resolve()); })).then(() => resolve());
}); });
@ -2929,7 +2927,6 @@ export default class BattleScene extends SceneBase {
/** /**
* Apply all modifiers that match `modifierType` in a random order * Apply all modifiers that match `modifierType` in a random order
* @param scene {@linkcode BattleScene} used to randomize the order of modifiers
* @param modifierType The type of modifier to apply; must extend {@linkcode PersistentModifier} * @param modifierType The type of modifier to apply; must extend {@linkcode PersistentModifier}
* @param player Whether to search the player (`true`) or the enemy (`false`); Defaults to `true` * @param player Whether to search the player (`true`) or the enemy (`false`); Defaults to `true`
* @param ...args The list of arguments needed to invoke `modifierType.apply` * @param ...args The list of arguments needed to invoke `modifierType.apply`

View File

@ -74,7 +74,6 @@ export abstract class ArenaTag {
/** /**
* Helper function that retrieves the source Pokemon * Helper function that retrieves the source Pokemon
* @param scene medium to retrieve the source Pokemon
* @returns The source {@linkcode Pokemon} or `null` if none is found * @returns The source {@linkcode Pokemon} or `null` if none is found
*/ */
public getSourcePokemon(): Pokemon | null { public getSourcePokemon(): Pokemon | null {
@ -83,7 +82,6 @@ export abstract class ArenaTag {
/** /**
* Helper function that retrieves the Pokemon affected * Helper function that retrieves the Pokemon affected
* @param scene - medium to retrieve the involved Pokemon
* @returns list of PlayerPokemon or EnemyPokemon on the field * @returns list of PlayerPokemon or EnemyPokemon on the field
*/ */
public getAffectedPokemon(): Pokemon[] { public getAffectedPokemon(): Pokemon[] {

View File

@ -555,7 +555,6 @@ function logMissingMoveAnim(move: Moves, ...optionalParams: any[]) {
/** /**
* Fetches animation configs to be used in a Mystery Encounter * Fetches animation configs to be used in a Mystery Encounter
* @param scene
* @param encounterAnim one or more animations to fetch * @param encounterAnim one or more animations to fetch
*/ */
export async function initEncounterAnims(encounterAnim: EncounterAnim | EncounterAnim[]): Promise<void> { export async function initEncounterAnims(encounterAnim: EncounterAnim | EncounterAnim[]): Promise<void> {
@ -630,7 +629,6 @@ export function loadCommonAnimAssets(startLoad?: boolean): Promise<void> {
/** /**
* Loads encounter animation assets to scene * Loads encounter animation assets to scene
* MUST be called after {@linkcode initEncounterAnims()} to load all required animations properly * MUST be called after {@linkcode initEncounterAnims()} to load all required animations properly
* @param scene
* @param startLoad * @param startLoad
*/ */
export async function loadEncounterAnimAssets(startLoad?: boolean): Promise<void> { export async function loadEncounterAnimAssets(startLoad?: boolean): Promise<void> {
@ -1121,8 +1119,6 @@ export abstract class BattleAnim {
} }
/** /**
*
* @param scene
* @param targetInitialX * @param targetInitialX
* @param targetInitialY * @param targetInitialY
* @param frameTimeMult * @param frameTimeMult

View File

@ -110,7 +110,6 @@ export class BattlerTag {
/** /**
* Helper function that retrieves the source Pokemon object * Helper function that retrieves the source Pokemon object
* @param scene medium to retrieve the source Pokemon
* @returns The source {@linkcode Pokemon} or `null` if none is found * @returns The source {@linkcode Pokemon} or `null` if none is found
*/ */
public getSourcePokemon(): Pokemon | null { public getSourcePokemon(): Pokemon | null {

View File

@ -179,14 +179,10 @@ export class Egg {
} }
}; };
if (eggOptions?.scene) {
const seedOverride = Utils.randomString(24); const seedOverride = Utils.randomString(24);
eggOptions?.scene.executeWithSeedOffset(() => { globalScene.executeWithSeedOffset(() => {
generateEggProperties(eggOptions); generateEggProperties(eggOptions);
}, 0, seedOverride); }, 0, seedOverride);
} else { // For legacy eggs without scene
generateEggProperties(eggOptions);
}
this._eggDescriptor = eggOptions?.eggDescriptor; this._eggDescriptor = eggOptions?.eggDescriptor;
} }

View File

@ -468,8 +468,6 @@ function doGreedentEatBerries() {
} }
/** /**
*
* @param scene
* @param isEat Default false. Will "create" pile when false, and remove pile when true. * @param isEat Default false. Will "create" pile when false, and remove pile when true.
*/ */
function doBerrySpritePile(isEat: boolean = false) { function doBerrySpritePile(isEat: boolean = false) {

View File

@ -549,7 +549,6 @@ function hideTradeBackground() {
/** /**
* Initiates an "evolution-like" animation to transform a previousPokemon (presumably from the player's party) into a new one, not necessarily an evolution species. * Initiates an "evolution-like" animation to transform a previousPokemon (presumably from the player's party) into a new one, not necessarily an evolution species.
* @param scene
* @param tradedPokemon * @param tradedPokemon
* @param receivedPokemon * @param receivedPokemon
*/ */

View File

@ -126,8 +126,6 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with
/** /**
* Generic handler for using a guiding pokemon to guide you back. * Generic handler for using a guiding pokemon to guide you back.
*
* @param scene Battle scene
*/ */
function handlePokemonGuidingYouPhase() { function handlePokemonGuidingYouPhase() {
const laprasSpecies = getPokemonSpecies(Species.LAPRAS); const laprasSpecies = getPokemonSpecies(Species.LAPRAS);

View File

@ -434,7 +434,6 @@ async function doNewTeamPostProcess(transformations: PokemonTransformation[]) {
/** /**
* Applies special changes to the newly transformed pokemon, such as passing previous moves, gaining egg moves, etc. * Applies special changes to the newly transformed pokemon, such as passing previous moves, gaining egg moves, etc.
* Returns whether the transformed pokemon unlocks a new starter for the player. * Returns whether the transformed pokemon unlocks a new starter for the player.
* @param scene
* @param previousPokemon * @param previousPokemon
* @param newPokemon * @param newPokemon
* @param speciesRootForm * @param speciesRootForm
@ -682,7 +681,6 @@ function doSideBySideTransformations(transformations: PokemonTransformation[]) {
/** /**
* Returns index of the new egg move within the Pokemon's moveset (not the index of the move in `speciesEggMoves`) * Returns index of the new egg move within the Pokemon's moveset (not the index of the move in `speciesEggMoves`)
* @param scene
* @param newPokemon * @param newPokemon
* @param speciesRootForm * @param speciesRootForm
*/ */

View File

@ -74,7 +74,6 @@ export default class MysteryEncounterOption implements IMysteryEncounterOption {
/** /**
* Returns true if all {@linkcode EncounterRequirement}s for the option are met * Returns true if all {@linkcode EncounterRequirement}s for the option are met
* @param scene
*/ */
meetsRequirements(): boolean { meetsRequirements(): boolean {
return !this.requirements.some(requirement => !requirement.meetsRequirement()) return !this.requirements.some(requirement => !requirement.meetsRequirement())
@ -84,7 +83,6 @@ export default class MysteryEncounterOption implements IMysteryEncounterOption {
/** /**
* Returns true if all PRIMARY {@linkcode EncounterRequirement}s for the option are met * Returns true if all PRIMARY {@linkcode EncounterRequirement}s for the option are met
* @param scene
* @param pokemon * @param pokemon
*/ */
pokemonMeetsPrimaryRequirements(pokemon: Pokemon): boolean { pokemonMeetsPrimaryRequirements(pokemon: Pokemon): boolean {
@ -96,7 +94,6 @@ export default class MysteryEncounterOption implements IMysteryEncounterOption {
* AND there is a valid Pokemon assigned to {@linkcode primaryPokemon}. * AND there is a valid Pokemon assigned to {@linkcode primaryPokemon}.
* If both {@linkcode primaryPokemonRequirements} and {@linkcode secondaryPokemonRequirements} are defined, * If both {@linkcode primaryPokemonRequirements} and {@linkcode secondaryPokemonRequirements} are defined,
* can cause scenarios where there are not enough Pokemon that are sufficient for all requirements. * can cause scenarios where there are not enough Pokemon that are sufficient for all requirements.
* @param scene
*/ */
meetsPrimaryRequirementAndPrimaryPokemonSelected(): boolean { meetsPrimaryRequirementAndPrimaryPokemonSelected(): boolean {
if (!this.primaryPokemonRequirements || this.primaryPokemonRequirements.length === 0) { if (!this.primaryPokemonRequirements || this.primaryPokemonRequirements.length === 0) {
@ -154,7 +151,6 @@ export default class MysteryEncounterOption implements IMysteryEncounterOption {
* AND there is a valid Pokemon assigned to {@linkcode secondaryPokemon} (if applicable). * AND there is a valid Pokemon assigned to {@linkcode secondaryPokemon} (if applicable).
* If both {@linkcode primaryPokemonRequirements} and {@linkcode secondaryPokemonRequirements} are defined, * If both {@linkcode primaryPokemonRequirements} and {@linkcode secondaryPokemonRequirements} are defined,
* can cause scenarios where there are not enough Pokemon that are sufficient for all requirements. * can cause scenarios where there are not enough Pokemon that are sufficient for all requirements.
* @param scene
*/ */
meetsSupportingRequirementAndSupportingPokemonSelected(): boolean { meetsSupportingRequirementAndSupportingPokemonSelected(): boolean {
if (!this.secondaryPokemonRequirements || this.secondaryPokemonRequirements.length === 0) { if (!this.secondaryPokemonRequirements || this.secondaryPokemonRequirements.length === 0) {

View File

@ -25,13 +25,11 @@ export interface EncounterRequirement {
export abstract class EncounterSceneRequirement implements EncounterRequirement { export abstract class EncounterSceneRequirement implements EncounterRequirement {
/** /**
* Returns whether the EncounterSceneRequirement's... requirements, are met by the given scene * Returns whether the EncounterSceneRequirement's... requirements, are met by the given scene
* @param partyPokemon
*/ */
abstract meetsRequirement(): boolean; abstract meetsRequirement(): boolean;
/** /**
* Returns a dialogue token key/value pair for a given Requirement. * Returns a dialogue token key/value pair for a given Requirement.
* Should be overridden by child Requirement classes. * Should be overridden by child Requirement classes.
* @param scene
* @param pokemon * @param pokemon
*/ */
abstract getDialogueToken(pokemon?: PlayerPokemon): [string, string]; abstract getDialogueToken(pokemon?: PlayerPokemon): [string, string];
@ -61,7 +59,6 @@ export class CombinationSceneRequirement extends EncounterSceneRequirement {
/** /**
* Checks if all/any requirements are met (depends on {@linkcode isAnd}) * Checks if all/any requirements are met (depends on {@linkcode isAnd})
* @param scene The {@linkcode BattleScene} to check against
* @returns true if all/any requirements are met (depends on {@linkcode isAnd}) * @returns true if all/any requirements are met (depends on {@linkcode isAnd})
*/ */
override meetsRequirement(): boolean { override meetsRequirement(): boolean {
@ -72,7 +69,6 @@ export class CombinationSceneRequirement extends EncounterSceneRequirement {
/** /**
* Retrieves a dialogue token key/value pair for the given {@linkcode EncounterSceneRequirement | requirements}. * Retrieves a dialogue token key/value pair for the given {@linkcode EncounterSceneRequirement | requirements}.
* @param scene The {@linkcode BattleScene} to check against
* @param pokemon The {@linkcode PlayerPokemon} to check against * @param pokemon The {@linkcode PlayerPokemon} to check against
* @returns A dialogue token key/value pair * @returns A dialogue token key/value pair
* @throws An {@linkcode Error} if {@linkcode isAnd} is `true` (not supported) * @throws An {@linkcode Error} if {@linkcode isAnd} is `true` (not supported)
@ -98,7 +94,6 @@ export abstract class EncounterPokemonRequirement implements EncounterRequiremen
/** /**
* Returns whether the EncounterPokemonRequirement's... requirements, are met by the given scene * Returns whether the EncounterPokemonRequirement's... requirements, are met by the given scene
* @param partyPokemon
*/ */
abstract meetsRequirement(): boolean; abstract meetsRequirement(): boolean;
@ -111,7 +106,6 @@ export abstract class EncounterPokemonRequirement implements EncounterRequiremen
/** /**
* Returns a dialogue token key/value pair for a given Requirement. * Returns a dialogue token key/value pair for a given Requirement.
* Should be overridden by child Requirement classes. * Should be overridden by child Requirement classes.
* @param scene
* @param pokemon * @param pokemon
*/ */
abstract getDialogueToken(pokemon?: PlayerPokemon): [string, string]; abstract getDialogueToken(pokemon?: PlayerPokemon): [string, string];
@ -143,7 +137,6 @@ export class CombinationPokemonRequirement extends EncounterPokemonRequirement {
/** /**
* Checks if all/any requirements are met (depends on {@linkcode isAnd}) * Checks if all/any requirements are met (depends on {@linkcode isAnd})
* @param scene The {@linkcode BattleScene} to check against
* @returns true if all/any requirements are met (depends on {@linkcode isAnd}) * @returns true if all/any requirements are met (depends on {@linkcode isAnd})
*/ */
override meetsRequirement(): boolean { override meetsRequirement(): boolean {
@ -168,7 +161,6 @@ export class CombinationPokemonRequirement extends EncounterPokemonRequirement {
/** /**
* Retrieves a dialogue token key/value pair for the given {@linkcode EncounterPokemonRequirement | requirements}. * Retrieves a dialogue token key/value pair for the given {@linkcode EncounterPokemonRequirement | requirements}.
* @param scene The {@linkcode BattleScene} to check against
* @param pokemon The {@linkcode PlayerPokemon} to check against * @param pokemon The {@linkcode PlayerPokemon} to check against
* @returns A dialogue token key/value pair * @returns A dialogue token key/value pair
* @throws An {@linkcode Error} if {@linkcode isAnd} is `true` (not supported) * @throws An {@linkcode Error} if {@linkcode isAnd} is `true` (not supported)

View File

@ -296,7 +296,6 @@ export default class MysteryEncounter implements IMysteryEncounter {
/** /**
* Checks if the current scene state meets the requirements for the {@linkcode MysteryEncounter} to spawn * Checks if the current scene state meets the requirements for the {@linkcode MysteryEncounter} to spawn
* This is used to filter the pool of encounters down to only the ones with all requirements met * This is used to filter the pool of encounters down to only the ones with all requirements met
* @param scene
* @returns * @returns
*/ */
meetsRequirements(): boolean { meetsRequirements(): boolean {
@ -310,7 +309,6 @@ export default class MysteryEncounter implements IMysteryEncounter {
/** /**
* Checks if a specific player pokemon meets all given primary EncounterPokemonRequirements * Checks if a specific player pokemon meets all given primary EncounterPokemonRequirements
* Used automatically as part of {@linkcode meetsRequirements}, but can also be used to manually check certain Pokemon where needed * Used automatically as part of {@linkcode meetsRequirements}, but can also be used to manually check certain Pokemon where needed
* @param scene
* @param pokemon * @param pokemon
*/ */
pokemonMeetsPrimaryRequirements(pokemon: Pokemon): boolean { pokemonMeetsPrimaryRequirements(pokemon: Pokemon): boolean {
@ -322,7 +320,6 @@ export default class MysteryEncounter implements IMysteryEncounter {
* AND there is a valid Pokemon assigned to {@linkcode primaryPokemon}. * AND there is a valid Pokemon assigned to {@linkcode primaryPokemon}.
* If both {@linkcode primaryPokemonRequirements} and {@linkcode secondaryPokemonRequirements} are defined, * If both {@linkcode primaryPokemonRequirements} and {@linkcode secondaryPokemonRequirements} are defined,
* can cause scenarios where there are not enough Pokemon that are sufficient for all requirements. * can cause scenarios where there are not enough Pokemon that are sufficient for all requirements.
* @param scene
*/ */
private meetsPrimaryRequirementAndPrimaryPokemonSelected(): boolean { private meetsPrimaryRequirementAndPrimaryPokemonSelected(): boolean {
if (!this.primaryPokemonRequirements || this.primaryPokemonRequirements.length === 0) { if (!this.primaryPokemonRequirements || this.primaryPokemonRequirements.length === 0) {
@ -386,7 +383,6 @@ export default class MysteryEncounter implements IMysteryEncounter {
* AND there is a valid Pokemon assigned to {@linkcode secondaryPokemon} (if applicable). * AND there is a valid Pokemon assigned to {@linkcode secondaryPokemon} (if applicable).
* If both {@linkcode primaryPokemonRequirements} and {@linkcode secondaryPokemonRequirements} are defined, * If both {@linkcode primaryPokemonRequirements} and {@linkcode secondaryPokemonRequirements} are defined,
* can cause scenarios where there are not enough Pokemon that are sufficient for all requirements. * can cause scenarios where there are not enough Pokemon that are sufficient for all requirements.
* @param scene
*/ */
private meetsSecondaryRequirementAndSecondaryPokemonSelected(): boolean { private meetsSecondaryRequirementAndSecondaryPokemonSelected(): boolean {
if (!this.secondaryPokemonRequirements || this.secondaryPokemonRequirements.length === 0) { if (!this.secondaryPokemonRequirements || this.secondaryPokemonRequirements.length === 0) {
@ -409,7 +405,6 @@ export default class MysteryEncounter implements IMysteryEncounter {
/** /**
* Initializes encounter intro sprites based on the sprite configs defined in spriteConfigs * Initializes encounter intro sprites based on the sprite configs defined in spriteConfigs
* @param scene
*/ */
initIntroVisuals(): void { initIntroVisuals(): void {
this.introVisuals = new MysteryEncounterIntroVisuals(this); this.introVisuals = new MysteryEncounterIntroVisuals(this);
@ -518,7 +513,6 @@ export default class MysteryEncounter implements IMysteryEncounter {
/** /**
* Maintains seed offset for RNG consistency * Maintains seed offset for RNG consistency
* Increments if the same {@linkcode MysteryEncounter} has multiple option select cycles * Increments if the same {@linkcode MysteryEncounter} has multiple option select cycles
* @param scene
*/ */
updateSeedOffset() { updateSeedOffset() {
const currentOffset = this.seedOffset ?? globalScene.currentBattle.waveIndex * 1000; const currentOffset = this.seedOffset ?? globalScene.currentBattle.waveIndex * 1000;

View File

@ -960,7 +960,6 @@ export const noStarterFormKeys: string[] = [
/** /**
* Method to get the daily list of starters with Pokerus. * Method to get the daily list of starters with Pokerus.
* @param scene {@linkcode BattleScene} used as part of RNG
* @returns A list of starters with Pokerus * @returns A list of starters with Pokerus
*/ */
export function getPokerusStarters(): PokemonSpecies[] { export function getPokerusStarters(): PokemonSpecies[] {

View File

@ -1134,7 +1134,6 @@ interface TrainerConfigs {
/** /**
* The function to get variable strength grunts * The function to get variable strength grunts
* @param scene the singleton scene being passed in
* @returns the correct TrainerPartyTemplate * @returns the correct TrainerPartyTemplate
*/ */
function getEvilGruntPartyTemplate(): TrainerPartyTemplate { function getEvilGruntPartyTemplate(): TrainerPartyTemplate {

View File

@ -6,7 +6,6 @@ import { isNullOrUndefined } from "#app/utils";
import { getSpriteKeysFromSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils"; import { getSpriteKeysFromSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
import { Variant } from "#app/data/variant"; import { Variant } from "#app/data/variant";
import { doShinySparkleAnim } from "#app/field/anims"; import { doShinySparkleAnim } from "#app/field/anims";
import type BattleScene from "#app/battle-scene";
import PlayAnimationConfig = Phaser.Types.Animations.PlayAnimationConfig; import PlayAnimationConfig = Phaser.Types.Animations.PlayAnimationConfig;
type KnownFileRoot = type KnownFileRoot =
@ -220,7 +219,7 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
if (config.isPokemon) { if (config.isPokemon) {
globalScene.loadPokemonAtlas(config.spriteKey, config.fileRoot); globalScene.loadPokemonAtlas(config.spriteKey, config.fileRoot);
if (config.isShiny) { if (config.isShiny) {
this.scene.loadPokemonVariantAssets(config.spriteKey, config.fileRoot, config.variant); globalScene.loadPokemonVariantAssets(config.spriteKey, config.fileRoot, config.variant);
} }
} else if (config.isItem) { } else if (config.isItem) {
globalScene.loadAtlas("items", ""); globalScene.loadAtlas("items", "");
@ -338,7 +337,7 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
*/ */
playShinySparkles() { playShinySparkles() {
for (const sparkleConfig of this.shinySparkleSprites) { for (const sparkleConfig of this.shinySparkleSprites) {
this.scene.time.delayedCall(500, () => { globalScene.time.delayedCall(500, () => {
doShinySparkleAnim(sparkleConfig.sprite, sparkleConfig.variant); doShinySparkleAnim(sparkleConfig.sprite, sparkleConfig.variant);
}); });
} }
@ -503,10 +502,3 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
return super.setVisible(value); return super.setVisible(value);
} }
} }
/**
* Interface is required so as not to override {@link Phaser.GameObjects.Container.scene}
*/
export default interface MysteryEncounterIntroVisuals {
scene: BattleScene
}

View File

@ -4074,7 +4074,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* Generates a random number using the current battle's seed, or the global seed if `globalScene.currentBattle` is falsy * Generates a random number using the current battle's seed, or the global seed if `globalScene.currentBattle` is falsy
* <!-- @import "../battle".Battle --> * <!-- @import "../battle".Battle -->
* This calls either {@linkcode BattleScene.randBattleSeedInt}({@linkcode range}, {@linkcode min}) in `src/battle-scene.ts` * This calls either {@linkcode BattleScene.randBattleSeedInt}({@linkcode range}, {@linkcode min}) in `src/battle-scene.ts`
* which calls {@linkcode Battle.randSeedInt}(`scene`, {@linkcode range}, {@linkcode min}) in `src/battle.ts` * which calls {@linkcode Battle.randSeedInt}({@linkcode range}, {@linkcode min}) in `src/battle.ts`
* which calls {@linkcode Utils.randSeedInt randSeedInt}({@linkcode range}, {@linkcode min}) in `src/utils.ts`, * which calls {@linkcode Utils.randSeedInt randSeedInt}({@linkcode range}, {@linkcode min}) in `src/utils.ts`,
* or it directly calls {@linkcode Utils.randSeedInt randSeedInt}({@linkcode range}, {@linkcode min}) in `src/utils.ts` if there is no current battle * or it directly calls {@linkcode Utils.randSeedInt randSeedInt}({@linkcode range}, {@linkcode min}) in `src/utils.ts` if there is no current battle
* *
@ -4183,10 +4183,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
} }
/* export default interface Pokemon {
scene: BattleScene
} */
export class PlayerPokemon extends Pokemon { export class PlayerPokemon extends Pokemon {
public compatibleTms: Moves[]; public compatibleTms: Moves[];

View File

@ -1,4 +1,3 @@
import BattleScene from "#app/battle-scene";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions"; import { pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species"; import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species";
@ -661,7 +660,3 @@ export default class Trainer extends Phaser.GameObjects.Container {
}); });
} }
} }
export default interface Trainer {
scene: BattleScene
}

View File

@ -109,7 +109,6 @@ export class GameMode implements GameModeConfig {
} }
/** /**
* @param scene current BattleScene
* @returns either: * @returns either:
* - random biome for Daily mode * - random biome for Daily mode
* - override from overrides.ts * - override from overrides.ts
@ -136,8 +135,8 @@ export class GameMode implements GameModeConfig {
/** /**
* Determines whether or not to generate a trainer * Determines whether or not to generate a trainer
* @param waveIndex the current floor the player is on (trainer sprites fail to generate on X1 floors) * @param waveIndex the current floor the player is on (trainer sprites fail to generate on X1 floors)
* @param arena the arena that contains the scene and functions * @param arena the current {@linkcode Arena}
* @returns true if a trainer should be generated, false otherwise * @returns `true` if a trainer should be generated, `false` otherwise
*/ */
isWaveTrainer(waveIndex: integer, arena: Arena): boolean { isWaveTrainer(waveIndex: integer, arena: Arena): boolean {
/** /**
@ -153,7 +152,6 @@ export class GameMode implements GameModeConfig {
* Do not check X1 floors since there's a bug that stops trainer sprites from appearing * Do not check X1 floors since there's a bug that stops trainer sprites from appearing
* after a X0 full party heal * after a X0 full party heal
*/ */
const trainerChance = arena.getTrainerChance(); const trainerChance = arena.getTrainerChance();
let allowTrainerBattle = true; let allowTrainerBattle = true;
if (trainerChance) { if (trainerChance) {

View File

@ -95,15 +95,12 @@ export class InputsController {
/** /**
* Initializes a new instance of the game control system, setting up initial state and configurations. * Initializes a new instance of the game control system, setting up initial state and configurations.
* *
* @param scene - The Phaser scene associated with this instance.
*
* @remarks * @remarks
* This constructor initializes the game control system with necessary setups for handling inputs. * This constructor initializes the game control system with necessary setups for handling inputs.
* It prepares an interactions array indexed by button identifiers and configures default states for each button. * It prepares an interactions array indexed by button identifiers and configures default states for each button.
* Specific buttons like MENU and STATS are set not to repeat their actions. * Specific buttons like MENU and STATS are set not to repeat their actions.
* It concludes by calling the `init` method to complete the setup. * It concludes by calling the `init` method to complete the setup.
*/ */
constructor() { constructor() {
this.selectedDevice = { this.selectedDevice = {
[Device.GAMEPAD]: null, [Device.GAMEPAD]: null,

View File

@ -1153,7 +1153,7 @@ class FormChangeItemModifierTypeGenerator extends ModifierTypeGenerator {
let foundULTRA_Z = false, let foundULTRA_Z = false,
foundN_LUNA = false, foundN_LUNA = false,
foundN_SOLAR = false; foundN_SOLAR = false;
formChangeItemTriggers.forEach((fc, i) => { formChangeItemTriggers.forEach((fc, _i) => {
switch (fc.item) { switch (fc.item) {
case FormChangeItem.ULTRANECROZIUM_Z: case FormChangeItem.ULTRANECROZIUM_Z:
foundULTRA_Z = true; foundULTRA_Z = true;
@ -1236,7 +1236,7 @@ export class EnemyAttackStatusEffectChanceModifierType extends ModifierType {
private effect: StatusEffect; private effect: StatusEffect;
constructor(localeKey: string, iconImage: string, chancePercent: integer, effect: StatusEffect, stackCount?: integer) { constructor(localeKey: string, iconImage: string, chancePercent: integer, effect: StatusEffect, stackCount?: integer) {
super(localeKey, iconImage, (type, args) => new EnemyAttackStatusEffectChanceModifier(type, effect, chancePercent, stackCount), "enemy_status_chance"); super(localeKey, iconImage, (type, _args) => new EnemyAttackStatusEffectChanceModifier(type, effect, chancePercent, stackCount), "enemy_status_chance");
this.chancePercent = chancePercent; this.chancePercent = chancePercent;
this.effect = effect; this.effect = effect;
@ -1275,7 +1275,7 @@ type WeightedModifierTypeWeightFunc = (party: Pokemon[], rerollCount?: integer)
* @returns A WeightedModifierTypeWeightFunc * @returns A WeightedModifierTypeWeightFunc
*/ */
function skipInClassicAfterWave(wave: integer, defaultWeight: integer): WeightedModifierTypeWeightFunc { function skipInClassicAfterWave(wave: integer, defaultWeight: integer): WeightedModifierTypeWeightFunc {
return (party: Pokemon[]) => { return () => {
const gameMode = globalScene.gameMode; const gameMode = globalScene.gameMode;
const currentWave = globalScene.currentBattle.waveIndex; const currentWave = globalScene.currentBattle.waveIndex;
return gameMode.isClassic && currentWave >= wave ? 0 : defaultWeight; return gameMode.isClassic && currentWave >= wave ? 0 : defaultWeight;
@ -1300,7 +1300,7 @@ function skipInLastClassicWaveOrDefault(defaultWeight: integer) : WeightedModifi
* @returns A WeightedModifierTypeWeightFunc * @returns A WeightedModifierTypeWeightFunc
*/ */
function lureWeightFunc(maxBattles: number, weight: number): WeightedModifierTypeWeightFunc { function lureWeightFunc(maxBattles: number, weight: number): WeightedModifierTypeWeightFunc {
return (party: Pokemon[]) => { return () => {
const lures = globalScene.getModifiers(DoubleBattleChanceBoosterModifier); const lures = globalScene.getModifiers(DoubleBattleChanceBoosterModifier);
return !(globalScene.gameMode.isClassic && globalScene.currentBattle.waveIndex === 199) && (lures.length === 0 || lures.filter(m => m.getMaxBattles() === maxBattles && m.getBattleCount() >= maxBattles * 0.6).length === 0) ? weight : 0; return !(globalScene.gameMode.isClassic && globalScene.currentBattle.waveIndex === 199) && (lures.length === 0 || lures.filter(m => m.getMaxBattles() === maxBattles && m.getBattleCount() >= maxBattles * 0.6).length === 0) ? weight : 0;
}; };
@ -1448,7 +1448,7 @@ export const modifierTypes = {
ATTACK_TYPE_BOOSTER: () => new AttackTypeBoosterModifierTypeGenerator(), ATTACK_TYPE_BOOSTER: () => new AttackTypeBoosterModifierTypeGenerator(),
MINT: () => new ModifierTypeGenerator((party: Pokemon[], pregenArgs?: any[]) => { MINT: () => new ModifierTypeGenerator((_party: Pokemon[], pregenArgs?: any[]) => {
if (pregenArgs && (pregenArgs.length === 1) && (pregenArgs[0] in Nature)) { if (pregenArgs && (pregenArgs.length === 1) && (pregenArgs[0] in Nature)) {
return new PokemonNatureChangeModifierType(pregenArgs[0] as Nature); return new PokemonNatureChangeModifierType(pregenArgs[0] as Nature);
} }
@ -1472,7 +1472,7 @@ export const modifierTypes = {
return new TerastallizeModifierType(type); return new TerastallizeModifierType(type);
}), }),
BERRY: () => new ModifierTypeGenerator((party: Pokemon[], pregenArgs?: any[]) => { BERRY: () => new ModifierTypeGenerator((_party: Pokemon[], pregenArgs?: any[]) => {
if (pregenArgs && (pregenArgs.length === 1) && (pregenArgs[0] in BerryType)) { if (pregenArgs && (pregenArgs.length === 1) && (pregenArgs[0] in BerryType)) {
return new BerryModifierType(pregenArgs[0] as BerryType); return new BerryModifierType(pregenArgs[0] as BerryType);
} }
@ -1580,19 +1580,19 @@ export const modifierTypes = {
ENEMY_ENDURE_CHANCE: () => new EnemyEndureChanceModifierType("modifierType:ModifierType.ENEMY_ENDURE_CHANCE", "wl_reset_urge", 2), ENEMY_ENDURE_CHANCE: () => new EnemyEndureChanceModifierType("modifierType:ModifierType.ENEMY_ENDURE_CHANCE", "wl_reset_urge", 2),
ENEMY_FUSED_CHANCE: () => new ModifierType("modifierType:ModifierType.ENEMY_FUSED_CHANCE", "wl_custom_spliced", (type, _args) => new EnemyFusionChanceModifier(type, 1)), ENEMY_FUSED_CHANCE: () => new ModifierType("modifierType:ModifierType.ENEMY_FUSED_CHANCE", "wl_custom_spliced", (type, _args) => new EnemyFusionChanceModifier(type, 1)),
MYSTERY_ENCOUNTER_SHUCKLE_JUICE: () => new ModifierTypeGenerator((party: Pokemon[], pregenArgs?: any[]) => { MYSTERY_ENCOUNTER_SHUCKLE_JUICE: () => new ModifierTypeGenerator((_party: Pokemon[], pregenArgs?: any[]) => {
if (pregenArgs) { if (pregenArgs) {
return new PokemonBaseStatTotalModifierType(pregenArgs[0] as number); return new PokemonBaseStatTotalModifierType(pregenArgs[0] as number);
} }
return new PokemonBaseStatTotalModifierType(randSeedInt(20, 1)); return new PokemonBaseStatTotalModifierType(randSeedInt(20, 1));
}), }),
MYSTERY_ENCOUNTER_OLD_GATEAU: () => new ModifierTypeGenerator((party: Pokemon[], pregenArgs?: any[]) => { MYSTERY_ENCOUNTER_OLD_GATEAU: () => new ModifierTypeGenerator((_party: Pokemon[], pregenArgs?: any[]) => {
if (pregenArgs) { if (pregenArgs) {
return new PokemonBaseStatFlatModifierType(pregenArgs[0] as number, pregenArgs[1] as Stat[]); return new PokemonBaseStatFlatModifierType(pregenArgs[0] as number, pregenArgs[1] as Stat[]);
} }
return new PokemonBaseStatFlatModifierType(randSeedInt(20, 1), [ Stat.HP, Stat.ATK, Stat.DEF ]); return new PokemonBaseStatFlatModifierType(randSeedInt(20, 1), [ Stat.HP, Stat.ATK, Stat.DEF ]);
}), }),
MYSTERY_ENCOUNTER_BLACK_SLUDGE: () => new ModifierTypeGenerator((party: Pokemon[], pregenArgs?: any[]) => { MYSTERY_ENCOUNTER_BLACK_SLUDGE: () => new ModifierTypeGenerator((_party: Pokemon[], pregenArgs?: any[]) => {
if (pregenArgs) { if (pregenArgs) {
return new ModifierType("modifierType:ModifierType.MYSTERY_ENCOUNTER_BLACK_SLUDGE", "black_sludge", (type, _args) => new HealShopCostModifier(type, pregenArgs[0] as number)); return new ModifierType("modifierType:ModifierType.MYSTERY_ENCOUNTER_BLACK_SLUDGE", "black_sludge", (type, _args) => new HealShopCostModifier(type, pregenArgs[0] as number));
} }
@ -1608,17 +1608,16 @@ interface ModifierPool {
/** /**
* Used to check if the player has max of a given ball type in Classic * Used to check if the player has max of a given ball type in Classic
* @param party The player's party, just used to access the scene
* @param ballType The {@linkcode PokeballType} being checked * @param ballType The {@linkcode PokeballType} being checked
* @returns boolean: true if the player has the maximum of a given ball type * @returns boolean: true if the player has the maximum of a given ball type
*/ */
function hasMaximumBalls(party: Pokemon[], ballType: PokeballType): boolean { function hasMaximumBalls(ballType: PokeballType): boolean {
return (globalScene.gameMode.isClassic && globalScene.pokeballCounts[ballType] >= MAX_PER_TYPE_POKEBALLS); return (globalScene.gameMode.isClassic && globalScene.pokeballCounts[ballType] >= MAX_PER_TYPE_POKEBALLS);
} }
const modifierPool: ModifierPool = { const modifierPool: ModifierPool = {
[ModifierTier.COMMON]: [ [ModifierTier.COMMON]: [
new WeightedModifierType(modifierTypes.POKEBALL, (party: Pokemon[]) => (hasMaximumBalls(party, PokeballType.POKEBALL)) ? 0 : 6, 6), new WeightedModifierType(modifierTypes.POKEBALL, () => (hasMaximumBalls(PokeballType.POKEBALL)) ? 0 : 6, 6),
new WeightedModifierType(modifierTypes.RARE_CANDY, 2), new WeightedModifierType(modifierTypes.RARE_CANDY, 2),
new WeightedModifierType(modifierTypes.POTION, (party: Pokemon[]) => { new WeightedModifierType(modifierTypes.POTION, (party: Pokemon[]) => {
const thresholdPartyMemberCount = Math.min(party.filter(p => (p.getInverseHp() >= 10 && p.getHpRatio() <= 0.875) && !p.isFainted()).length, 3); const thresholdPartyMemberCount = Math.min(party.filter(p => (p.getInverseHp() >= 10 && p.getHpRatio() <= 0.875) && !p.isFainted()).length, 3);
@ -1646,7 +1645,7 @@ const modifierPool: ModifierPool = {
m.setTier(ModifierTier.COMMON); return m; m.setTier(ModifierTier.COMMON); return m;
}), }),
[ModifierTier.GREAT]: [ [ModifierTier.GREAT]: [
new WeightedModifierType(modifierTypes.GREAT_BALL, (party: Pokemon[]) => (hasMaximumBalls(party, PokeballType.GREAT_BALL)) ? 0 : 6, 6), new WeightedModifierType(modifierTypes.GREAT_BALL, () => (hasMaximumBalls(PokeballType.GREAT_BALL)) ? 0 : 6, 6),
new WeightedModifierType(modifierTypes.PP_UP, 2), new WeightedModifierType(modifierTypes.PP_UP, 2),
new WeightedModifierType(modifierTypes.FULL_HEAL, (party: Pokemon[]) => { new WeightedModifierType(modifierTypes.FULL_HEAL, (party: Pokemon[]) => {
const statusEffectPartyMemberCount = Math.min(party.filter(p => p.hp && !!p.status && !p.getHeldItems().some(i => { const statusEffectPartyMemberCount = Math.min(party.filter(p => p.hp && !!p.status && !p.getHeldItems().some(i => {
@ -1699,10 +1698,10 @@ const modifierPool: ModifierPool = {
new WeightedModifierType(modifierTypes.DIRE_HIT, 4), new WeightedModifierType(modifierTypes.DIRE_HIT, 4),
new WeightedModifierType(modifierTypes.SUPER_LURE, lureWeightFunc(15, 4)), new WeightedModifierType(modifierTypes.SUPER_LURE, lureWeightFunc(15, 4)),
new WeightedModifierType(modifierTypes.NUGGET, skipInLastClassicWaveOrDefault(5)), new WeightedModifierType(modifierTypes.NUGGET, skipInLastClassicWaveOrDefault(5)),
new WeightedModifierType(modifierTypes.EVOLUTION_ITEM, (party: Pokemon[]) => { new WeightedModifierType(modifierTypes.EVOLUTION_ITEM, () => {
return Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 15), 8); return Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 15), 8);
}, 8), }, 8),
new WeightedModifierType(modifierTypes.MAP, (party: Pokemon[]) => globalScene.gameMode.isClassic && globalScene.currentBattle.waveIndex < 180 ? 2 : 0, 2), new WeightedModifierType(modifierTypes.MAP, () => globalScene.gameMode.isClassic && globalScene.currentBattle.waveIndex < 180 ? 2 : 0, 2),
new WeightedModifierType(modifierTypes.SOOTHE_BELL, 2), new WeightedModifierType(modifierTypes.SOOTHE_BELL, 2),
new WeightedModifierType(modifierTypes.TM_GREAT, 3), new WeightedModifierType(modifierTypes.TM_GREAT, 3),
new WeightedModifierType(modifierTypes.MEMORY_MUSHROOM, (party: Pokemon[]) => { new WeightedModifierType(modifierTypes.MEMORY_MUSHROOM, (party: Pokemon[]) => {
@ -1715,18 +1714,18 @@ const modifierPool: ModifierPool = {
new WeightedModifierType(modifierTypes.BASE_STAT_BOOSTER, 3), new WeightedModifierType(modifierTypes.BASE_STAT_BOOSTER, 3),
new WeightedModifierType(modifierTypes.TERA_SHARD, 1), new WeightedModifierType(modifierTypes.TERA_SHARD, 1),
new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => globalScene.gameMode.isSplicedOnly && party.filter(p => !p.fusionSpecies).length > 1 ? 4 : 0), new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => globalScene.gameMode.isSplicedOnly && party.filter(p => !p.fusionSpecies).length > 1 ? 4 : 0),
new WeightedModifierType(modifierTypes.VOUCHER, (party: Pokemon[], rerollCount: integer) => !globalScene.gameMode.isDaily ? Math.max(1 - rerollCount, 0) : 0, 1), new WeightedModifierType(modifierTypes.VOUCHER, (_party: Pokemon[], rerollCount: integer) => !globalScene.gameMode.isDaily ? Math.max(1 - rerollCount, 0) : 0, 1),
].map(m => { ].map(m => {
m.setTier(ModifierTier.GREAT); return m; m.setTier(ModifierTier.GREAT); return m;
}), }),
[ModifierTier.ULTRA]: [ [ModifierTier.ULTRA]: [
new WeightedModifierType(modifierTypes.ULTRA_BALL, (party: Pokemon[]) => (hasMaximumBalls(party, PokeballType.ULTRA_BALL)) ? 0 : 15, 15), new WeightedModifierType(modifierTypes.ULTRA_BALL, () => (hasMaximumBalls(PokeballType.ULTRA_BALL)) ? 0 : 15, 15),
new WeightedModifierType(modifierTypes.MAX_LURE, lureWeightFunc(30, 4)), new WeightedModifierType(modifierTypes.MAX_LURE, lureWeightFunc(30, 4)),
new WeightedModifierType(modifierTypes.BIG_NUGGET, skipInLastClassicWaveOrDefault(12)), new WeightedModifierType(modifierTypes.BIG_NUGGET, skipInLastClassicWaveOrDefault(12)),
new WeightedModifierType(modifierTypes.PP_MAX, 3), new WeightedModifierType(modifierTypes.PP_MAX, 3),
new WeightedModifierType(modifierTypes.MINT, 4), new WeightedModifierType(modifierTypes.MINT, 4),
new WeightedModifierType(modifierTypes.RARE_EVOLUTION_ITEM, (party: Pokemon[]) => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 15) * 4, 32), 32), new WeightedModifierType(modifierTypes.RARE_EVOLUTION_ITEM, () => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 15) * 4, 32), 32),
new WeightedModifierType(modifierTypes.FORM_CHANGE_ITEM, (party: Pokemon[]) => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 6, 24), new WeightedModifierType(modifierTypes.FORM_CHANGE_ITEM, () => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 6, 24),
new WeightedModifierType(modifierTypes.AMULET_COIN, skipInLastClassicWaveOrDefault(3)), new WeightedModifierType(modifierTypes.AMULET_COIN, skipInLastClassicWaveOrDefault(3)),
new WeightedModifierType(modifierTypes.EVIOLITE, (party: Pokemon[]) => { new WeightedModifierType(modifierTypes.EVIOLITE, (party: Pokemon[]) => {
const { gameMode, gameData } = globalScene; const { gameMode, gameData } = globalScene;
@ -1823,14 +1822,14 @@ const modifierPool: ModifierPool = {
new WeightedModifierType(modifierTypes.EXP_CHARM, skipInLastClassicWaveOrDefault(8)), new WeightedModifierType(modifierTypes.EXP_CHARM, skipInLastClassicWaveOrDefault(8)),
new WeightedModifierType(modifierTypes.EXP_SHARE, skipInLastClassicWaveOrDefault(10)), new WeightedModifierType(modifierTypes.EXP_SHARE, skipInLastClassicWaveOrDefault(10)),
new WeightedModifierType(modifierTypes.EXP_BALANCE, skipInLastClassicWaveOrDefault(3)), new WeightedModifierType(modifierTypes.EXP_BALANCE, skipInLastClassicWaveOrDefault(3)),
new WeightedModifierType(modifierTypes.TERA_ORB, (party: Pokemon[]) => Math.min(Math.max(Math.floor(globalScene.currentBattle.waveIndex / 50) * 2, 1), 4), 4), new WeightedModifierType(modifierTypes.TERA_ORB, () => Math.min(Math.max(Math.floor(globalScene.currentBattle.waveIndex / 50) * 2, 1), 4), 4),
new WeightedModifierType(modifierTypes.QUICK_CLAW, 3), new WeightedModifierType(modifierTypes.QUICK_CLAW, 3),
new WeightedModifierType(modifierTypes.WIDE_LENS, 4), new WeightedModifierType(modifierTypes.WIDE_LENS, 4),
].map(m => { ].map(m => {
m.setTier(ModifierTier.ULTRA); return m; m.setTier(ModifierTier.ULTRA); return m;
}), }),
[ModifierTier.ROGUE]: [ [ModifierTier.ROGUE]: [
new WeightedModifierType(modifierTypes.ROGUE_BALL, (party: Pokemon[]) => (hasMaximumBalls(party, PokeballType.ROGUE_BALL)) ? 0 : 16, 16), new WeightedModifierType(modifierTypes.ROGUE_BALL, () => (hasMaximumBalls(PokeballType.ROGUE_BALL)) ? 0 : 16, 16),
new WeightedModifierType(modifierTypes.RELIC_GOLD, skipInLastClassicWaveOrDefault(2)), new WeightedModifierType(modifierTypes.RELIC_GOLD, skipInLastClassicWaveOrDefault(2)),
new WeightedModifierType(modifierTypes.LEFTOVERS, 3), new WeightedModifierType(modifierTypes.LEFTOVERS, 3),
new WeightedModifierType(modifierTypes.SHELL_BELL, 3), new WeightedModifierType(modifierTypes.SHELL_BELL, 3),
@ -1840,28 +1839,28 @@ const modifierPool: ModifierPool = {
new WeightedModifierType(modifierTypes.BATON, 2), new WeightedModifierType(modifierTypes.BATON, 2),
new WeightedModifierType(modifierTypes.SOUL_DEW, 7), new WeightedModifierType(modifierTypes.SOUL_DEW, 7),
//new WeightedModifierType(modifierTypes.OVAL_CHARM, 6), //new WeightedModifierType(modifierTypes.OVAL_CHARM, 6),
new WeightedModifierType(modifierTypes.CATCHING_CHARM, (party: Pokemon[]) => !globalScene.gameMode.isFreshStartChallenge() && globalScene.gameData.getSpeciesCount(d => !!d.caughtAttr) > 100 ? 4 : 0, 4), new WeightedModifierType(modifierTypes.CATCHING_CHARM, () => !globalScene.gameMode.isFreshStartChallenge() && globalScene.gameData.getSpeciesCount(d => !!d.caughtAttr) > 100 ? 4 : 0, 4),
new WeightedModifierType(modifierTypes.ABILITY_CHARM, skipInClassicAfterWave(189, 6)), new WeightedModifierType(modifierTypes.ABILITY_CHARM, skipInClassicAfterWave(189, 6)),
new WeightedModifierType(modifierTypes.FOCUS_BAND, 5), new WeightedModifierType(modifierTypes.FOCUS_BAND, 5),
new WeightedModifierType(modifierTypes.KINGS_ROCK, 3), new WeightedModifierType(modifierTypes.KINGS_ROCK, 3),
new WeightedModifierType(modifierTypes.LOCK_CAPSULE, (party: Pokemon[]) => globalScene.gameMode.isClassic ? 0 : 3), new WeightedModifierType(modifierTypes.LOCK_CAPSULE, () => globalScene.gameMode.isClassic ? 0 : 3),
new WeightedModifierType(modifierTypes.SUPER_EXP_CHARM, skipInLastClassicWaveOrDefault(8)), new WeightedModifierType(modifierTypes.SUPER_EXP_CHARM, skipInLastClassicWaveOrDefault(8)),
new WeightedModifierType(modifierTypes.RARE_FORM_CHANGE_ITEM, (party: Pokemon[]) => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 6, 24), new WeightedModifierType(modifierTypes.RARE_FORM_CHANGE_ITEM, () => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 6, 24),
new WeightedModifierType(modifierTypes.MEGA_BRACELET, (party: Pokemon[]) => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 9, 36), new WeightedModifierType(modifierTypes.MEGA_BRACELET, () => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 9, 36),
new WeightedModifierType(modifierTypes.DYNAMAX_BAND, (party: Pokemon[]) => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 9, 36), new WeightedModifierType(modifierTypes.DYNAMAX_BAND, () => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 9, 36),
new WeightedModifierType(modifierTypes.VOUCHER_PLUS, (party: Pokemon[], rerollCount: integer) => !globalScene.gameMode.isDaily ? Math.max(3 - rerollCount * 1, 0) : 0, 3), new WeightedModifierType(modifierTypes.VOUCHER_PLUS, (_party: Pokemon[], rerollCount: integer) => !globalScene.gameMode.isDaily ? Math.max(3 - rerollCount * 1, 0) : 0, 3),
].map(m => { ].map(m => {
m.setTier(ModifierTier.ROGUE); return m; m.setTier(ModifierTier.ROGUE); return m;
}), }),
[ModifierTier.MASTER]: [ [ModifierTier.MASTER]: [
new WeightedModifierType(modifierTypes.MASTER_BALL, (party: Pokemon[]) => (hasMaximumBalls(party, PokeballType.MASTER_BALL)) ? 0 : 24, 24), new WeightedModifierType(modifierTypes.MASTER_BALL, () => (hasMaximumBalls(PokeballType.MASTER_BALL)) ? 0 : 24, 24),
new WeightedModifierType(modifierTypes.SHINY_CHARM, 14), new WeightedModifierType(modifierTypes.SHINY_CHARM, 14),
new WeightedModifierType(modifierTypes.HEALING_CHARM, 18), new WeightedModifierType(modifierTypes.HEALING_CHARM, 18),
new WeightedModifierType(modifierTypes.MULTI_LENS, 18), new WeightedModifierType(modifierTypes.MULTI_LENS, 18),
new WeightedModifierType(modifierTypes.VOUCHER_PREMIUM, (party: Pokemon[], rerollCount: integer) => new WeightedModifierType(modifierTypes.VOUCHER_PREMIUM, (_party: Pokemon[], rerollCount: integer) =>
!globalScene.gameMode.isDaily && !globalScene.gameMode.isEndless && !globalScene.gameMode.isSplicedOnly ? Math.max(5 - rerollCount * 2, 0) : 0, 5), !globalScene.gameMode.isDaily && !globalScene.gameMode.isEndless && !globalScene.gameMode.isSplicedOnly ? Math.max(5 - rerollCount * 2, 0) : 0, 5),
new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => !globalScene.gameMode.isSplicedOnly && party.filter(p => !p.fusionSpecies).length > 1 ? 24 : 0, 24), new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => !globalScene.gameMode.isSplicedOnly && party.filter(p => !p.fusionSpecies).length > 1 ? 24 : 0, 24),
new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, (party: Pokemon[]) => (globalScene.gameMode.isDaily || (!globalScene.gameMode.isFreshStartChallenge() && globalScene.gameData.isUnlocked(Unlockables.MINI_BLACK_HOLE))) ? 1 : 0, 1), new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, () => (globalScene.gameMode.isDaily || (!globalScene.gameMode.isFreshStartChallenge() && globalScene.gameData.isUnlocked(Unlockables.MINI_BLACK_HOLE))) ? 1 : 0, 1),
].map(m => { ].map(m => {
m.setTier(ModifierTier.MASTER); return m; m.setTier(ModifierTier.MASTER); return m;
}) })
@ -2060,7 +2059,7 @@ export const itemPoolChecks: Map<ModifierTypeKeys, boolean | undefined> = new Ma
export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: ModifierPoolType, rerollCount: integer = 0) { export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: ModifierPoolType, rerollCount: integer = 0) {
const pool = getModifierPoolForType(poolType); const pool = getModifierPoolForType(poolType);
itemPoolChecks.forEach((v, k) => { itemPoolChecks.forEach((_v, k) => {
itemPoolChecks.set(k, false); itemPoolChecks.set(k, false);
}); });
@ -2183,7 +2182,7 @@ export function getPlayerModifierTypeOptions(count: integer, party: PlayerPokemo
// Guaranteed mod functions second // Guaranteed mod functions second
if (customModifierSettings.guaranteedModifierTypeFuncs && customModifierSettings.guaranteedModifierTypeFuncs.length > 0) { if (customModifierSettings.guaranteedModifierTypeFuncs && customModifierSettings.guaranteedModifierTypeFuncs.length > 0) {
customModifierSettings.guaranteedModifierTypeFuncs!.forEach((mod, i) => { customModifierSettings.guaranteedModifierTypeFuncs!.forEach((mod, _i) => {
const modifierId = Object.keys(modifierTypes).find(k => modifierTypes[k] === mod) as string; const modifierId = Object.keys(modifierTypes).find(k => modifierTypes[k] === mod) as string;
let guaranteedMod: ModifierType = modifierTypes[modifierId]?.(); let guaranteedMod: ModifierType = modifierTypes[modifierId]?.();

View File

@ -760,7 +760,6 @@ export abstract class LapsingPokemonHeldItemModifier extends PokemonHeldItemModi
/** /**
* Retrieve the {@linkcode Modifier | Modifiers} icon as a {@linkcode Phaser.GameObjects.Container | Container} * Retrieve the {@linkcode Modifier | Modifiers} icon as a {@linkcode Phaser.GameObjects.Container | Container}
* @param scene The {@linkcode BattleScene}
* @param forSummary `true` if the icon is for the summary screen * @param forSummary `true` if the icon is for the summary screen
* @returns the icon as a {@linkcode Phaser.GameObjects.Container | Container} * @returns the icon as a {@linkcode Phaser.GameObjects.Container | Container}
*/ */
@ -3365,7 +3364,6 @@ export class TempExtraModifierModifier extends LapsingPersistentModifier {
* If no existing Silver Pokeballs are found, will add a new one. * If no existing Silver Pokeballs are found, will add a new one.
* @param modifiers {@linkcode PersistentModifier} array of the player's modifiers * @param modifiers {@linkcode PersistentModifier} array of the player's modifiers
* @param _virtual N/A * @param _virtual N/A
* @param scene
* @returns true if the modifier was successfully added or applied, false otherwise * @returns true if the modifier was successfully added or applied, false otherwise
*/ */
add(modifiers: PersistentModifier[], _virtual: boolean): boolean { add(modifiers: PersistentModifier[], _virtual: boolean): boolean {
@ -3700,7 +3698,6 @@ export class EnemyFusionChanceModifier extends EnemyPersistentModifier {
* Uses either `MODIFIER_OVERRIDE` in overrides.ts to set {@linkcode PersistentModifier}s for either: * Uses either `MODIFIER_OVERRIDE` in overrides.ts to set {@linkcode PersistentModifier}s for either:
* - The player * - The player
* - The enemy * - The enemy
* @param scene current {@linkcode BattleScene}
* @param isPlayer {@linkcode boolean} for whether the player (`true`) or enemy (`false`) is being overridden * @param isPlayer {@linkcode boolean} for whether the player (`true`) or enemy (`false`) is being overridden
*/ */
export function overrideModifiers(isPlayer: boolean = true): void { export function overrideModifiers(isPlayer: boolean = true): void {
@ -3740,7 +3737,6 @@ export function overrideModifiers(isPlayer: boolean = true): void {
* Uses either `HELD_ITEMS_OVERRIDE` in overrides.ts to set {@linkcode PokemonHeldItemModifier}s for either: * Uses either `HELD_ITEMS_OVERRIDE` in overrides.ts to set {@linkcode PokemonHeldItemModifier}s for either:
* - The first member of the player's team when starting a new game * - The first member of the player's team when starting a new game
* - An enemy {@linkcode Pokemon} being spawned in * - An enemy {@linkcode Pokemon} being spawned in
* @param scene current {@linkcode BattleScene}
* @param pokemon {@linkcode Pokemon} whose held items are being overridden * @param pokemon {@linkcode Pokemon} whose held items are being overridden
* @param isPlayer {@linkcode boolean} for whether the {@linkcode pokemon} is the player's (`true`) or an enemy (`false`) * @param isPlayer {@linkcode boolean} for whether the {@linkcode pokemon} is the player's (`true`) or an enemy (`false`)
*/ */

View File

@ -42,7 +42,6 @@ export class MysteryEncounterPhase extends Phase {
/** /**
* Mostly useful for having repeated queries during a single encounter, where the queries and options may differ each time * Mostly useful for having repeated queries during a single encounter, where the queries and options may differ each time
* @param scene
* @param optionSelectSettings allows overriding the typical options of an encounter with new ones * @param optionSelectSettings allows overriding the typical options of an encounter with new ones
*/ */
constructor(optionSelectSettings?: OptionSelectSettings) { constructor(optionSelectSettings?: OptionSelectSettings) {
@ -290,7 +289,6 @@ export class MysteryEncounterBattlePhase extends Phase {
/** /**
* Gets intro battle message for new battle * Gets intro battle message for new battle
* @param scene
* @private * @private
*/ */
private getBattleMessage(): string { private getBattleMessage(): string {
@ -317,7 +315,6 @@ export class MysteryEncounterBattlePhase extends Phase {
/** /**
* Queues {@linkcode SummonPhase}s for the new battle, and handles trainer animations/dialogue if it's a Trainer battle * Queues {@linkcode SummonPhase}s for the new battle, and handles trainer animations/dialogue if it's a Trainer battle
* @param scene
* @private * @private
*/ */
private doMysteryEncounterBattle() { private doMysteryEncounterBattle() {
@ -386,7 +383,6 @@ export class MysteryEncounterBattlePhase extends Phase {
/** /**
* Initiate {@linkcode SummonPhase}s, {@linkcode ScanIvsPhase}, {@linkcode PostSummonPhase}s, etc. * Initiate {@linkcode SummonPhase}s, {@linkcode ScanIvsPhase}, {@linkcode PostSummonPhase}s, etc.
* @param scene
* @private * @private
*/ */
private endBattleSetup() { private endBattleSetup() {

View File

@ -18,7 +18,6 @@ export class SwitchPhase extends BattlePhase {
/** /**
* Creates a new SwitchPhase * Creates a new SwitchPhase
* @param scene {@linkcode BattleScene} Current battle scene
* @param switchType {@linkcode SwitchType} The type of switch logic this phase implements * @param switchType {@linkcode SwitchType} The type of switch logic this phase implements
* @param fieldIndex Field index to switch out * @param fieldIndex Field index to switch out
* @param isModal Indicates if the switch should be forced (true) or is * @param isModal Indicates if the switch should be forced (true) or is

View File

@ -23,7 +23,6 @@ export class SwitchSummonPhase extends SummonPhase {
/** /**
* Constructor for creating a new SwitchSummonPhase * Constructor for creating a new SwitchSummonPhase
* @param scene {@linkcode BattleScene} the scene the phase is associated with
* @param switchType the type of switch behavior * @param switchType the type of switch behavior
* @param fieldIndex integer representing position on the battle field * @param fieldIndex integer representing position on the battle field
* @param slotIndex integer for the index of pokemon (in party of 6) to switch into * @param slotIndex integer for the index of pokemon (in party of 6) to switch into

View File

@ -1,10 +1,10 @@
import BattleScene from "#app/battle-scene";
import { variantColorCache } from "#app/data/variant"; import { variantColorCache } from "#app/data/variant";
import Pokemon from "../field/pokemon"; import MysteryEncounterIntroVisuals from "#app/field/mystery-encounter-intro";
import Trainer from "../field/trainer"; import Pokemon from "#app/field/pokemon";
import Trainer from "#app/field/trainer";
import { globalScene } from "#app/global-scene";
import * as Utils from "#app/utils";
import FieldSpritePipeline from "./field-sprite"; import FieldSpritePipeline from "./field-sprite";
import * as Utils from "../utils";
import MysteryEncounterIntroVisuals from "../field/mystery-encounter-intro";
const spriteFragShader = ` const spriteFragShader = `
#ifdef GL_FRAGMENT_PRECISION_HIGH #ifdef GL_FRAGMENT_PRECISION_HIGH
@ -384,7 +384,7 @@ export default class SpritePipeline extends FieldSpritePipeline {
this.set4fv("tone", tone); this.set4fv("tone", tone);
this.bindTexture(this.game.textures.get("tera").source[0].glTexture!, 1); // TODO: is this bang correct? this.bindTexture(this.game.textures.get("tera").source[0].glTexture!, 1); // TODO: is this bang correct?
if ((gameObject.scene as BattleScene).fusionPaletteSwaps) { if (globalScene.fusionPaletteSwaps) {
const spriteColors = ((ignoreOverride && data["spriteColorsBase"]) || data["spriteColors"] || []) as number[][]; const spriteColors = ((ignoreOverride && data["spriteColorsBase"]) || data["spriteColors"] || []) as number[][];
const fusionSpriteColors = ((ignoreOverride && data["fusionSpriteColorsBase"]) || data["fusionSpriteColors"] || []) as number[][]; const fusionSpriteColors = ((ignoreOverride && data["fusionSpriteColorsBase"]) || data["fusionSpriteColors"] || []) as number[][];

View File

@ -152,7 +152,7 @@ export class ChallengeAchv extends Achv {
*/ */
export function getAchievementDescription(localizationKey: string): string { export function getAchievementDescription(localizationKey: string): string {
// We need to get the player gender from the game data to add the correct prefix to the achievement name // We need to get the player gender from the game data to add the correct prefix to the achievement name
const genderIndex = this?.scene?.gameData?.gender ?? PlayerGender.MALE; //TODO: why is `this` being used here!? We are not inside a scope (copied from original) const genderIndex = globalScene?.gameData?.gender ?? PlayerGender.MALE;
const genderStr = PlayerGender[genderIndex].toLowerCase(); const genderStr = PlayerGender[genderIndex].toLowerCase();
switch (localizationKey) { switch (localizationKey) {

View File

@ -820,9 +820,9 @@ export class GameData {
} }
if (device === Device.GAMEPAD) { if (device === Device.GAMEPAD) {
setSettingGamepad(setting as SettingGamepad, valueIndex); // Set the gamepad setting in the current scene setSettingGamepad(setting as SettingGamepad, valueIndex);
} else if (device === Device.KEYBOARD) { } else if (device === Device.KEYBOARD) {
setSettingKeyboard(setting as SettingKeyboard, valueIndex); // Set the keyboard setting in the current scene setSettingKeyboard(setting as SettingKeyboard, valueIndex);
} }
Object.keys(settingDefaults).forEach(s => { // Iterate over the default gamepad settings Object.keys(settingDefaults).forEach(s => { // Iterate over the default gamepad settings

View File

@ -694,15 +694,13 @@ export function settingIndex(key: string) {
/** /**
* Resets all settings to their defaults * Resets all settings to their defaults
* @param scene current BattleScene
*/ */
export function resetSettings() { export function resetSettings() {
Setting.forEach(s => setSetting(s.key, s.default)); Setting.forEach(s => setSetting(s.key, s.default));
} }
/** /**
* Updates a setting for current BattleScene * Updates a setting
* @param scene current BattleScene
* @param setting string ideally from SettingKeys * @param setting string ideally from SettingKeys
* @param value value to update setting with * @param value value to update setting with
* @returns true if successful, false if not * @returns true if successful, false if not

View File

@ -69,7 +69,6 @@ const tutorialHandlers = {
* Run through the specified tutorial if it hasn't been seen before and mark it as seen once done * Run through the specified tutorial if it hasn't been seen before and mark it as seen once done
* This will show a tutorial overlay if defined in the current {@linkcode AwaitableUiHandler} * This will show a tutorial overlay if defined in the current {@linkcode AwaitableUiHandler}
* The main menu will also get disabled while the tutorial is running * The main menu will also get disabled while the tutorial is running
* @param scene the current {@linkcode BattleScene}
* @param tutorial the {@linkcode Tutorial} to play * @param tutorial the {@linkcode Tutorial} to play
* @returns a promise with result `true` if the tutorial was run and finished, `false` otherwise * @returns a promise with result `true` if the tutorial was run and finished, `false` otherwise
*/ */
@ -107,7 +106,6 @@ export async function handleTutorial(tutorial: Tutorial): Promise<boolean> {
/** /**
* Show the tutorial overlay if there is one * Show the tutorial overlay if there is one
* @param scene the current BattleScene
* @param handler the current UiHandler * @param handler the current UiHandler
* @returns `true` once the overlay has finished appearing, or if there is no overlay * @returns `true` once the overlay has finished appearing, or if there is no overlay
*/ */
@ -129,7 +127,6 @@ async function showTutorialOverlay(handler: UiHandler) {
/** /**
* Hide the tutorial overlay if there is one * Hide the tutorial overlay if there is one
* @param scene the current BattleScene
* @param handler the current UiHandler * @param handler the current UiHandler
* @returns `true` once the overlay has finished disappearing, or if there is no overlay * @returns `true` once the overlay has finished disappearing, or if there is no overlay
*/ */

View File

@ -1,5 +1,4 @@
import i18next from "i18next"; import i18next from "i18next";
import BattleScene from "#app/battle-scene";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { TextStyle, addTextObject } from "./text"; import { TextStyle, addTextObject } from "./text";
@ -237,7 +236,3 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
}); });
} }
} }
export interface DailyRunScoreboard {
scene: BattleScene
}

View File

@ -437,7 +437,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
if (!eggs) { if (!eggs) {
eggs = []; eggs = [];
for (let i = 1; i <= pullCount; i++) { for (let i = 1; i <= pullCount; i++) {
const eggOptions: IEggOptions = { scene: globalScene, pulled: true, sourceType: this.gachaCursor }; const eggOptions: IEggOptions = { pulled: true, sourceType: this.gachaCursor };
// Before creating the last egg, check if the guaranteed egg tier was already generated // Before creating the last egg, check if the guaranteed egg tier was already generated
// if not, override the egg tier // if not, override the egg tier

View File

@ -1,6 +1,5 @@
import { getVariantTint } from "#app/data/variant"; import { getVariantTint } from "#app/data/variant";
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
import BattleScene from "#app/battle-scene";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { Gender, getGenderColor, getGenderSymbol } from "../data/gender"; import { Gender, getGenderColor, getGenderSymbol } from "../data/gender";
import { getNatureName } from "../data/nature"; import { getNatureName } from "../data/nature";
@ -317,8 +316,8 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
} else if ((caughtAttr & DexAttr.NON_SHINY) === BigInt(0) && ((caughtAttr & DexAttr.SHINY) === DexAttr.SHINY)) { //If the player has *only* caught any shiny variant of this species, not a non-shiny } else if ((caughtAttr & DexAttr.NON_SHINY) === BigInt(0) && ((caughtAttr & DexAttr.SHINY) === DexAttr.SHINY)) { //If the player has *only* caught any shiny variant of this species, not a non-shiny
this.pokemonShinyNewIcon.setVisible(true); this.pokemonShinyNewIcon.setVisible(true);
this.pokemonShinyNewIcon.setText("(+)"); this.pokemonShinyNewIcon.setText("(+)");
this.pokemonShinyNewIcon.setColor(getTextColor(TextStyle.SUMMARY_BLUE, false, this.scene.uiTheme)); this.pokemonShinyNewIcon.setColor(getTextColor(TextStyle.SUMMARY_BLUE, false, globalScene.uiTheme));
this.pokemonShinyNewIcon.setShadowColor(getTextColor(TextStyle.SUMMARY_BLUE, true, this.scene.uiTheme)); this.pokemonShinyNewIcon.setShadowColor(getTextColor(TextStyle.SUMMARY_BLUE, true, globalScene.uiTheme));
} else { } else {
this.pokemonShinyNewIcon.setVisible(false); this.pokemonShinyNewIcon.setVisible(false);
} }
@ -448,7 +447,3 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
}); });
} }
} }
export default interface PokemonInfoContainer {
scene: BattleScene
}

View File

@ -1,4 +1,3 @@
import BattleScene from "#app/battle-scene";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { GameModes } from "../game-mode"; import { GameModes } from "../game-mode";
import { TextStyle, addTextObject } from "./text"; import { TextStyle, addTextObject } from "./text";
@ -392,8 +391,3 @@ class RunEntryContainer extends Phaser.GameObjects.Container {
this.add(pokemonIconsContainer); this.add(pokemonIconsContainer);
} }
} }
interface RunEntryContainer {
scene: BattleScene;
}

View File

@ -1,5 +1,4 @@
import i18next from "i18next"; import i18next from "i18next";
import BattleScene from "#app/battle-scene";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { Button } from "#enums/buttons"; import { Button } from "#enums/buttons";
import { GameMode } from "../game-mode"; import { GameMode } from "../game-mode";
@ -421,7 +420,3 @@ class SessionSlot extends Phaser.GameObjects.Container {
}); });
} }
} }
interface SessionSlot {
scene: BattleScene;
}

View File

@ -13,7 +13,6 @@ export class ScrollBar extends Phaser.GameObjects.Container {
private maxRows: number; private maxRows: number;
/** /**
* @param scene the current scene
* @param x the scrollbar's x position (origin: top left) * @param x the scrollbar's x position (origin: top left)
* @param y the scrollbar's y position (origin: top left) * @param y the scrollbar's y position (origin: top left)
* @param width the scrollbar's width * @param width the scrollbar's width

View File

@ -24,15 +24,14 @@ export default class ScrollableGridUiHandler {
private cursor: number; private cursor: number;
private scrollCursor: number; private scrollCursor: number;
private scrollBar?: ScrollBar; private scrollBar?: ScrollBar;
/** Optional function that will get called if the whole grid needs to get updated */
private updateGridCallback?: UpdateGridCallbackFunction; private updateGridCallback?: UpdateGridCallbackFunction;
/** Optional function that will get called if a single element's information needs to get updated */
private updateDetailsCallback?: UpdateDetailsCallbackFunction; private updateDetailsCallback?: UpdateDetailsCallbackFunction;
/** /**
* @param scene the {@linkcode UiHandler} that needs its cursor updated based on the scrolling
* @param rows the maximum number of rows shown at once * @param rows the maximum number of rows shown at once
* @param columns the maximum number of columns shown at once * @param columns the maximum number of columns shown at once
* @param updateGridCallback optional function that will get called if the whole grid needs to get updated
* @param updateDetailsCallback optional function that will get called if a single element's information needs to get updated
*/ */
constructor(handler: UiHandler, rows: number, columns: number) { constructor(handler: UiHandler, rows: number, columns: number) {
this.handler = handler; this.handler = handler;

View File

@ -49,7 +49,6 @@ export default abstract class AbstractBindingUiHandler extends UiHandler {
/** /**
* Constructor for the AbstractBindingUiHandler. * Constructor for the AbstractBindingUiHandler.
* *
* @param scene - The BattleScene instance.
* @param mode - The UI mode. * @param mode - The UI mode.
*/ */
constructor(mode: Mode | null = null) { constructor(mode: Mode | null = null) {

View File

@ -72,7 +72,6 @@ export default abstract class AbstractControlSettingsUiHandler extends UiHandler
/** /**
* Constructor for the AbstractSettingsUiHandler. * Constructor for the AbstractSettingsUiHandler.
* *
* @param scene - The BattleScene instance.
* @param mode - The UI mode. * @param mode - The UI mode.
*/ */
constructor(mode: Mode | null = null) { constructor(mode: Mode | null = null) {

View File

@ -314,7 +314,7 @@ export default class AbstractSettingsUiHandler extends MessageUiHandler {
activateSetting(setting: Setting): boolean { activateSetting(setting: Setting): boolean {
switch (setting.key) { switch (setting.key) {
case SettingKeys.Move_Touch_Controls: case SettingKeys.Move_Touch_Controls:
globalScene.inputController.moveTouchControlsHandler.enableConfigurationMode(this.getUi(), globalScene); globalScene.inputController.moveTouchControlsHandler.enableConfigurationMode(this.getUi());
return true; return true;
} }
return false; return false;

View File

@ -1,7 +1,6 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import TouchControl from "#app/touch-controls"; import TouchControl from "#app/touch-controls";
import UI from "#app/ui/ui"; import UI from "#app/ui/ui";
import { Scene } from "phaser";
export const TOUCH_CONTROL_POSITIONS_LANDSCAPE = "touchControlPositionsLandscape"; export const TOUCH_CONTROL_POSITIONS_LANDSCAPE = "touchControlPositionsLandscape";
export const TOUCH_CONTROL_POSITIONS_PORTRAIT = "touchControlPositionsPortrait"; export const TOUCH_CONTROL_POSITIONS_PORTRAIT = "touchControlPositionsPortrait";
@ -320,9 +319,8 @@ export default class MoveTouchControlsHandler {
* Creates an overlay that covers the screen and allows the user to drag the touch controls around. * Creates an overlay that covers the screen and allows the user to drag the touch controls around.
* Also enables the toolbar for saving, resetting, and canceling the changes. * Also enables the toolbar for saving, resetting, and canceling the changes.
* @param ui The UI of the game. * @param ui The UI of the game.
* @param scene The scene of the game.
*/ */
private createOverlay(ui: UI, scene: Scene) { private createOverlay(ui: UI) {
const container = new Phaser.GameObjects.Container(globalScene, 0, 0); const container = new Phaser.GameObjects.Container(globalScene, 0, 0);
const overlay = new Phaser.GameObjects.Rectangle(globalScene, 0, 0, globalScene.game.canvas.width, globalScene.game.canvas.height, 0x000000, 0.5); const overlay = new Phaser.GameObjects.Rectangle(globalScene, 0, 0, globalScene.game.canvas.width, globalScene.game.canvas.height, 0x000000, 0.5);
overlay.setInteractive(); overlay.setInteractive();
@ -337,15 +335,14 @@ export default class MoveTouchControlsHandler {
/** /**
* Allows the user to configure the touch controls by dragging buttons around the screen. * Allows the user to configure the touch controls by dragging buttons around the screen.
* @param ui The UI of the game. * @param ui The UI of the game.
* @param scene The scene of the game.
*/ */
public enableConfigurationMode(ui: UI, scene: Scene) { public enableConfigurationMode(ui: UI) {
if (this.inConfigurationMode) { if (this.inConfigurationMode) {
return; return;
} }
this.inConfigurationMode = true; this.inConfigurationMode = true;
this.touchControls.disable(); this.touchControls.disable();
this.createOverlay(ui, scene); this.createOverlay(ui);
this.createToolbar(); this.createToolbar();
// Create event listeners with a delay to prevent the touchstart event from being triggered immediately. // Create event listeners with a delay to prevent the touchstart event from being triggered immediately.
setTimeout(() => { setTimeout(() => {

View File

@ -54,7 +54,6 @@ export class NavigationManager {
/** /**
* Navigates modes based on given direction * Navigates modes based on given direction
* @param scene The current BattleScene instance
* @param direction LEFT or RIGHT * @param direction LEFT or RIGHT
*/ */
public navigate(direction) { public navigate(direction) {
@ -98,7 +97,6 @@ export default class NavigationMenu extends Phaser.GameObjects.Container {
/** /**
* Creates an instance of NavigationMenu. * Creates an instance of NavigationMenu.
* @param scene The current BattleScene instance.
* @param x The x position of the NavigationMenu. * @param x The x position of the NavigationMenu.
* @param y The y position of the NavigationMenu. * @param y The y position of the NavigationMenu.
*/ */

View File

@ -7,7 +7,6 @@ export default class SettingsAudioUiHandler extends AbstractSettingsUiHandler {
/** /**
* Creates an instance of SettingsAudioUiHandler. * Creates an instance of SettingsAudioUiHandler.
* *
* @param scene - The BattleScene instance.
* @param mode - The UI mode, optional. * @param mode - The UI mode, optional.
*/ */
constructor(mode: Mode | null = null) { constructor(mode: Mode | null = null) {

View File

@ -7,7 +7,6 @@ export default class SettingsDisplayUiHandler extends AbstractSettingsUiHandler
/** /**
* Creates an instance of SettingsGamepadUiHandler. * Creates an instance of SettingsGamepadUiHandler.
* *
* @param scene - The BattleScene instance.
* @param mode - The UI mode, optional. * @param mode - The UI mode, optional.
*/ */
constructor(mode: Mode | null = null) { constructor(mode: Mode | null = null) {

View File

@ -28,7 +28,6 @@ export default class SettingsGamepadUiHandler extends AbstractControlSettingsUiH
/** /**
* Creates an instance of SettingsGamepadUiHandler. * Creates an instance of SettingsGamepadUiHandler.
* *
* @param scene - The BattleScene instance.
* @param mode - The UI mode, optional. * @param mode - The UI mode, optional.
*/ */
constructor(mode: Mode | null = null) { constructor(mode: Mode | null = null) {

View File

@ -26,7 +26,6 @@ export default class SettingsKeyboardUiHandler extends AbstractControlSettingsUi
/** /**
* Creates an instance of SettingsKeyboardUiHandler. * Creates an instance of SettingsKeyboardUiHandler.
* *
* @param scene - The BattleScene instance.
* @param mode - The UI mode, optional. * @param mode - The UI mode, optional.
*/ */
constructor(mode: Mode | null = null) { constructor(mode: Mode | null = null) {

View File

@ -6,7 +6,6 @@ export default class SettingsUiHandler extends AbstractSettingsUiHandler {
/** /**
* Creates an instance of SettingsGamepadUiHandler. * Creates an instance of SettingsGamepadUiHandler.
* *
* @param scene - The BattleScene instance.
* @param mode - The UI mode, optional. * @param mode - The UI mode, optional.
*/ */
constructor(mode: Mode | null = null) { constructor(mode: Mode | null = null) {

View File

@ -1821,7 +1821,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
} }
this.pokemonCandyCountText.setText(`x${starterData.candyCount}`); this.pokemonCandyCountText.setText(`x${starterData.candyCount}`);
const egg = new Egg({ scene: globalScene, species: this.lastSpecies.speciesId, sourceType: EggSourceType.SAME_SPECIES_EGG }); const egg = new Egg({ species: this.lastSpecies.speciesId, sourceType: EggSourceType.SAME_SPECIES_EGG });
egg.addEggToGameData(); egg.addEggToGameData();
globalScene.gameData.saveSystem().then(success => { globalScene.gameData.saveSystem().then(success => {

View File

@ -12,8 +12,7 @@ export default abstract class UiHandler {
public active: boolean = false; public active: boolean = false;
/** /**
* @param {BattleScene} scene The same scene as everything else. * @param mode The mode of the UI element. These should be unique.
* @param {Mode} mode The mode of the UI element. These should be unique.
*/ */
constructor(mode: Mode | null = null) { constructor(mode: Mode | null = null) {
this.mode = mode; this.mode = mode;

View File

@ -1,4 +1,3 @@
import { default as BattleScene } from "#app/battle-scene";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";
import BattleMessageUiHandler from "./battle-message-ui-handler"; import BattleMessageUiHandler from "./battle-message-ui-handler";
@ -269,12 +268,11 @@ export default class UI extends Phaser.GameObjects.Container {
return false; return false;
} }
const battleScene = globalScene as BattleScene;
if ([ Mode.CONFIRM, Mode.COMMAND, Mode.FIGHT, Mode.MESSAGE ].includes(this.mode)) { if ([ Mode.CONFIRM, Mode.COMMAND, Mode.FIGHT, Mode.MESSAGE ].includes(this.mode)) {
battleScene?.processInfoButton(pressed); globalScene?.processInfoButton(pressed);
return true; return true;
} }
battleScene?.processInfoButton(false); globalScene?.processInfoButton(false);
return true; return true;
} }
@ -319,11 +317,10 @@ export default class UI extends Phaser.GameObjects.Container {
} }
showDialogue(keyOrText: string, name: string | undefined, delay: integer | null = 0, callback: Function, callbackDelay?: integer, promptDelay?: integer): void { showDialogue(keyOrText: string, name: string | undefined, delay: integer | null = 0, callback: Function, callbackDelay?: integer, promptDelay?: integer): void {
const battleScene = globalScene as BattleScene;
// Get localized dialogue (if available) // Get localized dialogue (if available)
let hasi18n = false; let hasi18n = false;
let text = keyOrText; let text = keyOrText;
const genderIndex = battleScene.gameData.gender ?? PlayerGender.UNSET; const genderIndex = globalScene.gameData.gender ?? PlayerGender.UNSET;
const genderStr = PlayerGender[genderIndex].toLowerCase(); const genderStr = PlayerGender[genderIndex].toLowerCase();
if (i18next.exists(keyOrText) ) { if (i18next.exists(keyOrText) ) {
@ -340,7 +337,7 @@ export default class UI extends Phaser.GameObjects.Container {
} }
} }
let showMessageAndCallback = () => { let showMessageAndCallback = () => {
hasi18n && battleScene.gameData.saveSeenDialogue(keyOrText); hasi18n && globalScene.gameData.saveSeenDialogue(keyOrText);
callback(); callback();
}; };
if (text.indexOf("$") > -1) { if (text.indexOf("$") > -1) {
@ -361,10 +358,8 @@ export default class UI extends Phaser.GameObjects.Container {
} }
shouldSkipDialogue(i18nKey: string): boolean { shouldSkipDialogue(i18nKey: string): boolean {
const battleScene = globalScene as BattleScene;
if (i18next.exists(i18nKey) ) { if (i18next.exists(i18nKey) ) {
if (battleScene.skipSeenDialogues && battleScene.gameData.getSeenDialogues()[i18nKey] === true) { if (globalScene.skipSeenDialogues && globalScene.gameData.getSeenDialogues()[i18nKey] === true) {
return true; return true;
} }
} }