Remove tsdocs referencing `scene` params
Remove missed instances of `.scene`
This commit is contained in:
parent
0208956b95
commit
64f4a037d7
|
@ -1064,7 +1064,7 @@ export default class BattleScene extends SceneBase {
|
|||
/**
|
||||
* 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`
|
||||
*
|
||||
* @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> {
|
||||
return new Promise(resolve => {
|
||||
Promise.allSettled(party.map(p => {
|
||||
if (p.scene) {
|
||||
p.calculateStats();
|
||||
}
|
||||
p.calculateStats();
|
||||
return p.updateInfo(instant);
|
||||
})).then(() => resolve());
|
||||
});
|
||||
|
@ -2929,7 +2927,6 @@ export default class BattleScene extends SceneBase {
|
|||
|
||||
/**
|
||||
* 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 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`
|
||||
|
|
|
@ -74,7 +74,6 @@ export abstract class ArenaTag {
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public getSourcePokemon(): Pokemon | null {
|
||||
|
@ -83,7 +82,6 @@ export abstract class ArenaTag {
|
|||
|
||||
/**
|
||||
* Helper function that retrieves the Pokemon affected
|
||||
* @param scene - medium to retrieve the involved Pokemon
|
||||
* @returns list of PlayerPokemon or EnemyPokemon on the field
|
||||
*/
|
||||
public getAffectedPokemon(): Pokemon[] {
|
||||
|
|
|
@ -555,7 +555,6 @@ function logMissingMoveAnim(move: Moves, ...optionalParams: any[]) {
|
|||
|
||||
/**
|
||||
* Fetches animation configs to be used in a Mystery Encounter
|
||||
* @param scene
|
||||
* @param encounterAnim one or more animations to fetch
|
||||
*/
|
||||
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
|
||||
* MUST be called after {@linkcode initEncounterAnims()} to load all required animations properly
|
||||
* @param scene
|
||||
* @param startLoad
|
||||
*/
|
||||
export async function loadEncounterAnimAssets(startLoad?: boolean): Promise<void> {
|
||||
|
@ -1121,8 +1119,6 @@ export abstract class BattleAnim {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param scene
|
||||
* @param targetInitialX
|
||||
* @param targetInitialY
|
||||
* @param frameTimeMult
|
||||
|
|
|
@ -110,7 +110,6 @@ export class BattlerTag {
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public getSourcePokemon(): Pokemon | null {
|
||||
|
|
|
@ -179,14 +179,10 @@ export class Egg {
|
|||
}
|
||||
};
|
||||
|
||||
if (eggOptions?.scene) {
|
||||
const seedOverride = Utils.randomString(24);
|
||||
eggOptions?.scene.executeWithSeedOffset(() => {
|
||||
generateEggProperties(eggOptions);
|
||||
}, 0, seedOverride);
|
||||
} else { // For legacy eggs without scene
|
||||
const seedOverride = Utils.randomString(24);
|
||||
globalScene.executeWithSeedOffset(() => {
|
||||
generateEggProperties(eggOptions);
|
||||
}
|
||||
}, 0, seedOverride);
|
||||
|
||||
this._eggDescriptor = eggOptions?.eggDescriptor;
|
||||
}
|
||||
|
|
|
@ -468,8 +468,6 @@ function doGreedentEatBerries() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param scene
|
||||
* @param isEat Default false. Will "create" pile when false, and remove pile when true.
|
||||
*/
|
||||
function doBerrySpritePile(isEat: boolean = false) {
|
||||
|
|
|
@ -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.
|
||||
* @param scene
|
||||
* @param tradedPokemon
|
||||
* @param receivedPokemon
|
||||
*/
|
||||
|
|
|
@ -126,8 +126,6 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with
|
|||
|
||||
/**
|
||||
* Generic handler for using a guiding pokemon to guide you back.
|
||||
*
|
||||
* @param scene Battle scene
|
||||
*/
|
||||
function handlePokemonGuidingYouPhase() {
|
||||
const laprasSpecies = getPokemonSpecies(Species.LAPRAS);
|
||||
|
|
|
@ -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.
|
||||
* Returns whether the transformed pokemon unlocks a new starter for the player.
|
||||
* @param scene
|
||||
* @param previousPokemon
|
||||
* @param newPokemon
|
||||
* @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`)
|
||||
* @param scene
|
||||
* @param newPokemon
|
||||
* @param speciesRootForm
|
||||
*/
|
||||
|
|
|
@ -74,7 +74,6 @@ export default class MysteryEncounterOption implements IMysteryEncounterOption {
|
|||
|
||||
/**
|
||||
* Returns true if all {@linkcode EncounterRequirement}s for the option are met
|
||||
* @param scene
|
||||
*/
|
||||
meetsRequirements(): boolean {
|
||||
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
|
||||
* @param scene
|
||||
* @param pokemon
|
||||
*/
|
||||
pokemonMeetsPrimaryRequirements(pokemon: Pokemon): boolean {
|
||||
|
@ -96,7 +94,6 @@ export default class MysteryEncounterOption implements IMysteryEncounterOption {
|
|||
* AND there is a valid Pokemon assigned to {@linkcode primaryPokemon}.
|
||||
* If both {@linkcode primaryPokemonRequirements} and {@linkcode secondaryPokemonRequirements} are defined,
|
||||
* can cause scenarios where there are not enough Pokemon that are sufficient for all requirements.
|
||||
* @param scene
|
||||
*/
|
||||
meetsPrimaryRequirementAndPrimaryPokemonSelected(): boolean {
|
||||
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).
|
||||
* If both {@linkcode primaryPokemonRequirements} and {@linkcode secondaryPokemonRequirements} are defined,
|
||||
* can cause scenarios where there are not enough Pokemon that are sufficient for all requirements.
|
||||
* @param scene
|
||||
*/
|
||||
meetsSupportingRequirementAndSupportingPokemonSelected(): boolean {
|
||||
if (!this.secondaryPokemonRequirements || this.secondaryPokemonRequirements.length === 0) {
|
||||
|
|
|
@ -25,13 +25,11 @@ export interface EncounterRequirement {
|
|||
export abstract class EncounterSceneRequirement implements EncounterRequirement {
|
||||
/**
|
||||
* Returns whether the EncounterSceneRequirement's... requirements, are met by the given scene
|
||||
* @param partyPokemon
|
||||
*/
|
||||
abstract meetsRequirement(): boolean;
|
||||
/**
|
||||
* Returns a dialogue token key/value pair for a given Requirement.
|
||||
* Should be overridden by child Requirement classes.
|
||||
* @param scene
|
||||
* @param pokemon
|
||||
*/
|
||||
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})
|
||||
* @param scene The {@linkcode BattleScene} to check against
|
||||
* @returns true if all/any requirements are met (depends on {@linkcode isAnd})
|
||||
*/
|
||||
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}.
|
||||
* @param scene The {@linkcode BattleScene} to check against
|
||||
* @param pokemon The {@linkcode PlayerPokemon} to check against
|
||||
* @returns A dialogue token key/value pair
|
||||
* @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
|
||||
* @param partyPokemon
|
||||
*/
|
||||
abstract meetsRequirement(): boolean;
|
||||
|
||||
|
@ -111,7 +106,6 @@ export abstract class EncounterPokemonRequirement implements EncounterRequiremen
|
|||
/**
|
||||
* Returns a dialogue token key/value pair for a given Requirement.
|
||||
* Should be overridden by child Requirement classes.
|
||||
* @param scene
|
||||
* @param pokemon
|
||||
*/
|
||||
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})
|
||||
* @param scene The {@linkcode BattleScene} to check against
|
||||
* @returns true if all/any requirements are met (depends on {@linkcode isAnd})
|
||||
*/
|
||||
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}.
|
||||
* @param scene The {@linkcode BattleScene} to check against
|
||||
* @param pokemon The {@linkcode PlayerPokemon} to check against
|
||||
* @returns A dialogue token key/value pair
|
||||
* @throws An {@linkcode Error} if {@linkcode isAnd} is `true` (not supported)
|
||||
|
|
|
@ -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
|
||||
* This is used to filter the pool of encounters down to only the ones with all requirements met
|
||||
* @param scene
|
||||
* @returns
|
||||
*/
|
||||
meetsRequirements(): boolean {
|
||||
|
@ -310,7 +309,6 @@ export default class MysteryEncounter implements IMysteryEncounter {
|
|||
/**
|
||||
* 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
|
||||
* @param scene
|
||||
* @param pokemon
|
||||
*/
|
||||
pokemonMeetsPrimaryRequirements(pokemon: Pokemon): boolean {
|
||||
|
@ -322,7 +320,6 @@ export default class MysteryEncounter implements IMysteryEncounter {
|
|||
* AND there is a valid Pokemon assigned to {@linkcode primaryPokemon}.
|
||||
* If both {@linkcode primaryPokemonRequirements} and {@linkcode secondaryPokemonRequirements} are defined,
|
||||
* can cause scenarios where there are not enough Pokemon that are sufficient for all requirements.
|
||||
* @param scene
|
||||
*/
|
||||
private meetsPrimaryRequirementAndPrimaryPokemonSelected(): boolean {
|
||||
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).
|
||||
* If both {@linkcode primaryPokemonRequirements} and {@linkcode secondaryPokemonRequirements} are defined,
|
||||
* can cause scenarios where there are not enough Pokemon that are sufficient for all requirements.
|
||||
* @param scene
|
||||
*/
|
||||
private meetsSecondaryRequirementAndSecondaryPokemonSelected(): boolean {
|
||||
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
|
||||
* @param scene
|
||||
*/
|
||||
initIntroVisuals(): void {
|
||||
this.introVisuals = new MysteryEncounterIntroVisuals(this);
|
||||
|
@ -518,7 +513,6 @@ export default class MysteryEncounter implements IMysteryEncounter {
|
|||
/**
|
||||
* Maintains seed offset for RNG consistency
|
||||
* Increments if the same {@linkcode MysteryEncounter} has multiple option select cycles
|
||||
* @param scene
|
||||
*/
|
||||
updateSeedOffset() {
|
||||
const currentOffset = this.seedOffset ?? globalScene.currentBattle.waveIndex * 1000;
|
||||
|
|
|
@ -960,7 +960,6 @@ export const noStarterFormKeys: string[] = [
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export function getPokerusStarters(): PokemonSpecies[] {
|
||||
|
|
|
@ -1134,7 +1134,6 @@ interface TrainerConfigs {
|
|||
|
||||
/**
|
||||
* The function to get variable strength grunts
|
||||
* @param scene the singleton scene being passed in
|
||||
* @returns the correct TrainerPartyTemplate
|
||||
*/
|
||||
function getEvilGruntPartyTemplate(): TrainerPartyTemplate {
|
||||
|
|
|
@ -6,7 +6,6 @@ import { isNullOrUndefined } from "#app/utils";
|
|||
import { getSpriteKeysFromSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import { Variant } from "#app/data/variant";
|
||||
import { doShinySparkleAnim } from "#app/field/anims";
|
||||
import type BattleScene from "#app/battle-scene";
|
||||
import PlayAnimationConfig = Phaser.Types.Animations.PlayAnimationConfig;
|
||||
|
||||
type KnownFileRoot =
|
||||
|
@ -220,7 +219,7 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
|
|||
if (config.isPokemon) {
|
||||
globalScene.loadPokemonAtlas(config.spriteKey, config.fileRoot);
|
||||
if (config.isShiny) {
|
||||
this.scene.loadPokemonVariantAssets(config.spriteKey, config.fileRoot, config.variant);
|
||||
globalScene.loadPokemonVariantAssets(config.spriteKey, config.fileRoot, config.variant);
|
||||
}
|
||||
} else if (config.isItem) {
|
||||
globalScene.loadAtlas("items", "");
|
||||
|
@ -338,7 +337,7 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
|
|||
*/
|
||||
playShinySparkles() {
|
||||
for (const sparkleConfig of this.shinySparkleSprites) {
|
||||
this.scene.time.delayedCall(500, () => {
|
||||
globalScene.time.delayedCall(500, () => {
|
||||
doShinySparkleAnim(sparkleConfig.sprite, sparkleConfig.variant);
|
||||
});
|
||||
}
|
||||
|
@ -503,10 +502,3 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
|
|||
return super.setVisible(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface is required so as not to override {@link Phaser.GameObjects.Container.scene}
|
||||
*/
|
||||
export default interface MysteryEncounterIntroVisuals {
|
||||
scene: BattleScene
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* <!-- @import "../battle".Battle -->
|
||||
* 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`,
|
||||
* 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 {
|
||||
public compatibleTms: Moves[];
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import BattleScene from "#app/battle-scene";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
|
||||
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
|
||||
}
|
||||
|
|
|
@ -109,7 +109,6 @@ export class GameMode implements GameModeConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param scene current BattleScene
|
||||
* @returns either:
|
||||
* - random biome for Daily mode
|
||||
* - override from overrides.ts
|
||||
|
@ -136,8 +135,8 @@ export class GameMode implements GameModeConfig {
|
|||
/**
|
||||
* 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 arena the arena that contains the scene and functions
|
||||
* @returns true if a trainer should be generated, false otherwise
|
||||
* @param arena the current {@linkcode Arena}
|
||||
* @returns `true` if a trainer should be generated, `false` otherwise
|
||||
*/
|
||||
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
|
||||
* after a X0 full party heal
|
||||
*/
|
||||
|
||||
const trainerChance = arena.getTrainerChance();
|
||||
let allowTrainerBattle = true;
|
||||
if (trainerChance) {
|
||||
|
|
|
@ -95,15 +95,12 @@ export class InputsController {
|
|||
/**
|
||||
* 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
|
||||
* 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.
|
||||
* Specific buttons like MENU and STATS are set not to repeat their actions.
|
||||
* It concludes by calling the `init` method to complete the setup.
|
||||
*/
|
||||
|
||||
constructor() {
|
||||
this.selectedDevice = {
|
||||
[Device.GAMEPAD]: null,
|
||||
|
|
|
@ -1153,7 +1153,7 @@ class FormChangeItemModifierTypeGenerator extends ModifierTypeGenerator {
|
|||
let foundULTRA_Z = false,
|
||||
foundN_LUNA = false,
|
||||
foundN_SOLAR = false;
|
||||
formChangeItemTriggers.forEach((fc, i) => {
|
||||
formChangeItemTriggers.forEach((fc, _i) => {
|
||||
switch (fc.item) {
|
||||
case FormChangeItem.ULTRANECROZIUM_Z:
|
||||
foundULTRA_Z = true;
|
||||
|
@ -1236,7 +1236,7 @@ export class EnemyAttackStatusEffectChanceModifierType extends ModifierType {
|
|||
private effect: StatusEffect;
|
||||
|
||||
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.effect = effect;
|
||||
|
@ -1275,7 +1275,7 @@ type WeightedModifierTypeWeightFunc = (party: Pokemon[], rerollCount?: integer)
|
|||
* @returns A WeightedModifierTypeWeightFunc
|
||||
*/
|
||||
function skipInClassicAfterWave(wave: integer, defaultWeight: integer): WeightedModifierTypeWeightFunc {
|
||||
return (party: Pokemon[]) => {
|
||||
return () => {
|
||||
const gameMode = globalScene.gameMode;
|
||||
const currentWave = globalScene.currentBattle.waveIndex;
|
||||
return gameMode.isClassic && currentWave >= wave ? 0 : defaultWeight;
|
||||
|
@ -1300,7 +1300,7 @@ function skipInLastClassicWaveOrDefault(defaultWeight: integer) : WeightedModifi
|
|||
* @returns A WeightedModifierTypeWeightFunc
|
||||
*/
|
||||
function lureWeightFunc(maxBattles: number, weight: number): WeightedModifierTypeWeightFunc {
|
||||
return (party: Pokemon[]) => {
|
||||
return () => {
|
||||
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;
|
||||
};
|
||||
|
@ -1448,7 +1448,7 @@ export const modifierTypes = {
|
|||
|
||||
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)) {
|
||||
return new PokemonNatureChangeModifierType(pregenArgs[0] as Nature);
|
||||
}
|
||||
|
@ -1472,7 +1472,7 @@ export const modifierTypes = {
|
|||
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)) {
|
||||
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_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) {
|
||||
return new PokemonBaseStatTotalModifierType(pregenArgs[0] as number);
|
||||
}
|
||||
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) {
|
||||
return new PokemonBaseStatFlatModifierType(pregenArgs[0] as number, pregenArgs[1] as Stat[]);
|
||||
}
|
||||
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) {
|
||||
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
|
||||
* @param party The player's party, just used to access the scene
|
||||
* @param ballType The {@linkcode PokeballType} being checked
|
||||
* @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);
|
||||
}
|
||||
|
||||
const modifierPool: ModifierPool = {
|
||||
[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.POTION, (party: Pokemon[]) => {
|
||||
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;
|
||||
}),
|
||||
[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.FULL_HEAL, (party: Pokemon[]) => {
|
||||
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.SUPER_LURE, lureWeightFunc(15, 4)),
|
||||
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);
|
||||
}, 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.TM_GREAT, 3),
|
||||
new WeightedModifierType(modifierTypes.MEMORY_MUSHROOM, (party: Pokemon[]) => {
|
||||
|
@ -1715,18 +1714,18 @@ const modifierPool: ModifierPool = {
|
|||
new WeightedModifierType(modifierTypes.BASE_STAT_BOOSTER, 3),
|
||||
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.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 => {
|
||||
m.setTier(ModifierTier.GREAT); return m;
|
||||
}),
|
||||
[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.BIG_NUGGET, skipInLastClassicWaveOrDefault(12)),
|
||||
new WeightedModifierType(modifierTypes.PP_MAX, 3),
|
||||
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.FORM_CHANGE_ITEM, (party: Pokemon[]) => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 6, 24),
|
||||
new WeightedModifierType(modifierTypes.RARE_EVOLUTION_ITEM, () => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 15) * 4, 32), 32),
|
||||
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.EVIOLITE, (party: Pokemon[]) => {
|
||||
const { gameMode, gameData } = globalScene;
|
||||
|
@ -1823,14 +1822,14 @@ const modifierPool: ModifierPool = {
|
|||
new WeightedModifierType(modifierTypes.EXP_CHARM, skipInLastClassicWaveOrDefault(8)),
|
||||
new WeightedModifierType(modifierTypes.EXP_SHARE, skipInLastClassicWaveOrDefault(10)),
|
||||
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.WIDE_LENS, 4),
|
||||
].map(m => {
|
||||
m.setTier(ModifierTier.ULTRA); return m;
|
||||
}),
|
||||
[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.LEFTOVERS, 3),
|
||||
new WeightedModifierType(modifierTypes.SHELL_BELL, 3),
|
||||
|
@ -1840,28 +1839,28 @@ const modifierPool: ModifierPool = {
|
|||
new WeightedModifierType(modifierTypes.BATON, 2),
|
||||
new WeightedModifierType(modifierTypes.SOUL_DEW, 7),
|
||||
//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.FOCUS_BAND, 5),
|
||||
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.RARE_FORM_CHANGE_ITEM, (party: Pokemon[]) => 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.DYNAMAX_BAND, (party: Pokemon[]) => 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.RARE_FORM_CHANGE_ITEM, () => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 6, 24),
|
||||
new WeightedModifierType(modifierTypes.MEGA_BRACELET, () => 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),
|
||||
].map(m => {
|
||||
m.setTier(ModifierTier.ROGUE); return m;
|
||||
}),
|
||||
[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.HEALING_CHARM, 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),
|
||||
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 => {
|
||||
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) {
|
||||
const pool = getModifierPoolForType(poolType);
|
||||
itemPoolChecks.forEach((v, k) => {
|
||||
itemPoolChecks.forEach((_v, k) => {
|
||||
itemPoolChecks.set(k, false);
|
||||
});
|
||||
|
||||
|
@ -2183,7 +2182,7 @@ export function getPlayerModifierTypeOptions(count: integer, party: PlayerPokemo
|
|||
|
||||
// Guaranteed mod functions second
|
||||
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;
|
||||
let guaranteedMod: ModifierType = modifierTypes[modifierId]?.();
|
||||
|
||||
|
|
|
@ -760,7 +760,6 @@ export abstract class LapsingPokemonHeldItemModifier extends PokemonHeldItemModi
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @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.
|
||||
* @param modifiers {@linkcode PersistentModifier} array of the player's modifiers
|
||||
* @param _virtual N/A
|
||||
* @param scene
|
||||
* @returns true if the modifier was successfully added or applied, false otherwise
|
||||
*/
|
||||
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:
|
||||
* - The player
|
||||
* - The enemy
|
||||
* @param scene current {@linkcode BattleScene}
|
||||
* @param isPlayer {@linkcode boolean} for whether the player (`true`) or enemy (`false`) is being overridden
|
||||
*/
|
||||
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:
|
||||
* - The first member of the player's team when starting a new game
|
||||
* - An enemy {@linkcode Pokemon} being spawned in
|
||||
* @param scene current {@linkcode BattleScene}
|
||||
* @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`)
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
* @param scene
|
||||
* @param optionSelectSettings allows overriding the typical options of an encounter with new ones
|
||||
*/
|
||||
constructor(optionSelectSettings?: OptionSelectSettings) {
|
||||
|
@ -290,7 +289,6 @@ export class MysteryEncounterBattlePhase extends Phase {
|
|||
|
||||
/**
|
||||
* Gets intro battle message for new battle
|
||||
* @param scene
|
||||
* @private
|
||||
*/
|
||||
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
|
||||
* @param scene
|
||||
* @private
|
||||
*/
|
||||
private doMysteryEncounterBattle() {
|
||||
|
@ -386,7 +383,6 @@ export class MysteryEncounterBattlePhase extends Phase {
|
|||
|
||||
/**
|
||||
* Initiate {@linkcode SummonPhase}s, {@linkcode ScanIvsPhase}, {@linkcode PostSummonPhase}s, etc.
|
||||
* @param scene
|
||||
* @private
|
||||
*/
|
||||
private endBattleSetup() {
|
||||
|
|
|
@ -18,7 +18,6 @@ export class SwitchPhase extends BattlePhase {
|
|||
|
||||
/**
|
||||
* Creates a new SwitchPhase
|
||||
* @param scene {@linkcode BattleScene} Current battle scene
|
||||
* @param switchType {@linkcode SwitchType} The type of switch logic this phase implements
|
||||
* @param fieldIndex Field index to switch out
|
||||
* @param isModal Indicates if the switch should be forced (true) or is
|
||||
|
|
|
@ -23,7 +23,6 @@ export class SwitchSummonPhase extends SummonPhase {
|
|||
|
||||
/**
|
||||
* 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 fieldIndex integer representing position on the battle field
|
||||
* @param slotIndex integer for the index of pokemon (in party of 6) to switch into
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import BattleScene from "#app/battle-scene";
|
||||
import { variantColorCache } from "#app/data/variant";
|
||||
import Pokemon from "../field/pokemon";
|
||||
import Trainer from "../field/trainer";
|
||||
import MysteryEncounterIntroVisuals from "#app/field/mystery-encounter-intro";
|
||||
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 * as Utils from "../utils";
|
||||
import MysteryEncounterIntroVisuals from "../field/mystery-encounter-intro";
|
||||
|
||||
const spriteFragShader = `
|
||||
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||
|
@ -384,7 +384,7 @@ export default class SpritePipeline extends FieldSpritePipeline {
|
|||
this.set4fv("tone", tone);
|
||||
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 fusionSpriteColors = ((ignoreOverride && data["fusionSpriteColorsBase"]) || data["fusionSpriteColors"] || []) as number[][];
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ export class ChallengeAchv extends Achv {
|
|||
*/
|
||||
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
|
||||
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();
|
||||
|
||||
switch (localizationKey) {
|
||||
|
|
|
@ -820,9 +820,9 @@ export class GameData {
|
|||
}
|
||||
|
||||
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) {
|
||||
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
|
||||
|
|
|
@ -694,15 +694,13 @@ export function settingIndex(key: string) {
|
|||
|
||||
/**
|
||||
* Resets all settings to their defaults
|
||||
* @param scene current BattleScene
|
||||
*/
|
||||
export function resetSettings() {
|
||||
Setting.forEach(s => setSetting(s.key, s.default));
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a setting for current BattleScene
|
||||
* @param scene current BattleScene
|
||||
* Updates a setting
|
||||
* @param setting string ideally from SettingKeys
|
||||
* @param value value to update setting with
|
||||
* @returns true if successful, false if not
|
||||
|
|
|
@ -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
|
||||
* 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
|
||||
* @param scene the current {@linkcode BattleScene}
|
||||
* @param tutorial the {@linkcode Tutorial} to play
|
||||
* @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
|
||||
* @param scene the current BattleScene
|
||||
* @param handler the current UiHandler
|
||||
* @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
|
||||
* @param scene the current BattleScene
|
||||
* @param handler the current UiHandler
|
||||
* @returns `true` once the overlay has finished disappearing, or if there is no overlay
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import i18next from "i18next";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import * as Utils from "../utils";
|
||||
import { TextStyle, addTextObject } from "./text";
|
||||
|
@ -237,7 +236,3 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
export interface DailyRunScoreboard {
|
||||
scene: BattleScene
|
||||
}
|
||||
|
|
|
@ -437,7 +437,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
|||
if (!eggs) {
|
||||
eggs = [];
|
||||
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
|
||||
// if not, override the egg tier
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { getVariantTint } from "#app/data/variant";
|
||||
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { Gender, getGenderColor, getGenderSymbol } from "../data/gender";
|
||||
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
|
||||
this.pokemonShinyNewIcon.setVisible(true);
|
||||
this.pokemonShinyNewIcon.setText("(+)");
|
||||
this.pokemonShinyNewIcon.setColor(getTextColor(TextStyle.SUMMARY_BLUE, false, this.scene.uiTheme));
|
||||
this.pokemonShinyNewIcon.setShadowColor(getTextColor(TextStyle.SUMMARY_BLUE, true, this.scene.uiTheme));
|
||||
this.pokemonShinyNewIcon.setColor(getTextColor(TextStyle.SUMMARY_BLUE, false, globalScene.uiTheme));
|
||||
this.pokemonShinyNewIcon.setShadowColor(getTextColor(TextStyle.SUMMARY_BLUE, true, globalScene.uiTheme));
|
||||
} else {
|
||||
this.pokemonShinyNewIcon.setVisible(false);
|
||||
}
|
||||
|
@ -448,7 +447,3 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default interface PokemonInfoContainer {
|
||||
scene: BattleScene
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import BattleScene from "#app/battle-scene";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { GameModes } from "../game-mode";
|
||||
import { TextStyle, addTextObject } from "./text";
|
||||
|
@ -392,8 +391,3 @@ class RunEntryContainer extends Phaser.GameObjects.Container {
|
|||
this.add(pokemonIconsContainer);
|
||||
}
|
||||
}
|
||||
|
||||
interface RunEntryContainer {
|
||||
scene: BattleScene;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import i18next from "i18next";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { Button } from "#enums/buttons";
|
||||
import { GameMode } from "../game-mode";
|
||||
|
@ -421,7 +420,3 @@ class SessionSlot extends Phaser.GameObjects.Container {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
interface SessionSlot {
|
||||
scene: BattleScene;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ export class ScrollBar extends Phaser.GameObjects.Container {
|
|||
private maxRows: number;
|
||||
|
||||
/**
|
||||
* @param scene the current scene
|
||||
* @param x the scrollbar's x position (origin: top left)
|
||||
* @param y the scrollbar's y position (origin: top left)
|
||||
* @param width the scrollbar's width
|
||||
|
|
|
@ -24,15 +24,14 @@ export default class ScrollableGridUiHandler {
|
|||
private cursor: number;
|
||||
private scrollCursor: number;
|
||||
private scrollBar?: ScrollBar;
|
||||
/** Optional function that will get called if the whole grid needs to get updated */
|
||||
private updateGridCallback?: UpdateGridCallbackFunction;
|
||||
/** Optional function that will get called if a single element's information needs to get updated */
|
||||
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 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) {
|
||||
this.handler = handler;
|
||||
|
|
|
@ -49,7 +49,6 @@ export default abstract class AbstractBindingUiHandler extends UiHandler {
|
|||
/**
|
||||
* Constructor for the AbstractBindingUiHandler.
|
||||
*
|
||||
* @param scene - The BattleScene instance.
|
||||
* @param mode - The UI mode.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
|
|
|
@ -72,7 +72,6 @@ export default abstract class AbstractControlSettingsUiHandler extends UiHandler
|
|||
/**
|
||||
* Constructor for the AbstractSettingsUiHandler.
|
||||
*
|
||||
* @param scene - The BattleScene instance.
|
||||
* @param mode - The UI mode.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
|
|
|
@ -314,7 +314,7 @@ export default class AbstractSettingsUiHandler extends MessageUiHandler {
|
|||
activateSetting(setting: Setting): boolean {
|
||||
switch (setting.key) {
|
||||
case SettingKeys.Move_Touch_Controls:
|
||||
globalScene.inputController.moveTouchControlsHandler.enableConfigurationMode(this.getUi(), globalScene);
|
||||
globalScene.inputController.moveTouchControlsHandler.enableConfigurationMode(this.getUi());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import TouchControl from "#app/touch-controls";
|
||||
import UI from "#app/ui/ui";
|
||||
import { Scene } from "phaser";
|
||||
|
||||
export const TOUCH_CONTROL_POSITIONS_LANDSCAPE = "touchControlPositionsLandscape";
|
||||
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.
|
||||
* Also enables the toolbar for saving, resetting, and canceling the changes.
|
||||
* @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 overlay = new Phaser.GameObjects.Rectangle(globalScene, 0, 0, globalScene.game.canvas.width, globalScene.game.canvas.height, 0x000000, 0.5);
|
||||
overlay.setInteractive();
|
||||
|
@ -337,15 +335,14 @@ export default class MoveTouchControlsHandler {
|
|||
/**
|
||||
* Allows the user to configure the touch controls by dragging buttons around the screen.
|
||||
* @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) {
|
||||
return;
|
||||
}
|
||||
this.inConfigurationMode = true;
|
||||
this.touchControls.disable();
|
||||
this.createOverlay(ui, scene);
|
||||
this.createOverlay(ui);
|
||||
this.createToolbar();
|
||||
// Create event listeners with a delay to prevent the touchstart event from being triggered immediately.
|
||||
setTimeout(() => {
|
||||
|
|
|
@ -54,7 +54,6 @@ export class NavigationManager {
|
|||
|
||||
/**
|
||||
* Navigates modes based on given direction
|
||||
* @param scene The current BattleScene instance
|
||||
* @param direction LEFT or RIGHT
|
||||
*/
|
||||
public navigate(direction) {
|
||||
|
@ -98,7 +97,6 @@ export default class NavigationMenu extends Phaser.GameObjects.Container {
|
|||
|
||||
/**
|
||||
* Creates an instance of NavigationMenu.
|
||||
* @param scene The current BattleScene instance.
|
||||
* @param x The x position of the NavigationMenu.
|
||||
* @param y The y position of the NavigationMenu.
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,6 @@ export default class SettingsAudioUiHandler extends AbstractSettingsUiHandler {
|
|||
/**
|
||||
* Creates an instance of SettingsAudioUiHandler.
|
||||
*
|
||||
* @param scene - The BattleScene instance.
|
||||
* @param mode - The UI mode, optional.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
|
|
|
@ -7,7 +7,6 @@ export default class SettingsDisplayUiHandler extends AbstractSettingsUiHandler
|
|||
/**
|
||||
* Creates an instance of SettingsGamepadUiHandler.
|
||||
*
|
||||
* @param scene - The BattleScene instance.
|
||||
* @param mode - The UI mode, optional.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
|
|
|
@ -28,7 +28,6 @@ export default class SettingsGamepadUiHandler extends AbstractControlSettingsUiH
|
|||
/**
|
||||
* Creates an instance of SettingsGamepadUiHandler.
|
||||
*
|
||||
* @param scene - The BattleScene instance.
|
||||
* @param mode - The UI mode, optional.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
|
|
|
@ -26,7 +26,6 @@ export default class SettingsKeyboardUiHandler extends AbstractControlSettingsUi
|
|||
/**
|
||||
* Creates an instance of SettingsKeyboardUiHandler.
|
||||
*
|
||||
* @param scene - The BattleScene instance.
|
||||
* @param mode - The UI mode, optional.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
|
|
|
@ -6,7 +6,6 @@ export default class SettingsUiHandler extends AbstractSettingsUiHandler {
|
|||
/**
|
||||
* Creates an instance of SettingsGamepadUiHandler.
|
||||
*
|
||||
* @param scene - The BattleScene instance.
|
||||
* @param mode - The UI mode, optional.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
|
|
|
@ -1821,7 +1821,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
}
|
||||
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();
|
||||
|
||||
globalScene.gameData.saveSystem().then(success => {
|
||||
|
|
|
@ -12,8 +12,7 @@ export default abstract class UiHandler {
|
|||
public active: boolean = false;
|
||||
|
||||
/**
|
||||
* @param {BattleScene} scene The same scene as everything else.
|
||||
* @param {Mode} mode The mode of the UI element. These should be unique.
|
||||
* @param mode The mode of the UI element. These should be unique.
|
||||
*/
|
||||
constructor(mode: Mode | null = null) {
|
||||
this.mode = mode;
|
||||
|
|
15
src/ui/ui.ts
15
src/ui/ui.ts
|
@ -1,4 +1,3 @@
|
|||
import { default as BattleScene } from "#app/battle-scene";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import UiHandler from "./ui-handler";
|
||||
import BattleMessageUiHandler from "./battle-message-ui-handler";
|
||||
|
@ -269,12 +268,11 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
return false;
|
||||
}
|
||||
|
||||
const battleScene = globalScene as BattleScene;
|
||||
if ([ Mode.CONFIRM, Mode.COMMAND, Mode.FIGHT, Mode.MESSAGE ].includes(this.mode)) {
|
||||
battleScene?.processInfoButton(pressed);
|
||||
globalScene?.processInfoButton(pressed);
|
||||
return true;
|
||||
}
|
||||
battleScene?.processInfoButton(false);
|
||||
globalScene?.processInfoButton(false);
|
||||
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 {
|
||||
const battleScene = globalScene as BattleScene;
|
||||
// Get localized dialogue (if available)
|
||||
let hasi18n = false;
|
||||
let text = keyOrText;
|
||||
const genderIndex = battleScene.gameData.gender ?? PlayerGender.UNSET;
|
||||
const genderIndex = globalScene.gameData.gender ?? PlayerGender.UNSET;
|
||||
const genderStr = PlayerGender[genderIndex].toLowerCase();
|
||||
|
||||
if (i18next.exists(keyOrText) ) {
|
||||
|
@ -340,7 +337,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
}
|
||||
}
|
||||
let showMessageAndCallback = () => {
|
||||
hasi18n && battleScene.gameData.saveSeenDialogue(keyOrText);
|
||||
hasi18n && globalScene.gameData.saveSeenDialogue(keyOrText);
|
||||
callback();
|
||||
};
|
||||
if (text.indexOf("$") > -1) {
|
||||
|
@ -361,10 +358,8 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
}
|
||||
|
||||
shouldSkipDialogue(i18nKey: string): boolean {
|
||||
const battleScene = globalScene as BattleScene;
|
||||
|
||||
if (i18next.exists(i18nKey) ) {
|
||||
if (battleScene.skipSeenDialogues && battleScene.gameData.getSeenDialogues()[i18nKey] === true) {
|
||||
if (globalScene.skipSeenDialogues && globalScene.gameData.getSeenDialogues()[i18nKey] === true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue