[balance] Training session ME does not update Seen/Defeated GameStats

This commit is contained in:
MokaStitcher 2024-10-21 22:02:39 +02:00
parent 9ac6033e4e
commit 37392d9466
4 changed files with 26 additions and 2 deletions

View File

@ -37,6 +37,7 @@ export const TrainingSessionEncounter: MysteryEncounter =
.withScenePartySizeRequirement(2, 6, true) // Must have at least 2 unfainted pokemon in party .withScenePartySizeRequirement(2, 6, true) // Must have at least 2 unfainted pokemon in party
.withFleeAllowed(false) .withFleeAllowed(false)
.withHideWildIntroMessage(true) .withHideWildIntroMessage(true)
.withPreventGameStatsUpdates(true) // Do not count the Pokemon as seen or defeated since it is ours
.withIntroSpriteConfigs([ .withIntroSpriteConfigs([
{ {
spriteKey: "training_session_gear", spriteKey: "training_session_gear",

View File

@ -53,6 +53,7 @@ export interface IMysteryEncounter {
hasBattleAnimationsWithoutTargets: boolean; hasBattleAnimationsWithoutTargets: boolean;
skipEnemyBattleTurns: boolean; skipEnemyBattleTurns: boolean;
skipToFightInput: boolean; skipToFightInput: boolean;
preventGameStatsUpdates: boolean;
onInit?: (scene: BattleScene) => boolean; onInit?: (scene: BattleScene) => boolean;
onVisualsStart?: (scene: BattleScene) => boolean; onVisualsStart?: (scene: BattleScene) => boolean;
@ -150,6 +151,10 @@ export default class MysteryEncounter implements IMysteryEncounter {
* If true, will skip COMMAND input and go straight to FIGHT (move select) input menu * If true, will skip COMMAND input and go straight to FIGHT (move select) input menu
*/ */
skipToFightInput: boolean; skipToFightInput: boolean;
/**
* If true, will prevent updating {@linkcode GameStats} for encountering and/or defeating Pokemon
*/
preventGameStatsUpdates: boolean;
// #region Event callback functions // #region Event callback functions
@ -548,6 +553,7 @@ export class MysteryEncounterBuilder implements Partial<IMysteryEncounter> {
hasBattleAnimationsWithoutTargets: boolean = false; hasBattleAnimationsWithoutTargets: boolean = false;
skipEnemyBattleTurns: boolean = false; skipEnemyBattleTurns: boolean = false;
skipToFightInput: boolean = false; skipToFightInput: boolean = false;
preventGameStatsUpdates: boolean = false;
maxAllowedEncounters: number = 3; maxAllowedEncounters: number = 3;
expMultiplier: number = 1; expMultiplier: number = 1;
@ -735,6 +741,14 @@ export class MysteryEncounterBuilder implements Partial<IMysteryEncounter> {
return Object.assign(this, { skipToFightInput }); return Object.assign(this, { skipToFightInput });
} }
/**
* If true, will prevent updating {@linkcode GameStats} for encountering and/or defeating Pokemon
* Default `false`
*/
withPreventGameStatsUpdates(preventGameStatsUpdates: boolean): this & Required<Pick<IMysteryEncounter, "preventGameStatsUpdates">> {
return Object.assign(this, { preventGameStatsUpdates });
}
/** /**
* Sets the maximum number of times that an encounter can spawn in a given Classic run * Sets the maximum number of times that an encounter can spawn in a given Classic run
* @param maxAllowedEncounters * @param maxAllowedEncounters

View File

@ -25,12 +25,17 @@ export class VictoryPhase extends PokemonPhase {
start() { start() {
super.start(); super.start();
const isMysteryEncounter = this.scene.currentBattle.isBattleMysteryEncounter();
// update Pokemon defeated count except for MEs that disable it
if (!isMysteryEncounter || !this.scene.currentBattle.mysteryEncounter?.preventGameStatsUpdates) {
this.scene.gameData.gameStats.pokemonDefeated++; this.scene.gameData.gameStats.pokemonDefeated++;
}
const expValue = this.getPokemon().getExpValue(); const expValue = this.getPokemon().getExpValue();
this.scene.applyPartyExp(expValue, true); this.scene.applyPartyExp(expValue, true);
if (this.scene.currentBattle.isBattleMysteryEncounter()) { if (isMysteryEncounter) {
handleMysteryEncounterVictory(this.scene, false, this.isExpOnly); handleMysteryEncounterVictory(this.scene, false, this.isExpOnly);
return this.end(); return this.end();
} }

View File

@ -1569,6 +1569,10 @@ export class GameData {
} }
setPokemonSeen(pokemon: Pokemon, incrementCount: boolean = true, trainer: boolean = false): void { setPokemonSeen(pokemon: Pokemon, incrementCount: boolean = true, trainer: boolean = false): void {
// Some Mystery Encounters block updates to these stats
if (this.scene.currentBattle?.isBattleMysteryEncounter() && this.scene.currentBattle.mysteryEncounter?.preventGameStatsUpdates) {
return;
}
const dexEntry = this.dexData[pokemon.species.speciesId]; const dexEntry = this.dexData[pokemon.species.speciesId];
dexEntry.seenAttr |= pokemon.getDexAttr(); dexEntry.seenAttr |= pokemon.getDexAttr();
if (incrementCount) { if (incrementCount) {