Using SilentReward for fixed event rewards

This commit is contained in:
Wlowscha 2025-08-08 01:07:53 +02:00
parent 3c8ba17cbf
commit c6b4f273d0
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
2 changed files with 39 additions and 37 deletions

View File

@ -1,9 +1,10 @@
import { timedEventManager } from "#app/global-event-manager"; import { timedEventManager } from "#app/global-event-manager";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { allRewards } from "#data/data-lists";
import { BattleType } from "#enums/battle-type"; import { BattleType } from "#enums/battle-type";
import type { BattlerIndex } from "#enums/battler-index"; import type { BattlerIndex } from "#enums/battler-index";
import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves"; 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 type { CustomRewardSettings } from "#items/reward-pool-utils";
import { handleMysteryEncounterVictory } from "#mystery-encounters/encounter-phase-utils"; import { handleMysteryEncounterVictory } from "#mystery-encounters/encounter-phase-utils";
import { PokemonPhase } from "#phases/pokemon-phase"; import { PokemonPhase } from "#phases/pokemon-phase";
@ -55,11 +56,11 @@ export class VictoryPhase extends PokemonPhase {
// Get event modifiers for this wave // Get event modifiers for this wave
timedEventManager timedEventManager
.getFixedBattleEventRewards(globalScene.currentBattle.waveIndex) .getFixedBattleEventRewards(globalScene.currentBattle.waveIndex)
.map(r => globalScene.phaseManager.pushNew("RewardPhase", allRewards[r])); .map(r => globalScene.phaseManager.pushNew("RewardPhase", r));
break; break;
case ClassicFixedBossWaves.EVIL_BOSS_2: case ClassicFixedBossWaves.EVIL_BOSS_2:
// Should get Lock Capsule on 165 before shop phase so it can be used in the allRewards shop // 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; break;
} }
} }
@ -71,17 +72,17 @@ export class VictoryPhase extends PokemonPhase {
this.getFixedBattleCustomRewards(), this.getFixedBattleCustomRewards(),
); );
} else if (globalScene.gameMode.isDaily) { } else if (globalScene.gameMode.isDaily) {
globalScene.phaseManager.pushNew("RewardPhase", allRewards.EXP_CHARM); globalScene.phaseManager.pushNew("RewardPhase", TrainerItemId.EXP_CHARM);
if ( if (
globalScene.currentBattle.waveIndex > 10 && globalScene.currentBattle.waveIndex > 10 &&
!globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex) !globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex)
) { ) {
globalScene.phaseManager.pushNew("RewardPhase", allRewards.GOLDEN_POKEBALL); globalScene.phaseManager.pushNew("RewardPhase", TrainerItemId.GOLDEN_POKEBALL);
} }
} else { } else {
const superExpWave = !globalScene.gameMode.isEndless ? (globalScene.offsetGym ? 0 : 20) : 10; const superExpWave = !globalScene.gameMode.isEndless ? (globalScene.offsetGym ? 0 : 20) : 10;
if (globalScene.gameMode.isEndless && globalScene.currentBattle.waveIndex === 10) { if (globalScene.gameMode.isEndless && globalScene.currentBattle.waveIndex === 10) {
globalScene.phaseManager.pushNew("RewardPhase", allRewards.EXP_SHARE); globalScene.phaseManager.pushNew("RewardPhase", TrainerItemId.EXP_SHARE);
} }
if ( if (
globalScene.currentBattle.waveIndex <= 750 && globalScene.currentBattle.waveIndex <= 750 &&
@ -90,17 +91,17 @@ export class VictoryPhase extends PokemonPhase {
globalScene.phaseManager.pushNew( globalScene.phaseManager.pushNew(
"RewardPhase", "RewardPhase",
globalScene.currentBattle.waveIndex % 30 !== superExpWave || globalScene.currentBattle.waveIndex > 250 globalScene.currentBattle.waveIndex % 30 !== superExpWave || globalScene.currentBattle.waveIndex > 250
? allRewards.EXP_CHARM ? TrainerItemId.EXP_CHARM
: allRewards.SUPER_EXP_CHARM, : TrainerItemId.SUPER_EXP_CHARM,
); );
} }
if (globalScene.currentBattle.waveIndex <= 150 && !(globalScene.currentBattle.waveIndex % 50)) { 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)) { if (globalScene.gameMode.isEndless && !(globalScene.currentBattle.waveIndex % 50)) {
globalScene.phaseManager.pushNew( globalScene.phaseManager.pushNew(
"RewardPhase", "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"); globalScene.phaseManager.pushNew("AddEnemyTokenPhase");
} }

View File

@ -8,6 +8,7 @@ import { SpeciesId } from "#enums/species-id";
import { TextStyle } from "#enums/text-style"; import { TextStyle } from "#enums/text-style";
import { TrainerItemId } from "#enums/trainer-item-id"; import { TrainerItemId } from "#enums/trainer-item-id";
import { WeatherType } from "#enums/weather-type"; import { WeatherType } from "#enums/weather-type";
import type { SilentReward } from "#types/rewards";
import { addTextObject } from "#ui/text"; import { addTextObject } from "#ui/text";
import type { nil } from "#utils/common"; import type { nil } from "#utils/common";
import { isNullOrUndefined } from "#utils/common"; import { isNullOrUndefined } from "#utils/common";
@ -41,7 +42,7 @@ interface EventMysteryEncounterTier {
interface EventWaveReward { interface EventWaveReward {
wave: number; wave: number;
type: string; type: SilentReward;
} }
type EventMusicReplacement = [string, string]; type EventMusicReplacement = [string, string];
@ -131,10 +132,10 @@ const timedEvents: TimedEvent[] = [
}, },
], ],
classicWaveRewards: [ classicWaveRewards: [
{ wave: 8, type: "SHINY_CHARM" }, { wave: 8, type: TrainerItemId.SHINY_CHARM },
{ wave: 8, type: "ABILITY_CHARM" }, { wave: 8, type: TrainerItemId.ABILITY_CHARM },
{ wave: 8, type: "CATCHING_CHARM" }, { wave: 8, type: TrainerItemId.CATCHING_CHARM },
{ wave: 25, type: "SHINY_CHARM" }, { wave: 25, type: TrainerItemId.SHINY_CHARM },
], ],
}, },
{ {
@ -202,10 +203,10 @@ const timedEvents: TimedEvent[] = [
SpeciesId.BLOODMOON_URSALUNA, SpeciesId.BLOODMOON_URSALUNA,
], ],
classicWaveRewards: [ classicWaveRewards: [
{ wave: 8, type: "SHINY_CHARM" }, { wave: 8, type: TrainerItemId.SHINY_CHARM },
{ wave: 8, type: "ABILITY_CHARM" }, { wave: 8, type: TrainerItemId.ABILITY_CHARM },
{ wave: 8, type: "CATCHING_CHARM" }, { wave: 8, type: TrainerItemId.CATCHING_CHARM },
{ wave: 25, type: "SHINY_CHARM" }, { wave: 25, type: TrainerItemId.SHINY_CHARM },
], ],
}, },
{ {
@ -242,10 +243,10 @@ const timedEvents: TimedEvent[] = [
], ],
luckBoostedSpecies: [SpeciesId.LUVDISC], luckBoostedSpecies: [SpeciesId.LUVDISC],
classicWaveRewards: [ classicWaveRewards: [
{ wave: 8, type: "SHINY_CHARM" }, { wave: 8, type: TrainerItemId.SHINY_CHARM },
{ wave: 8, type: "ABILITY_CHARM" }, { wave: 8, type: TrainerItemId.ABILITY_CHARM },
{ wave: 8, type: "CATCHING_CHARM" }, { wave: 8, type: TrainerItemId.CATCHING_CHARM },
{ wave: 25, type: "SHINY_CHARM" }, { wave: 25, type: TrainerItemId.SHINY_CHARM },
], ],
}, },
{ {
@ -293,10 +294,10 @@ const timedEvents: TimedEvent[] = [
SpeciesId.ETERNAL_FLOETTE, SpeciesId.ETERNAL_FLOETTE,
], ],
classicWaveRewards: [ classicWaveRewards: [
{ wave: 8, type: "SHINY_CHARM" }, { wave: 8, type: TrainerItemId.SHINY_CHARM },
{ wave: 8, type: "ABILITY_CHARM" }, { wave: 8, type: TrainerItemId.ABILITY_CHARM },
{ wave: 8, type: "CATCHING_CHARM" }, { wave: 8, type: TrainerItemId.CATCHING_CHARM },
{ wave: 25, type: "SHINY_CHARM" }, { wave: 25, type: TrainerItemId.SHINY_CHARM },
], ],
}, },
{ {
@ -354,10 +355,10 @@ const timedEvents: TimedEvent[] = [
{ species: SpeciesId.APPLIN }, { species: SpeciesId.APPLIN },
], ],
classicWaveRewards: [ classicWaveRewards: [
{ wave: 8, type: "SHINY_CHARM" }, { wave: 8, type: TrainerItemId.SHINY_CHARM },
{ wave: 8, type: "ABILITY_CHARM" }, { wave: 8, type: TrainerItemId.ABILITY_CHARM },
{ wave: 8, type: "CATCHING_CHARM" }, { wave: 8, type: TrainerItemId.CATCHING_CHARM },
{ wave: 25, type: "SHINY_CHARM" }, { wave: 25, type: TrainerItemId.SHINY_CHARM },
], ],
}, },
{ {
@ -384,10 +385,10 @@ const timedEvents: TimedEvent[] = [
{ species: SpeciesId.ALOLA_MEOWTH }, { species: SpeciesId.ALOLA_MEOWTH },
], ],
classicWaveRewards: [ classicWaveRewards: [
{ wave: 8, type: "SHINY_CHARM" }, { wave: 8, type: TrainerItemId.SHINY_CHARM },
{ wave: 8, type: "ABILITY_CHARM" }, { wave: 8, type: TrainerItemId.ABILITY_CHARM },
{ wave: 8, type: "CATCHING_CHARM" }, { wave: 8, type: TrainerItemId.CATCHING_CHARM },
{ wave: 25, type: "SHINY_CHARM" }, { wave: 25, type: TrainerItemId.SHINY_CHARM },
], ],
}, },
]; ];
@ -571,8 +572,8 @@ export class TimedEventManager {
* @param wave the wave to check for associated allRewards * @param wave the wave to check for associated allRewards
* @returns array of strings of the event modifier reward types * @returns array of strings of the event modifier reward types
*/ */
getFixedBattleEventRewards(wave: number): string[] { getFixedBattleEventRewards(wave: number): SilentReward[] {
const ret: string[] = []; const ret: SilentReward[] = [];
timedEvents timedEvents
.filter(te => this.isActive(te) && !isNullOrUndefined(te.classicWaveRewards)) .filter(te => this.isActive(te) && !isNullOrUndefined(te.classicWaveRewards))
.map(te => { .map(te => {