Apply challenges to MEs

This commit is contained in:
AJ Fontaine 2025-03-31 13:58:45 -04:00
parent 5dbe049568
commit 5676a2ec3f
3 changed files with 8 additions and 2 deletions

View File

@ -46,7 +46,7 @@ import { addPokemonDataToDexAndValidateAchievements } from "#app/data/mystery-en
import type { PokeballType } from "#enums/pokeball"; import type { PokeballType } from "#enums/pokeball";
import { doShinySparkleAnim } from "#app/field/anims"; import { doShinySparkleAnim } from "#app/field/anims";
import { TrainerType } from "#enums/trainer-type"; import { TrainerType } from "#enums/trainer-type";
import { Challenges } from "#enums/challenges"; import { applyChallenges, ChallengeType } from "#app/data/challenge";
/** the i18n namespace for the encounter */ /** the i18n namespace for the encounter */
const namespace = "mysteryEncounters/globalTradeSystem"; const namespace = "mysteryEncounters/globalTradeSystem";
@ -101,7 +101,6 @@ export const GlobalTradeSystemEncounter: MysteryEncounter = MysteryEncounterBuil
MysteryEncounterType.GLOBAL_TRADE_SYSTEM, MysteryEncounterType.GLOBAL_TRADE_SYSTEM,
) )
.withEncounterTier(MysteryEncounterTier.COMMON) .withEncounterTier(MysteryEncounterTier.COMMON)
.withDisallowedChallenges(Challenges.METRONOME)
.withSceneWaveRangeRequirement(...CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES) .withSceneWaveRangeRequirement(...CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES)
.withAutoHideIntroVisuals(false) .withAutoHideIntroVisuals(false)
.withIntroSpriteConfigs([ .withIntroSpriteConfigs([
@ -210,6 +209,7 @@ export const GlobalTradeSystemEncounter: MysteryEncounter = MysteryEncounterBuil
const encounter = globalScene.currentBattle.mysteryEncounter!; const encounter = globalScene.currentBattle.mysteryEncounter!;
const tradedPokemon: PlayerPokemon = encounter.misc.tradedPokemon; const tradedPokemon: PlayerPokemon = encounter.misc.tradedPokemon;
const receivedPokemonData: EnemyPokemon = encounter.misc.receivedPokemon; const receivedPokemonData: EnemyPokemon = encounter.misc.receivedPokemon;
applyChallenges(ChallengeType.ENEMY_POKEMON_MODIFY, receivedPokemonData);
const modifiers = tradedPokemon const modifiers = tradedPokemon
.getHeldItems() .getHeldItems()
.filter(m => !(m instanceof PokemonFormChangeItemModifier) && !(m instanceof SpeciesStatBoosterModifier)); .filter(m => !(m instanceof PokemonFormChangeItemModifier) && !(m instanceof SpeciesStatBoosterModifier));
@ -331,6 +331,7 @@ export const GlobalTradeSystemEncounter: MysteryEncounter = MysteryEncounterBuil
const encounter = globalScene.currentBattle.mysteryEncounter!; const encounter = globalScene.currentBattle.mysteryEncounter!;
const tradedPokemon: PlayerPokemon = encounter.misc.tradedPokemon; const tradedPokemon: PlayerPokemon = encounter.misc.tradedPokemon;
const receivedPokemonData: EnemyPokemon = encounter.misc.receivedPokemon; const receivedPokemonData: EnemyPokemon = encounter.misc.receivedPokemon;
applyChallenges(ChallengeType.ENEMY_POKEMON_MODIFY, receivedPokemonData);
const modifiers = tradedPokemon const modifiers = tradedPokemon
.getHeldItems() .getHeldItems()
.filter(m => !(m instanceof PokemonFormChangeItemModifier) && !(m instanceof SpeciesStatBoosterModifier)); .filter(m => !(m instanceof PokemonFormChangeItemModifier) && !(m instanceof SpeciesStatBoosterModifier));

View File

@ -65,6 +65,7 @@ import { getPokemonSpecies } from "#app/data/pokemon-species";
import { PokemonType } from "#enums/pokemon-type"; import { PokemonType } from "#enums/pokemon-type";
import { getNatureName } from "#app/data/nature"; import { getNatureName } from "#app/data/nature";
import { getPokemonNameWithAffix } from "#app/messages"; import { getPokemonNameWithAffix } from "#app/messages";
import { applyChallenges, ChallengeType } from "#app/data/challenge";
/** /**
* Animates exclamation sprite over trainer's head at start of encounter * Animates exclamation sprite over trainer's head at start of encounter
@ -394,6 +395,8 @@ export async function initBattleWithEnemyConfig(partyConfig: EnemyPartyConfig):
enemyPokemon.mysteryEncounterBattleEffects = config.mysteryEncounterBattleEffects; enemyPokemon.mysteryEncounterBattleEffects = config.mysteryEncounterBattleEffects;
} }
applyChallenges(ChallengeType.ENEMY_POKEMON_MODIFY, enemyPokemon);
// Requires re-priming summon data to update everything properly // Requires re-priming summon data to update everything properly
enemyPokemon.primeSummonData(enemyPokemon.summonData); enemyPokemon.primeSummonData(enemyPokemon.summonData);

View File

@ -38,6 +38,7 @@ import { CustomPokemonData } from "#app/data/custom-pokemon-data";
import type { Abilities } from "#enums/abilities"; import type { Abilities } from "#enums/abilities";
import type { PokeballType } from "#enums/pokeball"; import type { PokeballType } from "#enums/pokeball";
import { StatusEffect } from "#enums/status-effect"; import { StatusEffect } from "#enums/status-effect";
import { applyChallenges, ChallengeType } from "#app/data/challenge";
/** Will give +1 level every 10 waves */ /** Will give +1 level every 10 waves */
export const STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER = 1; export const STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER = 1;
@ -643,6 +644,7 @@ export async function catchPokemon(
showCatchObtainMessage = true, showCatchObtainMessage = true,
isObtain = false, isObtain = false,
): Promise<void> { ): Promise<void> {
applyChallenges(ChallengeType.ENEMY_POKEMON_MODIFY, pokemon);
const speciesForm = !pokemon.fusionSpecies ? pokemon.getSpeciesForm() : pokemon.getFusionSpeciesForm(); const speciesForm = !pokemon.fusionSpecies ? pokemon.getSpeciesForm() : pokemon.getFusionSpeciesForm();
if ( if (