From c6b4f273d04d5e0da456442da2852794b85e26e6 Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Fri, 8 Aug 2025 01:07:53 +0200 Subject: [PATCH] Using `SilentReward` for fixed event rewards --- src/phases/victory-phase.ts | 21 +++++++------- src/timed-event-manager.ts | 55 +++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/phases/victory-phase.ts b/src/phases/victory-phase.ts index 8fdf8d52bc3..71debad6ca7 100644 --- a/src/phases/victory-phase.ts +++ b/src/phases/victory-phase.ts @@ -1,9 +1,10 @@ import { timedEventManager } from "#app/global-event-manager"; import { globalScene } from "#app/global-scene"; -import { allRewards } from "#data/data-lists"; import { BattleType } from "#enums/battle-type"; import type { BattlerIndex } from "#enums/battler-index"; import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves"; +import { RewardId } from "#enums/reward-id"; +import { TrainerItemId } from "#enums/trainer-item-id"; import type { CustomRewardSettings } from "#items/reward-pool-utils"; import { handleMysteryEncounterVictory } from "#mystery-encounters/encounter-phase-utils"; import { PokemonPhase } from "#phases/pokemon-phase"; @@ -55,11 +56,11 @@ export class VictoryPhase extends PokemonPhase { // Get event modifiers for this wave timedEventManager .getFixedBattleEventRewards(globalScene.currentBattle.waveIndex) - .map(r => globalScene.phaseManager.pushNew("RewardPhase", allRewards[r])); + .map(r => globalScene.phaseManager.pushNew("RewardPhase", r)); break; case ClassicFixedBossWaves.EVIL_BOSS_2: // Should get Lock Capsule on 165 before shop phase so it can be used in the allRewards shop - globalScene.phaseManager.pushNew("RewardPhase", allRewards.LOCK_CAPSULE); + globalScene.phaseManager.pushNew("RewardPhase", TrainerItemId.LOCK_CAPSULE); break; } } @@ -71,17 +72,17 @@ export class VictoryPhase extends PokemonPhase { this.getFixedBattleCustomRewards(), ); } else if (globalScene.gameMode.isDaily) { - globalScene.phaseManager.pushNew("RewardPhase", allRewards.EXP_CHARM); + globalScene.phaseManager.pushNew("RewardPhase", TrainerItemId.EXP_CHARM); if ( globalScene.currentBattle.waveIndex > 10 && !globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex) ) { - globalScene.phaseManager.pushNew("RewardPhase", allRewards.GOLDEN_POKEBALL); + globalScene.phaseManager.pushNew("RewardPhase", TrainerItemId.GOLDEN_POKEBALL); } } else { const superExpWave = !globalScene.gameMode.isEndless ? (globalScene.offsetGym ? 0 : 20) : 10; if (globalScene.gameMode.isEndless && globalScene.currentBattle.waveIndex === 10) { - globalScene.phaseManager.pushNew("RewardPhase", allRewards.EXP_SHARE); + globalScene.phaseManager.pushNew("RewardPhase", TrainerItemId.EXP_SHARE); } if ( globalScene.currentBattle.waveIndex <= 750 && @@ -90,17 +91,17 @@ export class VictoryPhase extends PokemonPhase { globalScene.phaseManager.pushNew( "RewardPhase", globalScene.currentBattle.waveIndex % 30 !== superExpWave || globalScene.currentBattle.waveIndex > 250 - ? allRewards.EXP_CHARM - : allRewards.SUPER_EXP_CHARM, + ? TrainerItemId.EXP_CHARM + : TrainerItemId.SUPER_EXP_CHARM, ); } if (globalScene.currentBattle.waveIndex <= 150 && !(globalScene.currentBattle.waveIndex % 50)) { - globalScene.phaseManager.pushNew("RewardPhase", allRewards.GOLDEN_POKEBALL); + globalScene.phaseManager.pushNew("RewardPhase", TrainerItemId.GOLDEN_POKEBALL); } if (globalScene.gameMode.isEndless && !(globalScene.currentBattle.waveIndex % 50)) { globalScene.phaseManager.pushNew( "RewardPhase", - !(globalScene.currentBattle.waveIndex % 250) ? allRewards.VOUCHER_PREMIUM : allRewards.VOUCHER_PLUS, + !(globalScene.currentBattle.waveIndex % 250) ? RewardId.VOUCHER_PREMIUM : RewardId.VOUCHER_PLUS, ); globalScene.phaseManager.pushNew("AddEnemyTokenPhase"); } diff --git a/src/timed-event-manager.ts b/src/timed-event-manager.ts index 1cdb8d6ebf9..3f51990afb5 100644 --- a/src/timed-event-manager.ts +++ b/src/timed-event-manager.ts @@ -8,6 +8,7 @@ import { SpeciesId } from "#enums/species-id"; import { TextStyle } from "#enums/text-style"; import { TrainerItemId } from "#enums/trainer-item-id"; import { WeatherType } from "#enums/weather-type"; +import type { SilentReward } from "#types/rewards"; import { addTextObject } from "#ui/text"; import type { nil } from "#utils/common"; import { isNullOrUndefined } from "#utils/common"; @@ -41,7 +42,7 @@ interface EventMysteryEncounterTier { interface EventWaveReward { wave: number; - type: string; + type: SilentReward; } type EventMusicReplacement = [string, string]; @@ -131,10 +132,10 @@ const timedEvents: TimedEvent[] = [ }, ], classicWaveRewards: [ - { wave: 8, type: "SHINY_CHARM" }, - { wave: 8, type: "ABILITY_CHARM" }, - { wave: 8, type: "CATCHING_CHARM" }, - { wave: 25, type: "SHINY_CHARM" }, + { wave: 8, type: TrainerItemId.SHINY_CHARM }, + { wave: 8, type: TrainerItemId.ABILITY_CHARM }, + { wave: 8, type: TrainerItemId.CATCHING_CHARM }, + { wave: 25, type: TrainerItemId.SHINY_CHARM }, ], }, { @@ -202,10 +203,10 @@ const timedEvents: TimedEvent[] = [ SpeciesId.BLOODMOON_URSALUNA, ], classicWaveRewards: [ - { wave: 8, type: "SHINY_CHARM" }, - { wave: 8, type: "ABILITY_CHARM" }, - { wave: 8, type: "CATCHING_CHARM" }, - { wave: 25, type: "SHINY_CHARM" }, + { wave: 8, type: TrainerItemId.SHINY_CHARM }, + { wave: 8, type: TrainerItemId.ABILITY_CHARM }, + { wave: 8, type: TrainerItemId.CATCHING_CHARM }, + { wave: 25, type: TrainerItemId.SHINY_CHARM }, ], }, { @@ -242,10 +243,10 @@ const timedEvents: TimedEvent[] = [ ], luckBoostedSpecies: [SpeciesId.LUVDISC], classicWaveRewards: [ - { wave: 8, type: "SHINY_CHARM" }, - { wave: 8, type: "ABILITY_CHARM" }, - { wave: 8, type: "CATCHING_CHARM" }, - { wave: 25, type: "SHINY_CHARM" }, + { wave: 8, type: TrainerItemId.SHINY_CHARM }, + { wave: 8, type: TrainerItemId.ABILITY_CHARM }, + { wave: 8, type: TrainerItemId.CATCHING_CHARM }, + { wave: 25, type: TrainerItemId.SHINY_CHARM }, ], }, { @@ -293,10 +294,10 @@ const timedEvents: TimedEvent[] = [ SpeciesId.ETERNAL_FLOETTE, ], classicWaveRewards: [ - { wave: 8, type: "SHINY_CHARM" }, - { wave: 8, type: "ABILITY_CHARM" }, - { wave: 8, type: "CATCHING_CHARM" }, - { wave: 25, type: "SHINY_CHARM" }, + { wave: 8, type: TrainerItemId.SHINY_CHARM }, + { wave: 8, type: TrainerItemId.ABILITY_CHARM }, + { wave: 8, type: TrainerItemId.CATCHING_CHARM }, + { wave: 25, type: TrainerItemId.SHINY_CHARM }, ], }, { @@ -354,10 +355,10 @@ const timedEvents: TimedEvent[] = [ { species: SpeciesId.APPLIN }, ], classicWaveRewards: [ - { wave: 8, type: "SHINY_CHARM" }, - { wave: 8, type: "ABILITY_CHARM" }, - { wave: 8, type: "CATCHING_CHARM" }, - { wave: 25, type: "SHINY_CHARM" }, + { wave: 8, type: TrainerItemId.SHINY_CHARM }, + { wave: 8, type: TrainerItemId.ABILITY_CHARM }, + { wave: 8, type: TrainerItemId.CATCHING_CHARM }, + { wave: 25, type: TrainerItemId.SHINY_CHARM }, ], }, { @@ -384,10 +385,10 @@ const timedEvents: TimedEvent[] = [ { species: SpeciesId.ALOLA_MEOWTH }, ], classicWaveRewards: [ - { wave: 8, type: "SHINY_CHARM" }, - { wave: 8, type: "ABILITY_CHARM" }, - { wave: 8, type: "CATCHING_CHARM" }, - { wave: 25, type: "SHINY_CHARM" }, + { wave: 8, type: TrainerItemId.SHINY_CHARM }, + { wave: 8, type: TrainerItemId.ABILITY_CHARM }, + { wave: 8, type: TrainerItemId.CATCHING_CHARM }, + { wave: 25, type: TrainerItemId.SHINY_CHARM }, ], }, ]; @@ -571,8 +572,8 @@ export class TimedEventManager { * @param wave the wave to check for associated allRewards * @returns array of strings of the event modifier reward types */ - getFixedBattleEventRewards(wave: number): string[] { - const ret: string[] = []; + getFixedBattleEventRewards(wave: number): SilentReward[] { + const ret: SilentReward[] = []; timedEvents .filter(te => this.isActive(te) && !isNullOrUndefined(te.classicWaveRewards)) .map(te => {