From 13d1dd52b28d4fea52dd2980479c215f59f6fbc7 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Wed, 18 Sep 2024 03:41:35 -0700 Subject: [PATCH] Update tsdocs and imports --- src/data/challenge.ts | 593 +++++++++++++++++++++--------------------- 1 file changed, 295 insertions(+), 298 deletions(-) diff --git a/src/data/challenge.ts b/src/data/challenge.ts index ebe40db4b75..f42f0b654d3 100644 --- a/src/data/challenge.ts +++ b/src/data/challenge.ts @@ -11,7 +11,7 @@ import Trainer, { TrainerVariant } from "#app/field/trainer"; import { GameMode } from "#app/game-mode"; import { ModifierTypeOption } from "#app/modifier/modifier-type"; import { defaultStarterSpecies, DexAttrProps, GameData } from "#app/system/game-data"; -import * as Utils from "#app/utils"; +import { BooleanHolder, NumberHolder, randSeedItem } from "#app/utils"; import { Challenges } from "#enums/challenges"; import { Species } from "#enums/species"; import { TrainerType } from "#enums/trainer-type"; @@ -27,32 +27,32 @@ const DEFAULT_PARTY_MAX_COST = 10; export enum ChallengeType { /** * Challenges which modify what starters you can choose - * @see {@link Challenge.applyStarterChoice} + * @see {@linkcode Challenge.applyStarterChoice} */ STARTER_CHOICE, /** * Challenges which modify how many starter points you have - * @see {@link Challenge.applyStarterPoints} + * @see {@linkcode Challenge.applyStarterPoints} */ STARTER_POINTS, /** * Challenges which modify how many starter points you have - * @see {@link Challenge.applyStarterPointCost} + * @see {@linkcode Challenge.applyStarterPointCost} */ STARTER_COST, /** * Challenges which modify your starters in some way - * @see {@link Challenge.applyStarterModify} + * @see {@linkcode Challenge.applyStarterModify} */ STARTER_MODIFY, /** * Challenges which limit which pokemon you can have in battle. - * @see {@link Challenge.applyPokemonInBattle} + * @see {@linkcode Challenge.applyPokemonInBattle} */ POKEMON_IN_BATTLE, /** * Adds or modifies the fixed battles in a run - * @see {@link Challenge.applyFixedBattle} + * @see {@linkcode Challenge.applyFixedBattle} */ FIXED_BATTLES, /** @@ -128,19 +128,23 @@ export enum MoveSourceType { * A challenge object. Exists only to serve as a base class. */ export abstract class Challenge { - public id: Challenges; // The id of the challenge - - public value: integer; // The "strength" of the challenge, all challenges have a numerical value. - public maxValue: integer; // The maximum strength of the challenge. - public severity: integer; // The current severity of the challenge. Some challenges have multiple severities in addition to strength. - public maxSeverity: integer; // The maximum severity of the challenge. - + /** The id of the challenge */ + public id: Challenges; + /** The "strength" of the challenge. All challenges have a numerical value. */ + public value: number; + /** The maximum strength of the challenge. */ + public maxValue: number; + /** The current severity of the challenge. Some challenges have multiple severities in addition to strength. */ + public severity: number; + /** The maximum severity of the challenge. */ + public maxSeverity: number; + /** Unlock conditions of the challenge. */ public conditions: ChallengeCondition[]; /** - * @param id {@link Challenges} The enum value for the challenge + * @param id {@linkcode Challenges} The enum value for the challenge */ - constructor(id: Challenges, maxValue: integer = Number.MAX_SAFE_INTEGER) { + constructor(id: Challenges, maxValue: number = Number.MAX_SAFE_INTEGER) { this.id = id; this.value = 0; @@ -160,7 +164,7 @@ export abstract class Challenge { /** * Gets the localisation key for the challenge - * @returns {@link string} The i18n key for this challenge + * @returns The i18n key for this challenge */ geti18nKey(): string { return Challenges[this.id].split("_").map((f, i) => i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()).join(""); @@ -169,7 +173,7 @@ export abstract class Challenge { /** * Used for unlockable challenges to check if they're unlocked. * @param data {@link GameData} The save data. - * @returns {@link boolean} Whether this challenge is unlocked. + * @returns `true` if this challenge is unlocked. */ isUnlocked(data: GameData): boolean { return this.conditions.every(f => f(data)); @@ -178,7 +182,7 @@ export abstract class Challenge { /** * Adds an unlock condition to this challenge. * @param condition {@link ChallengeCondition} The condition to add. - * @returns {@link Challenge} This challenge + * @returns This {@linkcode Challenge} */ condition(condition: ChallengeCondition): Challenge { this.conditions.push(condition); @@ -187,7 +191,7 @@ export abstract class Challenge { } /** - * @returns {@link string} The localised name of this challenge. + * @returns The localised name of this challenge. */ getName(): string { return i18next.t(`challenges:${this.geti18nKey()}.name`); @@ -195,10 +199,10 @@ export abstract class Challenge { /** * Returns the textual representation of a challenge's current value. - * @param overrideValue {@link integer} The value to check for. If undefined, gets the current value. - * @returns {@link string} The localised name for the current value. + * @param overrideValue The value to check for. If `undefined`, gets the current value. + * @returns The localised name for the current value. */ - getValue(overrideValue?: integer): string { + getValue(overrideValue?: number): string { if (overrideValue === undefined) { overrideValue = this.value; } @@ -207,10 +211,10 @@ export abstract class Challenge { /** * Returns the description of a challenge's current value. - * @param overrideValue {@link integer} The value to check for. If undefined, gets the current value. - * @returns {@link string} The localised description for the current value. + * @param overrideValue The value to check for. If `undefined`, gets the current value. + * @returns The localised description for the current value. */ - getDescription(overrideValue?: integer): string { + getDescription(overrideValue?: number): string { if (overrideValue === undefined) { overrideValue = this.value; } @@ -219,7 +223,7 @@ export abstract class Challenge { /** * Increase the value of the challenge - * @returns {@link boolean} Returns true if the value changed + * @returns Returns `true` if the value changed */ increaseValue(): boolean { if (this.value < this.maxValue) { @@ -231,7 +235,7 @@ export abstract class Challenge { /** * Decrease the value of the challenge - * @returns {@link boolean} Returns true if the value changed + * @returns Returns `true` if the value changed */ decreaseValue(): boolean { if (this.value > 0) { @@ -242,7 +246,7 @@ export abstract class Challenge { } /** - * Whether to allow choosing this challenge's severity. + * @returns Whether to allow choosing this challenge's severity. */ hasSeverity(): boolean { return this.value !== 0 && this.maxSeverity > 0; @@ -250,7 +254,7 @@ export abstract class Challenge { /** * Decrease the severity of the challenge - * @returns {@link boolean} Returns true if the value changed + * @returns Returns `true` if the value changed */ decreaseSeverity(): boolean { if (this.severity > 0) { @@ -262,7 +266,7 @@ export abstract class Challenge { /** * Increase the severity of the challenge - * @returns {@link boolean} Returns true if the value changed + * @returns Returns `true` if the value changed */ increaseSeverity(): boolean { if (this.severity < this.maxSeverity) { @@ -274,210 +278,210 @@ export abstract class Challenge { /** * Gets the "difficulty" value of this challenge. - * @returns {@link integer} The difficulty value. + * @returns The difficulty value. */ - getDifficulty(): integer { + getDifficulty(): number { return this.value; } /** * Gets the minimum difficulty added by this challenge. - * @returns {@link integer} The difficulty value. + * @returns The minimum difficulty value. */ - getMinDifficulty(): integer { + getMinDifficulty(): number { return 0; } /** * Clones a challenge, either from another challenge or json. Chainable. * @param source The source challenge or json. - * @returns This challenge. + * @returns This {@linkcode Challenge}. */ static loadChallenge(source: Challenge | any): Challenge { throw new Error("Method not implemented! Use derived class"); } /** - * An apply function for STARTER_CHOICE challenges. Derived classes should alter this. - * @param pokemon {@link PokemonSpecies} The pokemon to check the validity of. - * @param valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed. - * @param dexAttr {@link DexAttrProps} The dex attributes of the pokemon. - * @param soft {@link boolean} If true, allow it if it could become a valid pokemon. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.STARTER_CHOICE} challenges. Derived classes should alter this. + * @param pokemon {@linkcode PokemonSpecies} The pokemon to check the validity of. + * @param valid A {@linkcode BooleanHolder}, the value gets set to false if the pokemon isn't allowed. + * @param dexAttr {@linkcode DexAttrProps} The dex attributes of the pokemon. + * @param soft If `true`, allow it if it could become a valid pokemon. + * @returns `true` if this function did anything. */ - applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false): boolean { + applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false): boolean { return false; } /** - * An apply function for STARTER_POINTS challenges. Derived classes should alter this. - * @param points {@link Utils.NumberHolder} The amount of points you have available. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.STARTER_POINTS} challenges. Derived classes should alter this. + * @param points {@linkcode NumberHolder} The amount of points you have available. + * @returns `true` if this function did anything. */ - applyStarterPoints(points: Utils.NumberHolder): boolean { + applyStarterPoints(points: NumberHolder): boolean { return false; } /** - * An apply function for STARTER_COST challenges. Derived classes should alter this. - * @param species {@link Species} The pokemon to change the cost of. - * @param cost {@link Utils.NumberHolder} The cost of the starter. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.STARTER_COST} challenges. Derived classes should alter this. + * @param species {@linkcode Species} The pokemon to change the cost of. + * @param cost {@link NumberHolder} The cost of the starter. + * @returns `true` if this function did anything. */ - applyStarterCost(species: Species, cost: Utils.NumberHolder): boolean { + applyStarterCost(species: Species, cost: NumberHolder): boolean { return false; } /** - * An apply function for STARTER_MODIFY challenges. Derived classes should alter this. - * @param pokemon {@link Pokemon} The starter pokemon to modify. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.STARTER_MODIFY} challenges. Derived classes should alter this. + * @param pokemon {@linkcode Pokemon} The starter pokemon to modify. + * @returns `true` if this function did anything. */ applyStarterModify(pokemon: Pokemon): boolean { return false; } /** - * An apply function for POKEMON_IN_BATTLE challenges. Derived classes should alter this. - * @param pokemon {@link Pokemon} The pokemon to check the validity of. - * @param valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.POKEMON_IN_BATTLE} challenges. Derived classes should alter this. + * @param pokemon {@linkcode Pokemon} The pokemon to check the validity of. + * @param valid {@link BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed. + * @returns `true` if this function did anything. */ - applyPokemonInBattle(pokemon: Pokemon, valid: Utils.BooleanHolder): boolean { + applyPokemonInBattle(pokemon: Pokemon, valid: BooleanHolder): boolean { return false; } /** - * An apply function for FIXED_BATTLE challenges. Derived classes should alter this. - * @param waveIndex {@link Number} The current wave index. - * @param battleConfig {@link FixedBattleConfig} The battle config to modify. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.FIXED_BATTLE} challenges. Derived classes should alter this. + * @param waveIndex The current wave index. + * @param battleConfig {@linkcode FixedBattleConfig} The battle config to modify. + * @returns `true` if this function did anything. */ - applyFixedBattle(waveIndex: Number, battleConfig: FixedBattleConfig): boolean { + applyFixedBattle(waveIndex: number, battleConfig: FixedBattleConfig): boolean { return false; } /** - * An apply function for TYPE_EFFECTIVENESS challenges. Derived classes should alter this. - * @param effectiveness {@linkcode Utils.NumberHolder} The current effectiveness of the move. - * @returns Whether this function did anything. + * An apply function for {@linkcode ChallengeType.TYPE_EFFECTIVENESS} challenges. Derived classes should alter this. + * @param effectiveness {@linkcode NumberHolder} The current effectiveness of the move. + * @returns `true` if this function did anything. */ - applyTypeEffectiveness(effectiveness: Utils.NumberHolder): boolean { + applyTypeEffectiveness(effectiveness: NumberHolder): boolean { return false; } /** - * An apply function for AI_LEVEL challenges. Derived classes should alter this. - * @param level {@link Utils.IntegerHolder} The generated level. - * @param levelCap {@link Number} The current level cap. - * @param isTrainer {@link Boolean} Whether this is a trainer pokemon. - * @param isBoss {@link Boolean} Whether this is a non-trainer boss pokemon. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.AI_LEVEL} challenges. Derived classes should alter this. + * @param level {@linkcode NumberHolder} The generated level. + * @param levelCap The current level cap. + * @param isTrainer Whether this is a trainer pokemon. + * @param isBoss Whether this is a non-trainer boss pokemon. + * @returns `true` if this function did anything. */ - applyLevelChange(level: Utils.IntegerHolder, levelCap: number, isTrainer: boolean, isBoss: boolean): boolean { + applyLevelChange(level: NumberHolder, levelCap: number, isTrainer: boolean, isBoss: boolean): boolean { return false; } /** - * An apply function for AI_MOVE_SLOTS challenges. Derived classes should alter this. - * @param pokemon {@link Pokemon} The pokemon that is being considered. - * @param moveSlots {@link Utils.IntegerHolder} The amount of move slots. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.AI_MOVE_SLOTS} challenges. Derived classes should alter this. + * @param pokemon {@linkcode Pokemon} The pokemon that is being considered. + * @param moveSlots {@linkcode NumberHolder} The amount of move slots. + * @returns `true` if this function did anything. */ - applyMoveSlot(pokemon: Pokemon, moveSlots: Utils.IntegerHolder): boolean { + applyMoveSlot(pokemon: Pokemon, moveSlots: NumberHolder): boolean { return false; } /** - * An apply function for PASSIVE_ACCESS challenges. Derived classes should alter this. - * @param pokemon {@link Pokemon} The pokemon to change. - * @param hasPassive {@link Utils.BooleanHolder} Whether it should have its passive. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.PASSIVE_ACCESS} challenges. Derived classes should alter this. + * @param pokemon {@linkcode Pokemon} The pokemon to change. + * @param hasPassive Whether it should have its passive. + * @returns `true` if this function did anything. */ - applyPassiveAccess(pokemon: Pokemon, hasPassive: Utils.BooleanHolder): boolean { + applyPassiveAccess(pokemon: Pokemon, hasPassive: BooleanHolder): boolean { return false; } /** - * An apply function for GAME_MODE_MODIFY challenges. Derived classes should alter this. - * @param gameMode {@link GameMode} The current game mode. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.GAME_MODE_MODIFY} challenges. Derived classes should alter this. + * @param gameMode {@linkcode GameMode} The current game mode. + * @returns `true` if this function did anything. */ applyGameModeModify(gameMode: GameMode): boolean { return false; } /** - * An apply function for MOVE_ACCESS. Derived classes should alter this. - * @param pokemon {@link Pokemon} What pokemon would learn the move. - * @param moveSource {@link MoveSourceType} What source the pokemon would get the move from. - * @param move {@link Moves} The move in question. - * @param level {@link Utils.IntegerHolder} The level threshold for access. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.MOVE_ACCESS} challenges. Derived classes should alter this. + * @param pokemon {@linkcode Pokemon} What pokemon would learn the move. + * @param moveSource {@linkcode MoveSourceType} What source the pokemon would get the move from. + * @param move {@linkcode Moves} The move in question. + * @param level {@linkcode NumberHolder} The level threshold for access. + * @returns `true` if this function did anything. */ - applyMoveAccessLevel(pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, level: Utils.IntegerHolder): boolean { + applyMoveAccessLevel(pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, level: NumberHolder): boolean { return false; } /** - * An apply function for MOVE_WEIGHT. Derived classes should alter this. - * @param pokemon {@link Pokemon} What pokemon would learn the move. - * @param moveSource {@link MoveSourceType} What source the pokemon would get the move from. - * @param move {@link Moves} The move in question. - * @param weight {@link Utils.IntegerHolder} The base weight of the move - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.MOVE_WEIGHT} challenges. Derived classes should alter this. + * @param pokemon {@linkcode Pokemon} What pokemon would learn the move. + * @param moveSource {@linkcode MoveSourceType} What source the pokemon would get the move from. + * @param move {@linkcode Moves} The move in question. + * @param weight {@linkcode NumberHolder} The base weight of the move + * @returns `true` if this function did anything. */ - applyMoveWeight(pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, level: Utils.IntegerHolder): boolean { + applyMoveWeight(pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, level: NumberHolder): boolean { return false; } /** - * An apply function for NO_HEAL_PHASE challenges. Derived classes should alter this. - * @param applyHealPhase {@link Utils.BooleanHolder} Whether it should apply the heal phase. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.NO_HEAL_PHASE} challenges. Derived classes should alter this. + * @param applyHealPhase {@link BooleanHolder} Whether it should apply the heal phase. + * @returns `true` if this function did anything. */ - applyNoHealPhase(applyHealPhase: Utils.BooleanHolder): boolean { + applyNoHealPhase(applyHealPhase: BooleanHolder): boolean { return false; } /** - * An apply function for SHOP_ITEM_BLACKLIST challenges. Derived classes should alter this. - * @param shopItem {@link ModifierTypeOption} The shop item. - * @param isValid {@link Utils.BooleanHolder} Whether this item is valid for this challenge. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.SHOP_ITEM_BLACKLIST} challenges. Derived classes should alter this. + * @param shopItem {@linkcode ModifierTypeOption} The shop item. + * @param isValid {@linkcode BooleanHolder} Whether this item is valid for this challenge. + * @returns `true` if this function did anything. */ - applyShopItemBlacklist(shopItem: ModifierTypeOption, isValid: Utils.BooleanHolder): boolean { + applyShopItemBlacklist(shopItem: ModifierTypeOption, isValid: BooleanHolder): boolean { return false; } /** - * An apply function for RANDOM_ITEM_BLACKLIST challenges. Derived classes should alter this. - * @param randomItem {@link ModifierTypeOption} The random item. - * @param isValid {@link Utils.BooleanHolder} Whether this item is valid for this challenge. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.RANDOM_ITEM_BLACKLIST} challenges. Derived classes should alter this. + * @param randomItem {@linkcode ModifierTypeOption} The random item. + * @param isValid {@linkcode BooleanHolder} Whether this item is valid for this challenge. + * @returns `true` if this function did anything. */ - applyRandomItemBlacklist(randomItem: ModifierTypeOption, isValid: Utils.BooleanHolder): boolean { + applyRandomItemBlacklist(randomItem: ModifierTypeOption, isValid: BooleanHolder): boolean { return false; } /** - * An apply function for ADD_POKEMON_TO_PARTY challenges. Derived classes should alter this. - * @param pokemon {@link EnemyPokemon} The pokemon cought. - * @param waveIndex {@link number} Current wave index. - * @param canBeAddToParty {@link Utils.BooleanHolder} Whether this pokemon can be added to the party. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.ADD_POKEMON_TO_PARTY} challenges. Derived classes should alter this. + * @param pokemon {@linkcode EnemyPokemon} The pokemon cought. + * @param waveIndex Current wave index. + * @param canAddToParty {@linkcode BooleanHolder} Whether this pokemon can be added to the party. + * @returns `true` if this function did anything. */ - applyAddPokemonToParty(pokemon: EnemyPokemon, waveIndex: number, canBeAddToParty: Utils.BooleanHolder): boolean { + applyAddPokemonToParty(pokemon: EnemyPokemon, waveIndex: number, canAddToParty: BooleanHolder): boolean { return false; } /** - * An apply function for MOVE_BLACKLIST challenges. Derived classes should alter this. - * @param move {@link PokemonMove} The move thats tryed to be used. - * @param moveCanBeUsed {@link Utils.BooleanHolder} Whether this move can be used. - * @returns {@link boolean} Whether this function did anything. + * An apply function for {@linkcode ChallengeType.MOVE_BLACKLIST} challenges. Derived classes should alter this. + * @param move {@linkcode PokemonMove} The move being attempted. + * @param moveCanBeUsed {@linkcode BooleanHolder} Whether this move can be used. + * @returns `true` if this function did anything. */ - applyMoveBlacklist(move: PokemonMove, moveCanBeUsed: Utils.BooleanHolder): boolean { + applyMoveBlacklist(move: PokemonMove, moveCanBeUsed: BooleanHolder): boolean { return false; } } @@ -492,7 +496,7 @@ export class SingleGenerationChallenge extends Challenge { super(Challenges.SINGLE_GENERATION, 9); } - applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false): boolean { + override applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false): boolean { const generations = [pokemon.generation]; if (soft) { const speciesToCheck = [pokemon.speciesId]; @@ -514,7 +518,7 @@ export class SingleGenerationChallenge extends Challenge { return false; } - applyPokemonInBattle(pokemon: Pokemon, valid: Utils.BooleanHolder): boolean { + override applyPokemonInBattle(pokemon: Pokemon, valid: BooleanHolder): boolean { const baseGeneration = pokemon.species.speciesId === Species.VICTINI ? 5 : getPokemonSpecies(pokemon.species.speciesId).generation; const fusionGeneration = pokemon.isFusion() ? pokemon.fusionSpecies?.speciesId === Species.VICTINI ? 5 : getPokemonSpecies(pokemon.fusionSpecies!.speciesId).generation : 0; // TODO: is the bang on fusionSpecies correct? if (pokemon.isPlayer() && (baseGeneration !== this.value || (pokemon.isFusion() && fusionGeneration !== this.value))) { @@ -524,23 +528,23 @@ export class SingleGenerationChallenge extends Challenge { return false; } - applyFixedBattle(waveIndex: Number, battleConfig: FixedBattleConfig): boolean { + override applyFixedBattle(waveIndex: Number, battleConfig: FixedBattleConfig): boolean { let trainerTypes: TrainerType[] = []; switch (waveIndex) { case 182: - trainerTypes = [ TrainerType.LORELEI, TrainerType.WILL, TrainerType.SIDNEY, TrainerType.AARON, TrainerType.SHAUNTAL, TrainerType.MALVA, Utils.randSeedItem([ TrainerType.HALA, TrainerType.MOLAYNE ]), TrainerType.MARNIE_ELITE, TrainerType.RIKA ]; + trainerTypes = [ TrainerType.LORELEI, TrainerType.WILL, TrainerType.SIDNEY, TrainerType.AARON, TrainerType.SHAUNTAL, TrainerType.MALVA, randSeedItem([ TrainerType.HALA, TrainerType.MOLAYNE ]), TrainerType.MARNIE_ELITE, TrainerType.RIKA ]; break; case 184: trainerTypes = [ TrainerType.BRUNO, TrainerType.KOGA, TrainerType.PHOEBE, TrainerType.BERTHA, TrainerType.MARSHAL, TrainerType.SIEBOLD, TrainerType.OLIVIA, TrainerType.NESSA_ELITE, TrainerType.POPPY ]; break; case 186: - trainerTypes = [ TrainerType.AGATHA, TrainerType.BRUNO, TrainerType.GLACIA, TrainerType.FLINT, TrainerType.GRIMSLEY, TrainerType.WIKSTROM, TrainerType.ACEROLA, Utils.randSeedItem([TrainerType.BEA_ELITE, TrainerType.ALLISTER_ELITE]), TrainerType.LARRY_ELITE ]; + trainerTypes = [ TrainerType.AGATHA, TrainerType.BRUNO, TrainerType.GLACIA, TrainerType.FLINT, TrainerType.GRIMSLEY, TrainerType.WIKSTROM, TrainerType.ACEROLA, randSeedItem([TrainerType.BEA_ELITE, TrainerType.ALLISTER_ELITE]), TrainerType.LARRY_ELITE ]; break; case 188: trainerTypes = [ TrainerType.LANCE, TrainerType.KAREN, TrainerType.DRAKE, TrainerType.LUCIAN, TrainerType.CAITLIN, TrainerType.DRASNA, TrainerType.KAHILI, TrainerType.RAIHAN_ELITE, TrainerType.HASSEL ]; break; case 190: - trainerTypes = [ TrainerType.BLUE, Utils.randSeedItem([ TrainerType.RED, TrainerType.LANCE_CHAMPION ]), Utils.randSeedItem([ TrainerType.STEVEN, TrainerType.WALLACE ]), TrainerType.CYNTHIA, Utils.randSeedItem([ TrainerType.ALDER, TrainerType.IRIS ]), TrainerType.DIANTHA, TrainerType.HAU, TrainerType.LEON, Utils.randSeedItem([ TrainerType.GEETA, TrainerType.NEMONA ]) ]; + trainerTypes = [ TrainerType.BLUE, randSeedItem([ TrainerType.RED, TrainerType.LANCE_CHAMPION ]), randSeedItem([ TrainerType.STEVEN, TrainerType.WALLACE ]), TrainerType.CYNTHIA, randSeedItem([ TrainerType.ALDER, TrainerType.IRIS ]), TrainerType.DIANTHA, TrainerType.HAU, TrainerType.LEON, randSeedItem([ TrainerType.GEETA, TrainerType.NEMONA ]) ]; break; } if (trainerTypes.length === 0) { @@ -551,19 +555,16 @@ export class SingleGenerationChallenge extends Challenge { } } - /** - * @overrides - */ - getDifficulty(): number { + override getDifficulty(): number { return this.value > 0 ? 1 : 0; } /** * Returns the textual representation of a challenge's current value. - * @param {value} overrideValue The value to check for. If undefined, gets the current value. - * @returns {string} The localised name for the current value. + * @param overrideValue The value to check for. If `undefined`, gets the current value. + * @returns The localised name for the current value. */ - getValue(overrideValue?: integer): string { + override getValue(overrideValue?: number): string { if (overrideValue === undefined) { overrideValue = this.value; } @@ -575,10 +576,10 @@ export class SingleGenerationChallenge extends Challenge { /** * Returns the description of a challenge's current value. - * @param {value} overrideValue The value to check for. If undefined, gets the current value. - * @returns {string} The localised description for the current value. + * @param overrideValue The value to check for. If `undefined`, gets the current value. + * @returns The localised description for the current value. */ - getDescription(overrideValue?: integer): string { + override getDescription(overrideValue?: number): string { if (overrideValue === undefined) { overrideValue = this.value; } @@ -589,7 +590,7 @@ export class SingleGenerationChallenge extends Challenge { } - static loadChallenge(source: SingleGenerationChallenge | any): SingleGenerationChallenge { + static override loadChallenge(source: SingleGenerationChallenge | any): SingleGenerationChallenge { const newChallenge = new SingleGenerationChallenge(); newChallenge.value = source.value; newChallenge.severity = source.severity; @@ -619,7 +620,7 @@ export class SingleTypeChallenge extends Challenge { super(Challenges.SINGLE_TYPE, 18); } - applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false): boolean { + override applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false): boolean { const speciesForm = getPokemonSpeciesForm(pokemon.speciesId, dexAttr.formIndex); const types = [speciesForm.type1, speciesForm.type2]; if (soft) { @@ -650,7 +651,7 @@ export class SingleTypeChallenge extends Challenge { return false; } - applyPokemonInBattle(pokemon: Pokemon, valid: Utils.BooleanHolder): boolean { + override applyPokemonInBattle(pokemon: Pokemon, valid: BooleanHolder): boolean { if (pokemon.isPlayer() && !pokemon.isOfType(this.value - 1, false, false, true) && !SingleTypeChallenge.TYPE_OVERRIDES.some(o => o.type === (this.value - 1) && (pokemon.isFusion() && o.fusion ? pokemon.fusionSpecies! : pokemon.species).speciesId === o.species)) { // TODO: is the bang on fusionSpecies correct? valid.value = false; @@ -659,19 +660,16 @@ export class SingleTypeChallenge extends Challenge { return false; } - /** - * @overrides - */ - getDifficulty(): number { + override getDifficulty(): number { return this.value > 0 ? 1 : 0; } /** * Returns the textual representation of a challenge's current value. - * @param {value} overrideValue The value to check for. If undefined, gets the current value. - * @returns {string} The localised name for the current value. + * @param overrideValue The value to check for. If `undefined`, gets the current value. + * @returns The localised name for the current value. */ - getValue(overrideValue?: integer): string { + override getValue(overrideValue?: number): string { if (overrideValue === undefined) { overrideValue = this.value; } @@ -680,10 +678,10 @@ export class SingleTypeChallenge extends Challenge { /** * Returns the description of a challenge's current value. - * @param {value} overrideValue The value to check for. If undefined, gets the current value. - * @returns {string} The localised description for the current value. + * @param overrideValue The value to check for. If `undefined`, gets the current value. + * @returns The localised description for the current value. */ - getDescription(overrideValue?: integer): string { + override getDescription(overrideValue?: number): string { if (overrideValue === undefined) { overrideValue = this.value; } @@ -694,7 +692,7 @@ export class SingleTypeChallenge extends Challenge { return this.value === 0 ? defaultDesc : typeDesc; } - static loadChallenge(source: SingleTypeChallenge | any): SingleTypeChallenge { + static override loadChallenge(source: SingleTypeChallenge | any): SingleTypeChallenge { const newChallenge = new SingleTypeChallenge(); newChallenge.value = source.value; newChallenge.severity = source.severity; @@ -710,7 +708,7 @@ export class FreshStartChallenge extends Challenge { super(Challenges.FRESH_START, 1); } - applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder): boolean { + override applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder): boolean { if (!defaultStarterSpecies.includes(pokemon.speciesId)) { valid.value = false; return true; @@ -718,7 +716,7 @@ export class FreshStartChallenge extends Challenge { return false; } - applyStarterCost(species: Species, cost: Utils.NumberHolder): boolean { + override applyStarterCost(species: Species, cost: NumberHolder): boolean { if (defaultStarterSpecies.includes(species)) { cost.value = speciesStarters[species]; return true; @@ -726,7 +724,7 @@ export class FreshStartChallenge extends Challenge { return false; } - applyStarterModify(pokemon: Pokemon): boolean { + override applyStarterModify(pokemon: Pokemon): boolean { pokemon.abilityIndex = 0; // Always base ability, not hidden ability pokemon.passive = false; // Passive isn't unlocked pokemon.nature = Nature.HARDY; // Neutral nature @@ -743,7 +741,7 @@ export class FreshStartChallenge extends Challenge { return 0; } - static loadChallenge(source: FreshStartChallenge | any): FreshStartChallenge { + static override loadChallenge(source: FreshStartChallenge | any): FreshStartChallenge { const newChallenge = new FreshStartChallenge(); newChallenge.value = source.value; newChallenge.severity = source.severity; @@ -759,7 +757,7 @@ export class InverseBattleChallenge extends Challenge { super(Challenges.INVERSE_BATTLE, 1); } - static loadChallenge(source: InverseBattleChallenge | any): InverseBattleChallenge { + static override loadChallenge(source: InverseBattleChallenge | any): InverseBattleChallenge { const newChallenge = new InverseBattleChallenge(); newChallenge.value = source.value; newChallenge.severity = source.severity; @@ -770,7 +768,7 @@ export class InverseBattleChallenge extends Challenge { return 0; } - applyTypeEffectiveness(effectiveness: Utils.NumberHolder): boolean { + override applyTypeEffectiveness(effectiveness: NumberHolder): boolean { if (effectiveness.value < 1) { effectiveness.value = 2; return true; @@ -791,17 +789,14 @@ export class LowerStarterMaxCostChallenge extends Challenge { super(Challenges.LOWER_MAX_STARTER_COST, 9); } - /** - * @override - */ - getValue(overrideValue?: integer): string { + override getValue(overrideValue?: number): string { if (overrideValue === undefined) { overrideValue = this.value; } return (DEFAULT_PARTY_MAX_COST - overrideValue).toString(); } - applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder): boolean { + override applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder): boolean { if (speciesStarters[pokemon.speciesId] > DEFAULT_PARTY_MAX_COST - this.value) { valid.value = false; return true; @@ -809,7 +804,7 @@ export class LowerStarterMaxCostChallenge extends Challenge { return false; } - static loadChallenge(source: LowerStarterMaxCostChallenge | any): LowerStarterMaxCostChallenge { + static override loadChallenge(source: LowerStarterMaxCostChallenge | any): LowerStarterMaxCostChallenge { const newChallenge = new LowerStarterMaxCostChallenge(); newChallenge.value = source.value; newChallenge.severity = source.severity; @@ -825,22 +820,19 @@ export class LowerStarterPointsChallenge extends Challenge { super(Challenges.LOWER_STARTER_POINTS, 9); } - /** - * @override - */ - getValue(overrideValue?: integer): string { + override getValue(overrideValue?: number): string { if (overrideValue === undefined) { overrideValue = this.value; } return (DEFAULT_PARTY_MAX_COST - overrideValue).toString(); } - applyStarterPoints(points: Utils.NumberHolder): boolean { + override applyStarterPoints(points: NumberHolder): boolean { points.value -= this.value; return true; } - static loadChallenge(source: LowerStarterPointsChallenge | any): LowerStarterPointsChallenge { + static override loadChallenge(source: LowerStarterPointsChallenge | any): LowerStarterPointsChallenge { const newChallenge = new LowerStarterPointsChallenge(); newChallenge.value = source.value; newChallenge.severity = source.severity; @@ -848,12 +840,13 @@ export class LowerStarterPointsChallenge extends Challenge { } } +/** Challenge that removes the {@linkcode PartyHealPhase} that occurs after every 10 waves */ export class NoAutomaticHealChallenge extends Challenge { constructor() { super(Challenges.NO_AUTO_HEAL, 1); } - override applyNoHealPhase(applyHealPhase: Utils.BooleanHolder): boolean { + override applyNoHealPhase(applyHealPhase: BooleanHolder): boolean { if (this.value === 1) { return false; } @@ -873,26 +866,27 @@ export class NoAutomaticHealChallenge extends Challenge { } } +/** Challenge that removes the ability to revive fallen pokemon */ export class HardcoreChallenge extends Challenge { constructor() { super(Challenges.HARDCORE, 1); } - override applyRandomItemBlacklist(randomItem: ModifierTypeOption, isValid: Utils.BooleanHolder): boolean { + override applyRandomItemBlacklist(randomItem: ModifierTypeOption, isValid: BooleanHolder): boolean { const randomItemBlackList = ["modifierType:ModifierType.REVIVE", "modifierType:ModifierType.MAX_REVIVE", "modifierType:ModifierType.SACRED_ASH", "modifierType:ModifierType.REVIVER_SEED"]; isValid.value = !randomItemBlackList.includes(randomItem.type.localeKey); return true; } - override applyShopItemBlacklist(shopItem: ModifierTypeOption, isValid: Utils.BooleanHolder): boolean { + override applyShopItemBlacklist(shopItem: ModifierTypeOption, isValid: BooleanHolder): boolean { const shopItemBlackList = ["modifierType:ModifierType.REVIVE", "modifierType:ModifierType.MAX_REVIVE", "modifierType:ModifierType.SACRED_ASH", "modifierType:ModifierType.REVIVER_SEED"]; isValid.value = !shopItemBlackList.includes(shopItem.type.localeKey); return true; } - override applyMoveBlacklist(move: PokemonMove, moveCanBeUsed: Utils.BooleanHolder): boolean { + override applyMoveBlacklist(move: PokemonMove, moveCanBeUsed: BooleanHolder): boolean { const moveBlacklist = [Moves.REVIVAL_BLESSING]; moveCanBeUsed.value = !moveBlacklist.includes(move.moveId); return true; @@ -910,12 +904,13 @@ export class HardcoreChallenge extends Challenge { } } -export class NoLegendsChallenge extends Challenge { +/** Challenge that prevents choosing legendary, sub-legendary or mythical pokemon as starters */ +export class NoStarterLegendsChallenge extends Challenge { constructor() { super(Challenges.NO_LEGENDS, 1); } - override applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft?: boolean): boolean { + override applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder, dexAttr: DexAttrProps, soft?: boolean): boolean { if (this.value === 1) { return false; } @@ -927,21 +922,23 @@ export class NoLegendsChallenge extends Challenge { return this.value > 0 ? 1 : 0; } - static override loadChallenge(source: NoLegendsChallenge | any): NoLegendsChallenge { - const newChallenge = new NoLegendsChallenge(); + static override loadChallenge(source: NoStarterLegendsChallenge | any): NoStarterLegendsChallenge { + const newChallenge = new NoStarterLegendsChallenge(); newChallenge.value = source.value; newChallenge.severity = source.severity; return newChallenge; } } +// TODO: Check for ME compatibility +/** Challenge that only allows the first pokemon of every 10 waves to be caught */ export class LimitedCatchChallenge extends Challenge { constructor() { super(Challenges.LIMITED_CATCH, 1); } - override applyAddPokemonToParty(pokemon: EnemyPokemon, waveIndex: number, canBeAddToParty: Utils.BooleanHolder): boolean { - canBeAddToParty.value = waveIndex % 10 === 1; + override applyAddPokemonToParty(pokemon: EnemyPokemon, waveIndex: number, canAddToParty: BooleanHolder): boolean { + canAddToParty.value = waveIndex % 10 === 1; return true; } @@ -949,7 +946,7 @@ export class LimitedCatchChallenge extends Challenge { return this.value > 0 ? 1 : 0; } - static loadChallenge(source: LimitedCatchChallenge | any): LimitedCatchChallenge { + static override loadChallenge(source: LimitedCatchChallenge | any): LimitedCatchChallenge { const newChallenge = new LimitedCatchChallenge(); newChallenge.value = source.value; newChallenge.severity = source.severity; @@ -959,169 +956,169 @@ export class LimitedCatchChallenge extends Challenge { /** * Apply all challenges that modify starter choice. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.STARTER_CHOICE - * @param pokemon {@link PokemonSpecies} The pokemon to check the validity of. - * @param valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed. - * @param dexAttr {@link DexAttrProps} The dex attributes of the pokemon. - * @param soft {@link boolean} If true, allow it if it could become a valid pokemon. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.STARTER_CHOICE} + * @param pokemon The {@linkcode PokemonSpecies} to check the validity of. + * @param valid {@link BooleanHolder} `false` if the pokemon isn't allowed. + * @param dexAttr {@linkcode DexAttrProps} The dex attributes of the pokemon. + * @param soft If `true`, allow it if it could become a valid pokemon. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.STARTER_CHOICE, pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.STARTER_CHOICE, pokemon: PokemonSpecies, valid: BooleanHolder, dexAttr: DexAttrProps, soft: boolean): boolean; /** * Apply all challenges that modify available total starter points. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.STARTER_POINTS - * @param points {@link Utils.NumberHolder} The amount of points you have available. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.STARTER_POINTS} + * @param points {@link NumberHolder} The amount of points you have available. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.STARTER_POINTS, points: Utils.NumberHolder): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.STARTER_POINTS, points: NumberHolder): boolean; /** * Apply all challenges that modify the cost of a starter. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.STARTER_COST - * @param species {@link Species} The pokemon to change the cost of. - * @param points {@link Utils.NumberHolder} The cost of the pokemon. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.STARTER_COST} + * @param species The pokemon {@linkcode Species} to change the cost of. + * @param points {@linkcode NumberHolder} The cost of the pokemon. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.STARTER_COST, species: Species, cost: Utils.NumberHolder): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.STARTER_COST, species: Species, cost: NumberHolder): boolean; /** * Apply all challenges that modify a starter after selection. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.STARTER_MODIFY - * @param pokemon {@link Pokemon} The starter pokemon to modify. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.STARTER_MODIFY} + * @param pokemon The starter {@linkcode Pokemon} to modify. + * @returns `true` if any challenge was successfully applied. */ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.STARTER_MODIFY, pokemon: Pokemon): boolean; /** * Apply all challenges that what pokemon you can have in battle. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.POKEMON_IN_BATTLE - * @param pokemon {@link Pokemon} The pokemon to check the validity of. - * @param valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.POKEMON_IN_BATTLE} + * @param pokemon The {@linkcode Pokemon} Tcheck the validity of. + * @param valid {@link BooleanHolder} `false` if the pokemon isn't allowed. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.POKEMON_IN_BATTLE, pokemon: Pokemon, valid: Utils.BooleanHolder): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.POKEMON_IN_BATTLE, pokemon: Pokemon, valid: BooleanHolder): boolean; /** * Apply all challenges that modify what fixed battles there are. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.FIXED_BATTLES - * @param waveIndex {@link Number} The current wave index. - * @param battleConfig {@link FixedBattleConfig} The battle config to modify. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.FIXED_BATTLES} + * @param waveIndex The current wave index. + * @param battleConfig The {@link FixedBattleConfig} to modify. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.FIXED_BATTLES, waveIndex: Number, battleConfig: FixedBattleConfig): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.FIXED_BATTLES, waveIndex: number, battleConfig: FixedBattleConfig): boolean; /** * Apply all challenges that modify type effectiveness. - * @param gameMode {@linkcode GameMode} The current gameMode - * @param challengeType {@linkcode ChallengeType} ChallengeType.TYPE_EFFECTIVENESS - * @param effectiveness {@linkcode Utils.NumberHolder} The current effectiveness of the move. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.TYPE_EFFECTIVENESS} + * @param effectiveness {@linkcode NumberHolder} The current effectiveness of the move. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.TYPE_EFFECTIVENESS, effectiveness: Utils.NumberHolder): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.TYPE_EFFECTIVENESS, effectiveness: NumberHolder): boolean; /** * Apply all challenges that modify what level AI are. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.AI_LEVEL - * @param level {@link Utils.IntegerHolder} The generated level of the pokemon. - * @param levelCap {@link Number} The maximum level cap for the current wave. - * @param isTrainer {@link Boolean} Whether this is a trainer pokemon. - * @param isBoss {@link Boolean} Whether this is a non-trainer boss pokemon. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.AI_LEVEL} + * @param level {@link NumberHolder} The generated level of the pokemon. + * @param levelCap The maximum level cap for the current wave. + * @param isTrainer Whether this is a trainer pokemon. + * @param isBoss Whether this is a non-trainer boss pokemon. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.AI_LEVEL, level: Utils.IntegerHolder, levelCap: number, isTrainer: boolean, isBoss: boolean): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.AI_LEVEL, level: NumberHolder, levelCap: number, isTrainer: boolean, isBoss: boolean): boolean; /** * Apply all challenges that modify how many move slots the AI has. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.AI_MOVE_SLOTS - * @param pokemon {@link Pokemon} The pokemon being considered. - * @param moveSlots {@link Utils.IntegerHolder} The amount of move slots. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.AI_MOVE_SLOTS} + * @param pokemon The {@linkcode Pokemon} being considered. + * @param moveSlots {@linkcode NumberHolder} The amount of move slots. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.AI_MOVE_SLOTS, pokemon: Pokemon, moveSlots: Utils.IntegerHolder): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.AI_MOVE_SLOTS, pokemon: Pokemon, moveSlots: NumberHolder): boolean; /** * Apply all challenges that modify whether a pokemon has its passive. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.PASSIVE_ACCESS - * @param pokemon {@link Pokemon} The pokemon to modify. - * @param hasPassive {@link Utils.BooleanHolder} Whether it has its passive. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.PASSIVE_ACCESS} + * @param pokemon The {@linkcode Pokemon} to modify. + * @param hasPassive {@linkcode BooleanHolder} Whether it has its passive. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.PASSIVE_ACCESS, pokemon: Pokemon, hasPassive: Utils.BooleanHolder): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.PASSIVE_ACCESS, pokemon: Pokemon, hasPassive: BooleanHolder): boolean; /** * Apply all challenges that modify the game modes settings. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.GAME_MODE_MODIFY - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.GAME_MODE_MODIFY} + * @returns `true` if any challenge was successfully applied. */ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.GAME_MODE_MODIFY): boolean; /** * Apply all challenges that modify what level a pokemon can access a move. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.MOVE_ACCESS - * @param pokemon {@link Pokemon} What pokemon would learn the move. - * @param moveSource {@link MoveSourceType} What source the pokemon would get the move from. - * @param move {@link Moves} The move in question. - * @param level {@link Utils.IntegerHolder} The level threshold for access. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.MOVE_ACCESS} + * @param pokemon What {@linkcode Pokemon} would learn the move. + * @param moveSource {@linkcode MoveSourceType} What source the pokemon would get the move from. + * @param move {@linkcode Moves} The move in question. + * @param level {@linkcode NumberHolder} The level threshold for access. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.MOVE_ACCESS, pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, level: Utils.IntegerHolder): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.MOVE_ACCESS, pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, level: NumberHolder): boolean; /** * Apply all challenges that modify what weight a pokemon gives to move generation - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.MOVE_WEIGHT - * @param pokemon {@link Pokemon} What pokemon would learn the move. - * @param moveSource {@link MoveSourceType} What source the pokemon would get the move from. - * @param move {@link Moves} The move in question. - * @param weight {@link Utils.IntegerHolder} The weight of the move. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.MOVE_WEIGHT} + * @param pokemon What {@linkcode Pokemon} would learn the move. + * @param moveSource {@linkcode MoveSourceType} What source the pokemon would get the move from. + * @param move {@linkcode Moves} The move in question. + * @param weight {@linkcode NumberHolder} The weight of the move. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.MOVE_WEIGHT, pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, weight: Utils.IntegerHolder): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.MOVE_WEIGHT, pokemon: Pokemon, moveSource: MoveSourceType, move: Moves, weight: NumberHolder): boolean; /** * Apply all challenges that modify if the heal phase should be applied. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.NO_HEAL_PHASE - * @param applyHealPhase {@link Utils.BooleanHolder} Whether it should apply the heal phase. Default is true. Set to false if heal phase should not be applied. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.NO_HEAL_PHASE} + * @param applyHealPhase {@linkcode BooleanHolder} Whether it should apply the heal phase. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.NO_HEAL_PHASE, applyHealPhase: Utils.BooleanHolder): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.NO_HEAL_PHASE, applyHealPhase: BooleanHolder): boolean; /** * Apply all challenges that modify if this shop item can be bought. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.SHOP_ITEM_BLACKLIST - * @param shopItem {@link ModifierTypeOption} The shop item. - * @param isValid {@link Utils.BooleanHolder} Whether this item is valid for this challenge. Default is true. Set to false if item should not be in the shop. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.SHOP_ITEM_BLACKLIST} + * @param shopItem {@linkcode ModifierTypeOption} The shop item. + * @param isValid {@linkcode BooleanHolder} Whether this item is valid for this challenge. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.SHOP_ITEM_BLACKLIST, shopItem: ModifierTypeOption, isValid: Utils.BooleanHolder): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.SHOP_ITEM_BLACKLIST, shopItem: ModifierTypeOption, isValid: BooleanHolder): boolean; /** * Apply all challenges that modify if this random item can be generated. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.RANDOM_ITEM_BLACKLIST - * @param randomItem {@link ModifierTypeOption} The random item. - * @param isValid {@link Utils.BooleanHolder} Whether this item is valid for this challenge. Default is true. Set to false if item is not valid for this challenge. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.RANDOM_ITEM_BLACKLIS} + * @param randomItem {@linkcode ModifierTypeOption} The random item. + * @param isValid {@linkcode BooleanHolder} Whether this item is valid for this challenge. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.RANDOM_ITEM_BLACKLIST, randomItem: ModifierTypeOption, isValid: Utils.BooleanHolder): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.RANDOM_ITEM_BLACKLIST, randomItem: ModifierTypeOption, isValid: BooleanHolder): boolean; /** * Apply all challenges that modify if that pokemon can be added to the party. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.ADD_POKEMON_TO_PARTY - * @param pokemon {@link EnemyPokemon} The pokemon cought. - * @param waveIndex {@link number} Current wave index. - * @param canBeAddToParty {@link Utils.BooleanHolder} Whether this pokemon can be added to the party. Default is true. Set to false if pokemon won't be added to the party. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.ADD_POKEMON_TO_PARTY} + * @param pokemon {@linkcode EnemyPokemon} The pokemon cought. + * @param waveIndex Current wave index. + * @param canBeAddToParty {@linkcode BooleanHolder} Whether this pokemon can be added to the party. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.ADD_POKEMON_TO_PARTY, pokemon: EnemyPokemon, waveIndex: number, canBeAddToParty: Utils.BooleanHolder): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.ADD_POKEMON_TO_PARTY, pokemon: EnemyPokemon, waveIndex: number, canBeAddToParty: BooleanHolder): boolean; /** * Apply all challenges that modify if that move can be used. - * @param gameMode {@link GameMode} The current gameMode - * @param challengeType {@link ChallengeType} ChallengeType.MOVE_BLACKLIST - * @param move {@link PokemonMove} The move thats tryed to be used. - * @param moveCanBeUsed {@link Utils.BooleanHolder} Whether this move can be used. Default is true. Set to false if move is not valid for the challenge. - * @returns True if any challenge was successfully applied. + * @param gameMode The current {@linkcode GameMode} + * @param challengeType {@linkcode ChallengeType.MOVE_BLACKLIST} + * @param move {@linkcode PokemonMove} The move being attempted. + * @param moveCanBeUsed {@linkcode BooleanHolder} Whether this move can be used. + * @returns `true` if any challenge was successfully applied. */ -export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.MOVE_BLACKLIST, move: PokemonMove, moveCanBeUsed: Utils.BooleanHolder): boolean; +export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.MOVE_BLACKLIST, move: PokemonMove, moveCanBeUsed: BooleanHolder): boolean; export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType, ...args: any[]): boolean { let ret = false; gameMode.challenges.forEach(c => { @@ -1211,7 +1208,7 @@ export function copyChallenge(source: Challenge | any): Challenge { case Challenges.HARDCORE: return HardcoreChallenge.loadChallenge(source); case Challenges.NO_LEGENDS: - return NoLegendsChallenge.loadChallenge(source); + return NoStarterLegendsChallenge.loadChallenge(source); case Challenges.LIMITED_CATCH: return LimitedCatchChallenge.loadChallenge(source); } @@ -1228,7 +1225,7 @@ export function initChallenges() { new InverseBattleChallenge(), new NoAutomaticHealChallenge(), new HardcoreChallenge(), - new NoLegendsChallenge(), + new NoStarterLegendsChallenge(), new LimitedCatchChallenge(), ); }