Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/phases/victory-phase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { modifierTypes } 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 { ModifierTier } from "#enums/modifier-tier";
import { handleMysteryEncounterVictory } from "#mystery-encounters/encounter-phase-utils";
import { PokemonPhase } from "#phases/pokemon-phase";

Expand Down Expand Up @@ -55,11 +56,28 @@ export class VictoryPhase extends PokemonPhase {
switch (currentWaveIndex) {
case ClassicFixedBossWaves.RIVAL_1:
case ClassicFixedBossWaves.RIVAL_2:
case ClassicFixedBossWaves.RIVAL_3:
case ClassicFixedBossWaves.RIVAL_4:
case ClassicFixedBossWaves.RIVAL_5:
case ClassicFixedBossWaves.RIVAL_6: {
// Get event modifiers for this wave
timedEventManager
.getFixedBattleEventRewards(currentWaveIndex)
.map(r => globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes[r]));
const fixedRewards = timedEventManager.getFixedBattleEventRewards(currentWaveIndex);

for (const fixedReward of fixedRewards) {
let reward = fixedReward;
const existingItem = globalScene.modifiers.find(m => m.type.id === reward);
if (existingItem && existingItem.getStackCount() + 1 >= existingItem.getMaxStackCount()) {
const tier = existingItem.type.getOrInferTier();
if (!tier) {
console.warn(`Modifier ${reward} is at max stacks but has no tier.`);
break;
}
reward = `${ModifierTier[tier]}_BALL` as keyof typeof modifierTypes;
}
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes[reward]);
}
break;
}
case ClassicFixedBossWaves.EVIL_BOSS_2:
// Should get Lock Capsule on 165 before shop phase so it can be used in the rewards shop
globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.LOCK_CAPSULE);
Expand Down
Loading