Renamed various ModifierRewardPhase classes

This commit is contained in:
Wlowscha 2025-07-12 17:20:27 +02:00
parent 2344bdf32a
commit 5b14a5899c
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
14 changed files with 48 additions and 58 deletions

View File

@ -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;
}

View File

@ -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(),

View File

@ -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

View File

@ -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();
}

View File

@ -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,

View File

@ -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 => {

View File

@ -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<void> {
return new Promise<void>(resolve => {
const newModifier = this.modifierType.newModifier();

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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
],

View File

@ -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");

View File

@ -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();

View File

@ -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],