mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-05-02 14:34:52 +01:00
[Refactor] Remove game mode param from applyChallenges (#5585)
This commit is contained in:
parent
05691970e2
commit
d2ffc12d65
@ -10,7 +10,6 @@ import { PokemonMove } from "#app/field/pokemon";
|
|||||||
import type { FixedBattleConfig } from "#app/battle";
|
import type { FixedBattleConfig } from "#app/battle";
|
||||||
import { ClassicFixedBossWaves, BattleType, getRandomTrainerFunc } from "#app/battle";
|
import { ClassicFixedBossWaves, BattleType, getRandomTrainerFunc } from "#app/battle";
|
||||||
import Trainer, { TrainerVariant } from "#app/field/trainer";
|
import Trainer, { TrainerVariant } from "#app/field/trainer";
|
||||||
import type { GameMode } from "#app/game-mode";
|
|
||||||
import { PokemonType } from "#enums/pokemon-type";
|
import { PokemonType } from "#enums/pokemon-type";
|
||||||
import { Challenges } from "#enums/challenges";
|
import { Challenges } from "#enums/challenges";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
@ -383,10 +382,9 @@ export abstract class Challenge {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An apply function for GAME_MODE_MODIFY challenges. Derived classes should alter this.
|
* 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.
|
* @returns {@link boolean} Whether this function did anything.
|
||||||
*/
|
*/
|
||||||
applyGameModeModify(_gameMode: GameMode): boolean {
|
applyGameModeModify(): boolean {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -974,7 +972,6 @@ export class LowerStarterPointsChallenge extends Challenge {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply all challenges that modify starter choice.
|
* Apply all challenges that modify starter choice.
|
||||||
* @param gameMode {@link GameMode} The current gameMode
|
|
||||||
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_CHOICE
|
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_CHOICE
|
||||||
* @param pokemon {@link PokemonSpecies} The pokemon to check the validity of.
|
* @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 valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
|
||||||
@ -982,7 +979,6 @@ export class LowerStarterPointsChallenge extends Challenge {
|
|||||||
* @returns True if any challenge was successfully applied.
|
* @returns True if any challenge was successfully applied.
|
||||||
*/
|
*/
|
||||||
export function applyChallenges(
|
export function applyChallenges(
|
||||||
gameMode: GameMode,
|
|
||||||
challengeType: ChallengeType.STARTER_CHOICE,
|
challengeType: ChallengeType.STARTER_CHOICE,
|
||||||
pokemon: PokemonSpecies,
|
pokemon: PokemonSpecies,
|
||||||
valid: Utils.BooleanHolder,
|
valid: Utils.BooleanHolder,
|
||||||
@ -990,85 +986,66 @@ export function applyChallenges(
|
|||||||
): boolean;
|
): boolean;
|
||||||
/**
|
/**
|
||||||
* Apply all challenges that modify available total starter points.
|
* Apply all challenges that modify available total starter points.
|
||||||
* @param gameMode {@link GameMode} The current gameMode
|
|
||||||
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_POINTS
|
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_POINTS
|
||||||
* @param points {@link Utils.NumberHolder} The amount of points you have available.
|
* @param points {@link Utils.NumberHolder} The amount of points you have available.
|
||||||
* @returns True if any challenge was successfully applied.
|
* @returns True if any challenge was successfully applied.
|
||||||
*/
|
*/
|
||||||
export function applyChallenges(
|
export function applyChallenges(challengeType: ChallengeType.STARTER_POINTS, points: Utils.NumberHolder): boolean;
|
||||||
gameMode: GameMode,
|
|
||||||
challengeType: ChallengeType.STARTER_POINTS,
|
|
||||||
points: Utils.NumberHolder,
|
|
||||||
): boolean;
|
|
||||||
/**
|
/**
|
||||||
* Apply all challenges that modify the cost of a starter.
|
* 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 challengeType {@link ChallengeType} ChallengeType.STARTER_COST
|
||||||
* @param species {@link Species} The pokemon to change the cost of.
|
* @param species {@link Species} The pokemon to change the cost of.
|
||||||
* @param points {@link Utils.NumberHolder} The cost of the pokemon.
|
* @param points {@link Utils.NumberHolder} The cost of the pokemon.
|
||||||
* @returns True if any challenge was successfully applied.
|
* @returns True if any challenge was successfully applied.
|
||||||
*/
|
*/
|
||||||
export function applyChallenges(
|
export function applyChallenges(
|
||||||
gameMode: GameMode,
|
|
||||||
challengeType: ChallengeType.STARTER_COST,
|
challengeType: ChallengeType.STARTER_COST,
|
||||||
species: Species,
|
species: Species,
|
||||||
cost: Utils.NumberHolder,
|
cost: Utils.NumberHolder,
|
||||||
): boolean;
|
): boolean;
|
||||||
/**
|
/**
|
||||||
* Apply all challenges that modify a starter after selection.
|
* Apply all challenges that modify a starter after selection.
|
||||||
* @param gameMode {@link GameMode} The current gameMode
|
|
||||||
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_MODIFY
|
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_MODIFY
|
||||||
* @param pokemon {@link Pokemon} The starter pokemon to modify.
|
* @param pokemon {@link Pokemon} The starter pokemon to modify.
|
||||||
* @returns True if any challenge was successfully applied.
|
* @returns True if any challenge was successfully applied.
|
||||||
*/
|
*/
|
||||||
export function applyChallenges(
|
export function applyChallenges(challengeType: ChallengeType.STARTER_MODIFY, pokemon: Pokemon): boolean;
|
||||||
gameMode: GameMode,
|
|
||||||
challengeType: ChallengeType.STARTER_MODIFY,
|
|
||||||
pokemon: Pokemon,
|
|
||||||
): boolean;
|
|
||||||
/**
|
/**
|
||||||
* Apply all challenges that what pokemon you can have in battle.
|
* 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 challengeType {@link ChallengeType} ChallengeType.POKEMON_IN_BATTLE
|
||||||
* @param pokemon {@link Pokemon} The pokemon to check the validity of.
|
* @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.
|
* @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.
|
* @returns True if any challenge was successfully applied.
|
||||||
*/
|
*/
|
||||||
export function applyChallenges(
|
export function applyChallenges(
|
||||||
gameMode: GameMode,
|
|
||||||
challengeType: ChallengeType.POKEMON_IN_BATTLE,
|
challengeType: ChallengeType.POKEMON_IN_BATTLE,
|
||||||
pokemon: Pokemon,
|
pokemon: Pokemon,
|
||||||
valid: Utils.BooleanHolder,
|
valid: Utils.BooleanHolder,
|
||||||
): boolean;
|
): boolean;
|
||||||
/**
|
/**
|
||||||
* Apply all challenges that modify what fixed battles there are.
|
* 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 challengeType {@link ChallengeType} ChallengeType.FIXED_BATTLES
|
||||||
* @param waveIndex {@link Number} The current wave index.
|
* @param waveIndex {@link Number} The current wave index.
|
||||||
* @param battleConfig {@link FixedBattleConfig} The battle config to modify.
|
* @param battleConfig {@link FixedBattleConfig} The battle config to modify.
|
||||||
* @returns True if any challenge was successfully applied.
|
* @returns True if any challenge was successfully applied.
|
||||||
*/
|
*/
|
||||||
export function applyChallenges(
|
export function applyChallenges(
|
||||||
gameMode: GameMode,
|
|
||||||
challengeType: ChallengeType.FIXED_BATTLES,
|
challengeType: ChallengeType.FIXED_BATTLES,
|
||||||
waveIndex: number,
|
waveIndex: number,
|
||||||
battleConfig: FixedBattleConfig,
|
battleConfig: FixedBattleConfig,
|
||||||
): boolean;
|
): boolean;
|
||||||
/**
|
/**
|
||||||
* Apply all challenges that modify type effectiveness.
|
* Apply all challenges that modify type effectiveness.
|
||||||
* @param gameMode {@linkcode GameMode} The current gameMode
|
|
||||||
* @param challengeType {@linkcode ChallengeType} ChallengeType.TYPE_EFFECTIVENESS
|
* @param challengeType {@linkcode ChallengeType} ChallengeType.TYPE_EFFECTIVENESS
|
||||||
* @param effectiveness {@linkcode Utils.NumberHolder} The current effectiveness of the move.
|
* @param effectiveness {@linkcode Utils.NumberHolder} The current effectiveness of the move.
|
||||||
* @returns True if any challenge was successfully applied.
|
* @returns True if any challenge was successfully applied.
|
||||||
*/
|
*/
|
||||||
export function applyChallenges(
|
export function applyChallenges(
|
||||||
gameMode: GameMode,
|
|
||||||
challengeType: ChallengeType.TYPE_EFFECTIVENESS,
|
challengeType: ChallengeType.TYPE_EFFECTIVENESS,
|
||||||
effectiveness: Utils.NumberHolder,
|
effectiveness: Utils.NumberHolder,
|
||||||
): boolean;
|
): boolean;
|
||||||
/**
|
/**
|
||||||
* Apply all challenges that modify what level AI are.
|
* Apply all challenges that modify what level AI are.
|
||||||
* @param gameMode {@link GameMode} The current gameMode
|
|
||||||
* @param challengeType {@link ChallengeType} ChallengeType.AI_LEVEL
|
* @param challengeType {@link ChallengeType} ChallengeType.AI_LEVEL
|
||||||
* @param level {@link Utils.NumberHolder} The generated level of the pokemon.
|
* @param level {@link Utils.NumberHolder} The generated level of the pokemon.
|
||||||
* @param levelCap {@link Number} The maximum level cap for the current wave.
|
* @param levelCap {@link Number} The maximum level cap for the current wave.
|
||||||
@ -1077,7 +1054,6 @@ export function applyChallenges(
|
|||||||
* @returns True if any challenge was successfully applied.
|
* @returns True if any challenge was successfully applied.
|
||||||
*/
|
*/
|
||||||
export function applyChallenges(
|
export function applyChallenges(
|
||||||
gameMode: GameMode,
|
|
||||||
challengeType: ChallengeType.AI_LEVEL,
|
challengeType: ChallengeType.AI_LEVEL,
|
||||||
level: Utils.NumberHolder,
|
level: Utils.NumberHolder,
|
||||||
levelCap: number,
|
levelCap: number,
|
||||||
@ -1086,42 +1062,36 @@ export function applyChallenges(
|
|||||||
): boolean;
|
): boolean;
|
||||||
/**
|
/**
|
||||||
* Apply all challenges that modify how many move slots the AI has.
|
* 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 challengeType {@link ChallengeType} ChallengeType.AI_MOVE_SLOTS
|
||||||
* @param pokemon {@link Pokemon} The pokemon being considered.
|
* @param pokemon {@link Pokemon} The pokemon being considered.
|
||||||
* @param moveSlots {@link Utils.NumberHolder} The amount of move slots.
|
* @param moveSlots {@link Utils.NumberHolder} The amount of move slots.
|
||||||
* @returns True if any challenge was successfully applied.
|
* @returns True if any challenge was successfully applied.
|
||||||
*/
|
*/
|
||||||
export function applyChallenges(
|
export function applyChallenges(
|
||||||
gameMode: GameMode,
|
|
||||||
challengeType: ChallengeType.AI_MOVE_SLOTS,
|
challengeType: ChallengeType.AI_MOVE_SLOTS,
|
||||||
pokemon: Pokemon,
|
pokemon: Pokemon,
|
||||||
moveSlots: Utils.NumberHolder,
|
moveSlots: Utils.NumberHolder,
|
||||||
): boolean;
|
): boolean;
|
||||||
/**
|
/**
|
||||||
* Apply all challenges that modify whether a pokemon has its passive.
|
* 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 challengeType {@link ChallengeType} ChallengeType.PASSIVE_ACCESS
|
||||||
* @param pokemon {@link Pokemon} The pokemon to modify.
|
* @param pokemon {@link Pokemon} The pokemon to modify.
|
||||||
* @param hasPassive {@link Utils.BooleanHolder} Whether it has its passive.
|
* @param hasPassive {@link Utils.BooleanHolder} Whether it has its passive.
|
||||||
* @returns True if any challenge was successfully applied.
|
* @returns True if any challenge was successfully applied.
|
||||||
*/
|
*/
|
||||||
export function applyChallenges(
|
export function applyChallenges(
|
||||||
gameMode: GameMode,
|
|
||||||
challengeType: ChallengeType.PASSIVE_ACCESS,
|
challengeType: ChallengeType.PASSIVE_ACCESS,
|
||||||
pokemon: Pokemon,
|
pokemon: Pokemon,
|
||||||
hasPassive: Utils.BooleanHolder,
|
hasPassive: Utils.BooleanHolder,
|
||||||
): boolean;
|
): boolean;
|
||||||
/**
|
/**
|
||||||
* Apply all challenges that modify the game modes settings.
|
* Apply all challenges that modify the game modes settings.
|
||||||
* @param gameMode {@link GameMode} The current gameMode
|
|
||||||
* @param challengeType {@link ChallengeType} ChallengeType.GAME_MODE_MODIFY
|
* @param challengeType {@link ChallengeType} ChallengeType.GAME_MODE_MODIFY
|
||||||
* @returns True if any challenge was successfully applied.
|
* @returns True if any challenge was successfully applied.
|
||||||
*/
|
*/
|
||||||
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.GAME_MODE_MODIFY): boolean;
|
export function applyChallenges(challengeType: ChallengeType.GAME_MODE_MODIFY): boolean;
|
||||||
/**
|
/**
|
||||||
* Apply all challenges that modify what level a pokemon can access a move.
|
* 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 challengeType {@link ChallengeType} ChallengeType.MOVE_ACCESS
|
||||||
* @param pokemon {@link Pokemon} What pokemon would learn the move.
|
* @param pokemon {@link Pokemon} What pokemon would learn the move.
|
||||||
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
|
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
|
||||||
@ -1130,7 +1100,6 @@ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType
|
|||||||
* @returns True if any challenge was successfully applied.
|
* @returns True if any challenge was successfully applied.
|
||||||
*/
|
*/
|
||||||
export function applyChallenges(
|
export function applyChallenges(
|
||||||
gameMode: GameMode,
|
|
||||||
challengeType: ChallengeType.MOVE_ACCESS,
|
challengeType: ChallengeType.MOVE_ACCESS,
|
||||||
pokemon: Pokemon,
|
pokemon: Pokemon,
|
||||||
moveSource: MoveSourceType,
|
moveSource: MoveSourceType,
|
||||||
@ -1139,7 +1108,6 @@ export function applyChallenges(
|
|||||||
): boolean;
|
): boolean;
|
||||||
/**
|
/**
|
||||||
* Apply all challenges that modify what weight a pokemon gives to move generation
|
* 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 challengeType {@link ChallengeType} ChallengeType.MOVE_WEIGHT
|
||||||
* @param pokemon {@link Pokemon} What pokemon would learn the move.
|
* @param pokemon {@link Pokemon} What pokemon would learn the move.
|
||||||
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
|
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
|
||||||
@ -1148,7 +1116,6 @@ export function applyChallenges(
|
|||||||
* @returns True if any challenge was successfully applied.
|
* @returns True if any challenge was successfully applied.
|
||||||
*/
|
*/
|
||||||
export function applyChallenges(
|
export function applyChallenges(
|
||||||
gameMode: GameMode,
|
|
||||||
challengeType: ChallengeType.MOVE_WEIGHT,
|
challengeType: ChallengeType.MOVE_WEIGHT,
|
||||||
pokemon: Pokemon,
|
pokemon: Pokemon,
|
||||||
moveSource: MoveSourceType,
|
moveSource: MoveSourceType,
|
||||||
@ -1156,16 +1123,11 @@ export function applyChallenges(
|
|||||||
weight: Utils.NumberHolder,
|
weight: Utils.NumberHolder,
|
||||||
): boolean;
|
): boolean;
|
||||||
|
|
||||||
export function applyChallenges(
|
export function applyChallenges(challengeType: ChallengeType.FLIP_STAT, pokemon: Pokemon, baseStats: number[]): boolean;
|
||||||
gameMode: GameMode,
|
|
||||||
challengeType: ChallengeType.FLIP_STAT,
|
|
||||||
pokemon: Pokemon,
|
|
||||||
baseStats: number[],
|
|
||||||
): boolean;
|
|
||||||
|
|
||||||
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType, ...args: any[]): boolean {
|
export function applyChallenges(challengeType: ChallengeType, ...args: any[]): boolean {
|
||||||
let ret = false;
|
let ret = false;
|
||||||
gameMode.challenges.forEach(c => {
|
globalScene.gameMode.challenges.forEach(c => {
|
||||||
if (c.value !== 0) {
|
if (c.value !== 0) {
|
||||||
switch (challengeType) {
|
switch (challengeType) {
|
||||||
case ChallengeType.STARTER_CHOICE:
|
case ChallengeType.STARTER_CHOICE:
|
||||||
@ -1199,7 +1161,7 @@ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType
|
|||||||
ret ||= c.applyPassiveAccess(args[0], args[1]);
|
ret ||= c.applyPassiveAccess(args[0], args[1]);
|
||||||
break;
|
break;
|
||||||
case ChallengeType.GAME_MODE_MODIFY:
|
case ChallengeType.GAME_MODE_MODIFY:
|
||||||
ret ||= c.applyGameModeModify(gameMode);
|
ret ||= c.applyGameModeModify();
|
||||||
break;
|
break;
|
||||||
case ChallengeType.MOVE_ACCESS:
|
case ChallengeType.MOVE_ACCESS:
|
||||||
ret ||= c.applyMoveAccessLevel(args[0], args[1], args[2], args[3]);
|
ret ||= c.applyMoveAccessLevel(args[0], args[1], args[2], args[3]);
|
||||||
@ -1264,7 +1226,7 @@ export function initChallenges() {
|
|||||||
export function checkStarterValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) {
|
export function checkStarterValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) {
|
||||||
if (!soft) {
|
if (!soft) {
|
||||||
const isValidForChallenge = new Utils.BooleanHolder(true);
|
const isValidForChallenge = new Utils.BooleanHolder(true);
|
||||||
applyChallenges(globalScene.gameMode, ChallengeType.STARTER_CHOICE, species, isValidForChallenge, props);
|
applyChallenges(ChallengeType.STARTER_CHOICE, species, isValidForChallenge, props);
|
||||||
return isValidForChallenge.value;
|
return isValidForChallenge.value;
|
||||||
}
|
}
|
||||||
// We check the validity of every evolution and form change, and require that at least one is valid
|
// We check the validity of every evolution and form change, and require that at least one is valid
|
||||||
@ -1302,7 +1264,7 @@ export function checkStarterValidForChallenge(species: PokemonSpecies, props: De
|
|||||||
*/
|
*/
|
||||||
function checkSpeciesValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) {
|
function checkSpeciesValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) {
|
||||||
const isValidForChallenge = new Utils.BooleanHolder(true);
|
const isValidForChallenge = new Utils.BooleanHolder(true);
|
||||||
applyChallenges(globalScene.gameMode, ChallengeType.STARTER_CHOICE, species, isValidForChallenge, props);
|
applyChallenges(ChallengeType.STARTER_CHOICE, species, isValidForChallenge, props);
|
||||||
if (!soft || !pokemonFormChanges.hasOwnProperty(species.speciesId)) {
|
if (!soft || !pokemonFormChanges.hasOwnProperty(species.speciesId)) {
|
||||||
return isValidForChallenge.value;
|
return isValidForChallenge.value;
|
||||||
}
|
}
|
||||||
@ -1321,13 +1283,7 @@ function checkSpeciesValidForChallenge(species: PokemonSpecies, props: DexAttrPr
|
|||||||
const formProps = { ...props };
|
const formProps = { ...props };
|
||||||
formProps.formIndex = formIndex;
|
formProps.formIndex = formIndex;
|
||||||
const isFormValidForChallenge = new Utils.BooleanHolder(true);
|
const isFormValidForChallenge = new Utils.BooleanHolder(true);
|
||||||
applyChallenges(
|
applyChallenges(ChallengeType.STARTER_CHOICE, species, isFormValidForChallenge, formProps);
|
||||||
globalScene.gameMode,
|
|
||||||
ChallengeType.STARTER_CHOICE,
|
|
||||||
species,
|
|
||||||
isFormValidForChallenge,
|
|
||||||
formProps,
|
|
||||||
);
|
|
||||||
if (isFormValidForChallenge.value) {
|
if (isFormValidForChallenge.value) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -8110,7 +8110,7 @@ export class ResistLastMoveTypeAttr extends MoveEffectAttr {
|
|||||||
for (let i = 0; i < Object.keys(PokemonType).length; i++) {
|
for (let i = 0; i < Object.keys(PokemonType).length; i++) {
|
||||||
const multiplier = new NumberHolder(1);
|
const multiplier = new NumberHolder(1);
|
||||||
multiplier.value = getTypeDamageMultiplier(type, i);
|
multiplier.value = getTypeDamageMultiplier(type, i);
|
||||||
applyChallenges(gameMode, ChallengeType.TYPE_EFFECTIVENESS, multiplier);
|
applyChallenges(ChallengeType.TYPE_EFFECTIVENESS, multiplier);
|
||||||
if (multiplier.value < 1) {
|
if (multiplier.value < 1) {
|
||||||
typeResistances.push(i);
|
typeResistances.push(i);
|
||||||
}
|
}
|
||||||
|
@ -634,7 +634,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
public isAllowedInChallenge(): boolean {
|
public isAllowedInChallenge(): boolean {
|
||||||
const challengeAllowed = new Utils.BooleanHolder(true);
|
const challengeAllowed = new Utils.BooleanHolder(true);
|
||||||
applyChallenges(
|
applyChallenges(
|
||||||
globalScene.gameMode,
|
|
||||||
ChallengeType.POKEMON_IN_BATTLE,
|
ChallengeType.POKEMON_IN_BATTLE,
|
||||||
this,
|
this,
|
||||||
challengeAllowed,
|
challengeAllowed,
|
||||||
@ -1598,7 +1597,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
calculateBaseStats(): number[] {
|
calculateBaseStats(): number[] {
|
||||||
const baseStats = this.getSpeciesForm(true).baseStats.slice(0);
|
const baseStats = this.getSpeciesForm(true).baseStats.slice(0);
|
||||||
applyChallenges(
|
applyChallenges(
|
||||||
globalScene.gameMode,
|
|
||||||
ChallengeType.FLIP_STAT,
|
ChallengeType.FLIP_STAT,
|
||||||
this,
|
this,
|
||||||
baseStats,
|
baseStats,
|
||||||
@ -1620,7 +1618,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
if (this.isFusion()) {
|
if (this.isFusion()) {
|
||||||
const fusionBaseStats = this.getFusionSpeciesForm(true).baseStats;
|
const fusionBaseStats = this.getFusionSpeciesForm(true).baseStats;
|
||||||
applyChallenges(
|
applyChallenges(
|
||||||
globalScene.gameMode,
|
|
||||||
ChallengeType.FLIP_STAT,
|
ChallengeType.FLIP_STAT,
|
||||||
this,
|
this,
|
||||||
fusionBaseStats,
|
fusionBaseStats,
|
||||||
@ -2594,7 +2591,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
getTypeDamageMultiplier(moveType, defType),
|
getTypeDamageMultiplier(moveType, defType),
|
||||||
);
|
);
|
||||||
applyChallenges(
|
applyChallenges(
|
||||||
globalScene.gameMode,
|
|
||||||
ChallengeType.TYPE_EFFECTIVENESS,
|
ChallengeType.TYPE_EFFECTIVENESS,
|
||||||
multiplier,
|
multiplier,
|
||||||
);
|
);
|
||||||
@ -2646,7 +2642,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
getTypeDamageMultiplier(moveType, PokemonType.FLYING),
|
getTypeDamageMultiplier(moveType, PokemonType.FLYING),
|
||||||
);
|
);
|
||||||
applyChallenges(
|
applyChallenges(
|
||||||
globalScene.gameMode,
|
|
||||||
ChallengeType.TYPE_EFFECTIVENESS,
|
ChallengeType.TYPE_EFFECTIVENESS,
|
||||||
typeMultiplierAgainstFlying,
|
typeMultiplierAgainstFlying,
|
||||||
);
|
);
|
||||||
|
@ -285,7 +285,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
const dummyConfig = new FixedBattleConfig();
|
const dummyConfig = new FixedBattleConfig();
|
||||||
return (
|
return (
|
||||||
this.battleConfig.hasOwnProperty(waveIndex) ||
|
this.battleConfig.hasOwnProperty(waveIndex) ||
|
||||||
applyChallenges(this, ChallengeType.FIXED_BATTLES, waveIndex, dummyConfig)
|
applyChallenges(ChallengeType.FIXED_BATTLES, waveIndex, dummyConfig)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
*/
|
*/
|
||||||
getFixedBattle(waveIndex: number): FixedBattleConfig {
|
getFixedBattle(waveIndex: number): FixedBattleConfig {
|
||||||
const challengeConfig = new FixedBattleConfig();
|
const challengeConfig = new FixedBattleConfig();
|
||||||
if (applyChallenges(this, ChallengeType.FIXED_BATTLES, waveIndex, challengeConfig)) {
|
if (applyChallenges(ChallengeType.FIXED_BATTLES, waveIndex, challengeConfig)) {
|
||||||
return challengeConfig;
|
return challengeConfig;
|
||||||
}
|
}
|
||||||
return this.battleConfig[waveIndex];
|
return this.battleConfig[waveIndex];
|
||||||
|
@ -101,7 +101,7 @@ export class SelectStarterPhase extends Phase {
|
|||||||
starterPokemon.generateFusionSpecies(true);
|
starterPokemon.generateFusionSpecies(true);
|
||||||
}
|
}
|
||||||
starterPokemon.setVisible(false);
|
starterPokemon.setVisible(false);
|
||||||
applyChallenges(globalScene.gameMode, ChallengeType.STARTER_MODIFY, starterPokemon);
|
applyChallenges(ChallengeType.STARTER_MODIFY, starterPokemon);
|
||||||
party.push(starterPokemon);
|
party.push(starterPokemon);
|
||||||
loadPokemonAssets.push(starterPokemon.loadAssets());
|
loadPokemonAssets.push(starterPokemon.loadAssets());
|
||||||
});
|
});
|
||||||
|
@ -2183,7 +2183,7 @@ export class GameData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cost = new Utils.NumberHolder(value);
|
const cost = new Utils.NumberHolder(value);
|
||||||
applyChallenges(globalScene.gameMode, ChallengeType.STARTER_COST, speciesId, cost);
|
applyChallenges(ChallengeType.STARTER_COST, speciesId, cost);
|
||||||
|
|
||||||
return cost.value;
|
return cost.value;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
*/
|
*/
|
||||||
private FilterChallengeLegal = (pokemon: PlayerPokemon) => {
|
private FilterChallengeLegal = (pokemon: PlayerPokemon) => {
|
||||||
const challengeAllowed = new Utils.BooleanHolder(true);
|
const challengeAllowed = new Utils.BooleanHolder(true);
|
||||||
applyChallenges(globalScene.gameMode, ChallengeType.POKEMON_IN_BATTLE, pokemon, challengeAllowed);
|
applyChallenges(ChallengeType.POKEMON_IN_BATTLE, pokemon, challengeAllowed);
|
||||||
if (!challengeAllowed.value) {
|
if (!challengeAllowed.value) {
|
||||||
return i18next.t("partyUiHandler:cantBeUsed", {
|
return i18next.t("partyUiHandler:cantBeUsed", {
|
||||||
pokemonName: getPokemonNameWithAffix(pokemon),
|
pokemonName: getPokemonNameWithAffix(pokemon),
|
||||||
|
@ -2956,7 +2956,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
valueLimit.value = 10;
|
valueLimit.value = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
Challenge.applyChallenges(globalScene.gameMode, Challenge.ChallengeType.STARTER_POINTS, valueLimit);
|
Challenge.applyChallenges(Challenge.ChallengeType.STARTER_POINTS, valueLimit);
|
||||||
|
|
||||||
return valueLimit.value;
|
return valueLimit.value;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user