diff --git a/src/@types/held-modifier-config.ts b/src/@types/held-modifier-config.ts deleted file mode 100644 index 5617cf2446a..00000000000 --- a/src/@types/held-modifier-config.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { PokemonHeldItemModifierType } from "#app/modifier/modifier-type"; -import type { PokemonHeldItemModifier } from "#app/modifier/modifier"; - -export default interface HeldModifierConfig { - modifier: PokemonHeldItemModifierType | PokemonHeldItemModifier; - stackCount?: number; - isTransferable?: boolean; -} diff --git a/src/data/mystery-encounters/encounters/an-offer-you-cant-refuse-encounter.ts b/src/data/mystery-encounters/encounters/an-offer-you-cant-refuse-encounter.ts index 37ddeaea3d2..89cfa1f0d79 100644 --- a/src/data/mystery-encounters/encounters/an-offer-you-cant-refuse-encounter.ts +++ b/src/data/mystery-encounters/encounters/an-offer-you-cant-refuse-encounter.ts @@ -137,7 +137,7 @@ export const AnOfferYouCantRefuseEncounter: MysteryEncounter = MysteryEncounterB }) .withOptionPhase(async () => { // Give the player a Shiny Charm - globalScene.phaseManager.unshiftNew("ModifierRewardPhase", modifierTypes.SHINY_CHARM); + globalScene.phaseManager.unshiftNew("RewardPhase", modifierTypes.SHINY_CHARM); leaveEncounterWithoutBattle(true); }) .build(), diff --git a/src/data/mystery-encounters/encounters/dark-deal-encounter.ts b/src/data/mystery-encounters/encounters/dark-deal-encounter.ts index 236b4fad9d7..166baef2537 100644 --- a/src/data/mystery-encounters/encounters/dark-deal-encounter.ts +++ b/src/data/mystery-encounters/encounters/dark-deal-encounter.ts @@ -163,7 +163,7 @@ export const DarkDealEncounter: MysteryEncounter = MysteryEncounterBuilder.withE .withOptionPhase(async () => { // Give the player 5 Rogue Balls const encounter = globalScene.currentBattle.mysteryEncounter!; - globalScene.phaseManager.unshiftNew("ModifierRewardPhase", modifierTypes.ROGUE_BALL); + globalScene.phaseManager.unshiftNew("RewardPhase", modifierTypes.ROGUE_BALL); // Start encounter with random legendary (7-10 starter strength) that has level additive // If this is a mono-type challenge, always ensure the required type is filtered for diff --git a/src/data/mystery-encounters/encounters/delibirdy-encounter.ts b/src/data/mystery-encounters/encounters/delibirdy-encounter.ts index 92c6dfaf761..c8e6433f285 100644 --- a/src/data/mystery-encounters/encounters/delibirdy-encounter.ts +++ b/src/data/mystery-encounters/encounters/delibirdy-encounter.ts @@ -63,10 +63,10 @@ const doEventReward = () => { return !fullStack; }); if (candidates.length > 0) { - globalScene.phaseManager.unshiftNew("ModifierRewardPhase", modifierTypes[randSeedItem(candidates)]); + globalScene.phaseManager.unshiftNew("RewardPhase", modifierTypes[randSeedItem(candidates)]); } else { // At max stacks, give a Voucher instead - globalScene.phaseManager.unshiftNew("ModifierRewardPhase", modifierTypes.VOUCHER); + globalScene.phaseManager.unshiftNew("RewardPhase", modifierTypes.VOUCHER); } } }; @@ -170,7 +170,7 @@ export const DelibirdyEncounter: MysteryEncounter = MysteryEncounterBuilder.with // At max stacks, give the first party pokemon a Shell Bell instead backupOption(); } else { - globalScene.phaseManager.unshiftNew("ModifierRewardPhase", modifierTypes.AMULET_COIN); + globalScene.phaseManager.unshiftNew("RewardPhase", modifierTypes.AMULET_COIN); doEventReward(); } @@ -240,7 +240,7 @@ export const DelibirdyEncounter: MysteryEncounter = MysteryEncounterBuilder.with // At max stacks, give the first party pokemon a Shell Bell instead backupOption(); } else { - globalScene.phaseManager.unshiftNew("ModifierRewardPhase", modifierTypes.CANDY_JAR); + globalScene.phaseManager.unshiftNew("RewardPhase", modifierTypes.CANDY_JAR); doEventReward(); } } else { @@ -251,7 +251,7 @@ export const DelibirdyEncounter: MysteryEncounter = MysteryEncounterBuilder.with // At max stacks, give the first party pokemon a Shell Bell instead backupOption(); } else { - globalScene.phaseManager.unshiftNew("ModifierRewardPhase", modifierTypes.BERRY_POUCH); + globalScene.phaseManager.unshiftNew("RewardPhase", modifierTypes.BERRY_POUCH); doEventReward(); } } @@ -323,7 +323,7 @@ export const DelibirdyEncounter: MysteryEncounter = MysteryEncounterBuilder.with // At max stacks, give the first party pokemon a Shell Bell instead backupOption(); } else { - globalScene.phaseManager.unshiftNew("ModifierRewardPhase", modifierTypes.HEALING_CHARM); + globalScene.phaseManager.unshiftNew("RewardPhase", modifierTypes.HEALING_CHARM); doEventReward(); } diff --git a/src/phase-manager.ts b/src/phase-manager.ts index a4256f110ef..ebfdff6bbe6 100644 --- a/src/phase-manager.ts +++ b/src/phase-manager.ts @@ -26,7 +26,7 @@ import { EvolutionPhase } from "#app/phases/evolution-phase"; import { ExpPhase } from "#app/phases/exp-phase"; import { FaintPhase } from "#app/phases/faint-phase"; import { FormChangePhase } from "#app/phases/form-change-phase"; -import { GameOverModifierRewardPhase } from "#app/phases/game-over-modifier-reward-phase"; +import { GameOverRewardPhase } from "#app/phases/game-over-reward-phase"; import { GameOverPhase } from "#app/phases/game-over-phase"; import { HideAbilityPhase } from "#app/phases/hide-ability-phase"; import { HidePartyExpBarPhase } from "#app/phases/hide-party-exp-bar-phase"; @@ -36,7 +36,7 @@ import { LevelUpPhase } from "#app/phases/level-up-phase"; import { LoadMoveAnimPhase } from "#app/phases/load-move-anim-phase"; import { LoginPhase } from "#app/phases/login-phase"; import { MessagePhase } from "#app/phases/message-phase"; -import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase"; +import { RewardPhase } from "#app/phases/reward-phase"; import { MoneyRewardPhase } from "#app/phases/money-reward-phase"; import { MoveAnimPhase } from "#app/phases/move-anim-phase"; import { MoveChargePhase } from "#app/phases/move-charge-phase"; @@ -70,7 +70,7 @@ import { ReloadSessionPhase } from "#app/phases/reload-session-phase"; import { ResetStatusPhase } from "#app/phases/reset-status-phase"; import { ReturnPhase } from "#app/phases/return-phase"; import { RevivalBlessingPhase } from "#app/phases/revival-blessing-phase"; -import { RibbonModifierRewardPhase } from "#app/phases/ribbon-modifier-reward-phase"; +import { RibbonRewardPhase } from "#app/phases/ribbon-reward-phase"; import { ScanIvsPhase } from "#app/phases/scan-ivs-phase"; import { SelectBiomePhase } from "#app/phases/select-biome-phase"; import { SelectChallengePhase } from "#app/phases/select-challenge-phase"; @@ -138,7 +138,7 @@ const PHASES = Object.freeze({ FaintPhase, FormChangePhase, GameOverPhase, - GameOverModifierRewardPhase, + GameOverRewardPhase, HideAbilityPhase, HidePartyExpBarPhase, LearnMovePhase, @@ -147,7 +147,7 @@ const PHASES = Object.freeze({ LoadMoveAnimPhase, LoginPhase, MessagePhase, - ModifierRewardPhase, + RewardPhase, MoneyRewardPhase, MoveAnimPhase, MoveChargePhase, @@ -178,7 +178,7 @@ const PHASES = Object.freeze({ ResetStatusPhase, ReturnPhase, RevivalBlessingPhase, - RibbonModifierRewardPhase, + RibbonRewardPhase, ScanIvsPhase, SelectBiomePhase, SelectChallengePhase, diff --git a/src/phases/game-over-phase.ts b/src/phases/game-over-phase.ts index eaee1e7da23..4899a9bdc7d 100644 --- a/src/phases/game-over-phase.ts +++ b/src/phases/game-over-phase.ts @@ -151,10 +151,10 @@ export class GameOverPhase extends BattlePhase { this.handleUnlocks(); for (const species of this.firstRibbons) { - globalScene.phaseManager.unshiftNew("RibbonModifierRewardPhase", modifierTypes.VOUCHER_PLUS, species); + globalScene.phaseManager.unshiftNew("RibbonRewardPhase", modifierTypes.VOUCHER_PLUS, species); } if (!firstClear) { - globalScene.phaseManager.unshiftNew("GameOverModifierRewardPhase", modifierTypes.VOUCHER_PREMIUM); + globalScene.phaseManager.unshiftNew("GameOverRewardPhase", modifierTypes.VOUCHER_PREMIUM); } } this.getRunHistoryEntry().then(runHistoryEntry => { diff --git a/src/phases/game-over-modifier-reward-phase.ts b/src/phases/game-over-reward-phase.ts similarity index 81% rename from src/phases/game-over-modifier-reward-phase.ts rename to src/phases/game-over-reward-phase.ts index 13c8f48abad..f29ac28a116 100644 --- a/src/phases/game-over-modifier-reward-phase.ts +++ b/src/phases/game-over-reward-phase.ts @@ -1,10 +1,10 @@ import { globalScene } from "#app/global-scene"; import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; -import { ModifierRewardPhase } from "./modifier-reward-phase"; +import { RewardPhase } from "./reward-phase"; -export class GameOverModifierRewardPhase extends ModifierRewardPhase { - public readonly phaseName = "GameOverModifierRewardPhase"; +export class GameOverRewardPhase extends RewardPhase { + public readonly phaseName = "GameOverRewardPhase"; doReward(): Promise { return new Promise(resolve => { const newModifier = this.modifierType.newModifier(); diff --git a/src/phases/modifier-reward-phase.ts b/src/phases/reward-phase.ts similarity index 80% rename from src/phases/modifier-reward-phase.ts rename to src/phases/reward-phase.ts index 18f0ba0ea17..65a301cb1f2 100644 --- a/src/phases/modifier-reward-phase.ts +++ b/src/phases/reward-phase.ts @@ -5,11 +5,10 @@ import { getModifierType } from "#app/utils/modifier-utils"; import i18next from "i18next"; import { BattlePhase } from "./battle-phase"; -export class ModifierRewardPhase extends BattlePhase { - // RibbonModifierRewardPhase extends ModifierRewardPhase and to make typescript happy +export class RewardPhase extends BattlePhase { + // RibbonRewardPhase extends RewardPhase and to make typescript happy // we need to use a union type here - public readonly phaseName: "ModifierRewardPhase" | "RibbonModifierRewardPhase" | "GameOverModifierRewardPhase" = - "ModifierRewardPhase"; + public readonly phaseName: "RewardPhase" | "RibbonRewardPhase" | "GameOverRewardPhase" = "RewardPhase"; protected modifierType: ModifierType; constructor(modifierTypeFunc: ModifierTypeFunc) { diff --git a/src/phases/ribbon-modifier-reward-phase.ts b/src/phases/ribbon-reward-phase.ts similarity index 84% rename from src/phases/ribbon-modifier-reward-phase.ts rename to src/phases/ribbon-reward-phase.ts index 10d63ba707f..cbd03c3d067 100644 --- a/src/phases/ribbon-modifier-reward-phase.ts +++ b/src/phases/ribbon-reward-phase.ts @@ -3,10 +3,10 @@ import type PokemonSpecies from "#app/data/pokemon-species"; import type { ModifierTypeFunc } from "#app/@types/modifier-types"; import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; -import { ModifierRewardPhase } from "./modifier-reward-phase"; +import { RewardPhase } from "./reward-phase"; -export class RibbonModifierRewardPhase extends ModifierRewardPhase { - public readonly phaseName = "RibbonModifierRewardPhase"; +export class RibbonRewardPhase extends RewardPhase { + public readonly phaseName = "RibbonRewardPhase"; private species: PokemonSpecies; constructor(modifierTypeFunc: ModifierTypeFunc, species: PokemonSpecies) { diff --git a/src/phases/trainer-item-reward-phase.ts b/src/phases/trainer-item-reward-phase.ts index 29bbe215fc0..31aa93612de 100644 --- a/src/phases/trainer-item-reward-phase.ts +++ b/src/phases/trainer-item-reward-phase.ts @@ -5,11 +5,10 @@ import { getModifierType } from "#app/utils/modifier-utils"; import i18next from "i18next"; import { BattlePhase } from "./battle-phase"; -export class ModifierRewardPhase extends BattlePhase { - // RibbonModifierRewardPhase extends ModifierRewardPhase and to make typescript happy +export class RewardPhase extends BattlePhase { + // RibbonRewardPhase extends RewardPhase and to make typescript happy // we need to use a union type here - public readonly phaseName: "ModifierRewardPhase" | "RibbonModifierRewardPhase" | "GameOverModifierRewardPhase" = - "ModifierRewardPhase"; + public readonly phaseName: "RewardPhase" | "RibbonRewardPhase" | "GameOverRewardPhase" = "RewardPhase"; protected modifierType: ModifierType; constructor(modifierTypeFunc: ModifierTypeFunc) { diff --git a/src/phases/trainer-victory-phase.ts b/src/phases/trainer-victory-phase.ts index 554b8109f02..392ceadc00d 100644 --- a/src/phases/trainer-victory-phase.ts +++ b/src/phases/trainer-victory-phase.ts @@ -22,7 +22,7 @@ export class TrainerVictoryPhase extends BattlePhase { const modifierRewardFuncs = globalScene.currentBattle.trainer?.config.modifierRewardFuncs!; // TODO: is this bang correct? for (const modifierRewardFunc of modifierRewardFuncs) { - globalScene.phaseManager.unshiftNew("ModifierRewardPhase", modifierRewardFunc); + globalScene.phaseManager.unshiftNew("RewardPhase", modifierRewardFunc); } const trainerType = globalScene.currentBattle.trainer?.config.trainerType!; // TODO: is this bang correct? @@ -34,7 +34,7 @@ export class TrainerVictoryPhase extends BattlePhase { ) { if (timedEventManager.getUpgradeUnlockedVouchers()) { globalScene.phaseManager.unshiftNew( - "ModifierRewardPhase", + "RewardPhase", [ modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PLUS, @@ -44,7 +44,7 @@ export class TrainerVictoryPhase extends BattlePhase { ); } else { globalScene.phaseManager.unshiftNew( - "ModifierRewardPhase", + "RewardPhase", [modifierTypes.VOUCHER, modifierTypes.VOUCHER, modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PREMIUM][ vouchers[TrainerType[trainerType]].voucherType ], diff --git a/src/phases/victory-phase.ts b/src/phases/victory-phase.ts index ae5b727c2a6..663d7d9b90c 100644 --- a/src/phases/victory-phase.ts +++ b/src/phases/victory-phase.ts @@ -55,11 +55,11 @@ export class VictoryPhase extends PokemonPhase { // Get event modifiers for this wave timedEventManager .getFixedBattleEventRewards(globalScene.currentBattle.waveIndex) - .map(r => globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes[r])); + .map(r => globalScene.phaseManager.pushNew("RewardPhase", modifierTypes[r])); 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); + globalScene.phaseManager.pushNew("RewardPhase", modifierTypes.LOCK_CAPSULE); break; } } @@ -71,35 +71,35 @@ export class VictoryPhase extends PokemonPhase { this.getFixedBattleCustomModifiers(), ); } else if (globalScene.gameMode.isDaily) { - globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.EXP_CHARM); + globalScene.phaseManager.pushNew("RewardPhase", modifierTypes.EXP_CHARM); if ( globalScene.currentBattle.waveIndex > 10 && !globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex) ) { - globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.GOLDEN_POKEBALL); + globalScene.phaseManager.pushNew("RewardPhase", modifierTypes.GOLDEN_POKEBALL); } } else { const superExpWave = !globalScene.gameMode.isEndless ? (globalScene.offsetGym ? 0 : 20) : 10; if (globalScene.gameMode.isEndless && globalScene.currentBattle.waveIndex === 10) { - globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.EXP_SHARE); + globalScene.phaseManager.pushNew("RewardPhase", modifierTypes.EXP_SHARE); } if ( globalScene.currentBattle.waveIndex <= 750 && (globalScene.currentBattle.waveIndex <= 500 || globalScene.currentBattle.waveIndex % 30 === superExpWave) ) { globalScene.phaseManager.pushNew( - "ModifierRewardPhase", + "RewardPhase", globalScene.currentBattle.waveIndex % 30 !== superExpWave || globalScene.currentBattle.waveIndex > 250 ? modifierTypes.EXP_CHARM : modifierTypes.SUPER_EXP_CHARM, ); } if (globalScene.currentBattle.waveIndex <= 150 && !(globalScene.currentBattle.waveIndex % 50)) { - globalScene.phaseManager.pushNew("ModifierRewardPhase", modifierTypes.GOLDEN_POKEBALL); + globalScene.phaseManager.pushNew("RewardPhase", modifierTypes.GOLDEN_POKEBALL); } if (globalScene.gameMode.isEndless && !(globalScene.currentBattle.waveIndex % 50)) { globalScene.phaseManager.pushNew( - "ModifierRewardPhase", + "RewardPhase", !(globalScene.currentBattle.waveIndex % 250) ? modifierTypes.VOUCHER_PREMIUM : modifierTypes.VOUCHER_PLUS, ); globalScene.phaseManager.pushNew("AddEnemyBuffModifierPhase"); diff --git a/test/phases/game-over-phase.test.ts b/test/phases/game-over-phase.test.ts index 008f9fb68e8..7b8e95f7de2 100644 --- a/test/phases/game-over-phase.test.ts +++ b/test/phases/game-over-phase.test.ts @@ -53,7 +53,7 @@ describe("Game Over Phase", () => { // so the best we can do is to check that their reward phases occurred. expect(game.phaseInterceptor.log.includes("GameOverPhase")).toBe(true); expect(game.phaseInterceptor.log.includes("UnlockPhase")).toBe(true); - expect(game.phaseInterceptor.log.includes("RibbonModifierRewardPhase")).toBe(true); + expect(game.phaseInterceptor.log.includes("RibbonRewardPhase")).toBe(true); expect(game.scene.gameData.unlocks[Unlockables.ENDLESS_MODE]).toBe(true); expect(game.scene.validateAchv).toHaveBeenCalledWith(achvs.CLASSIC_VICTORY); expect(game.scene.gameData.achvUnlocks[achvs.CLASSIC_VICTORY.id]).toBeTruthy(); @@ -68,8 +68,8 @@ describe("Game Over Phase", () => { expect(game.phaseInterceptor.log.includes("GameOverPhase")).toBe(true); expect(game.phaseInterceptor.log.includes("UnlockPhase")).toBe(false); - expect(game.phaseInterceptor.log.includes("RibbonModifierRewardPhase")).toBe(false); - expect(game.phaseInterceptor.log.includes("GameOverModifierRewardPhase")).toBe(false); + expect(game.phaseInterceptor.log.includes("RibbonRewardPhase")).toBe(false); + expect(game.phaseInterceptor.log.includes("GameOverRewardPhase")).toBe(false); expect(game.scene.gameData.unlocks[Unlockables.ENDLESS_MODE]).toBe(false); expect(game.scene.validateAchv).not.toHaveBeenCalledWith(achvs.CLASSIC_VICTORY); expect(game.scene.gameData.achvUnlocks[achvs.CLASSIC_VICTORY.id]).toBeFalsy(); diff --git a/test/testUtils/phaseInterceptor.ts b/test/testUtils/phaseInterceptor.ts index 9d046fc85ba..9e0f5774eea 100644 --- a/test/testUtils/phaseInterceptor.ts +++ b/test/testUtils/phaseInterceptor.ts @@ -53,12 +53,12 @@ import { MysteryEncounterRewardsPhase, PostMysteryEncounterPhase, } from "#app/phases/mystery-encounter-phases"; -import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase"; +import { RewardPhase } from "#app/phases/reward-phase"; import { PartyExpPhase } from "#app/phases/party-exp-phase"; import { ExpPhase } from "#app/phases/exp-phase"; import { GameOverPhase } from "#app/phases/game-over-phase"; -import { RibbonModifierRewardPhase } from "#app/phases/ribbon-modifier-reward-phase"; -import { GameOverModifierRewardPhase } from "#app/phases/game-over-modifier-reward-phase"; +import { RibbonRewardPhase } from "#app/phases/ribbon-reward-phase"; +import { GameOverRewardPhase } from "#app/phases/game-over-reward-phase"; import { UnlockPhase } from "#app/phases/unlock-phase"; import { PostGameOverPhase } from "#app/phases/post-game-over-phase"; import { RevivalBlessingPhase } from "#app/phases/revival-blessing-phase"; @@ -147,9 +147,9 @@ export default class PhaseInterceptor { [MysteryEncounterBattlePhase, this.startPhase], [MysteryEncounterRewardsPhase, this.startPhase], [PostMysteryEncounterPhase, this.startPhase], - [RibbonModifierRewardPhase, this.startPhase], - [GameOverModifierRewardPhase, this.startPhase], - [ModifierRewardPhase, this.startPhase], + [RibbonRewardPhase, this.startPhase], + [GameOverRewardPhase, this.startPhase], + [RewardPhase, this.startPhase], [PartyExpPhase, this.startPhase], [ExpPhase, this.startPhase], [EncounterPhase, this.startPhase],