mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-09 00:49:27 +02:00
Rename SelectModifierPhase to SelectRewardPhase
This commit is contained in:
parent
5b14a5899c
commit
0d2bae0fcc
@ -745,7 +745,7 @@ export function setEncounterRewards(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (customShopRewards) {
|
if (customShopRewards) {
|
||||||
globalScene.phaseManager.unshiftNew("SelectModifierPhase", 0, undefined, customShopRewards);
|
globalScene.phaseManager.unshiftNew("SelectRewardPhase", 0, undefined, customShopRewards);
|
||||||
} else {
|
} else {
|
||||||
globalScene.phaseManager.tryRemovePhase(p => p.is("MysteryEncounterRewardsPhase"));
|
globalScene.phaseManager.tryRemovePhase(p => p.is("MysteryEncounterRewardsPhase"));
|
||||||
}
|
}
|
||||||
|
@ -1677,7 +1677,7 @@ export function getModifierTypeFuncById(id: string): ModifierTypeFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates modifier options for a {@linkcode SelectModifierPhase}
|
* Generates modifier options for a {@linkcode SelectRewardPhase}
|
||||||
* @param count - Determines the number of items to generate
|
* @param count - Determines the number of items to generate
|
||||||
* @param party - Party is required for generating proper modifier pools
|
* @param party - Party is required for generating proper modifier pools
|
||||||
* @param modifierTiers - (Optional) If specified, rolls items in the specified tiers. Commonly used for tier-locking with Lock Capsule.
|
* @param modifierTiers - (Optional) If specified, rolls items in the specified tiers. Commonly used for tier-locking with Lock Capsule.
|
||||||
|
@ -75,7 +75,7 @@ import { ScanIvsPhase } from "#app/phases/scan-ivs-phase";
|
|||||||
import { SelectBiomePhase } from "#app/phases/select-biome-phase";
|
import { SelectBiomePhase } from "#app/phases/select-biome-phase";
|
||||||
import { SelectChallengePhase } from "#app/phases/select-challenge-phase";
|
import { SelectChallengePhase } from "#app/phases/select-challenge-phase";
|
||||||
import { SelectGenderPhase } from "#app/phases/select-gender-phase";
|
import { SelectGenderPhase } from "#app/phases/select-gender-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { SelectStarterPhase } from "#app/phases/select-starter-phase";
|
import { SelectStarterPhase } from "#app/phases/select-starter-phase";
|
||||||
import { SelectTargetPhase } from "#app/phases/select-target-phase";
|
import { SelectTargetPhase } from "#app/phases/select-target-phase";
|
||||||
import { ShinySparklePhase } from "#app/phases/shiny-sparkle-phase";
|
import { ShinySparklePhase } from "#app/phases/shiny-sparkle-phase";
|
||||||
@ -183,7 +183,7 @@ const PHASES = Object.freeze({
|
|||||||
SelectBiomePhase,
|
SelectBiomePhase,
|
||||||
SelectChallengePhase,
|
SelectChallengePhase,
|
||||||
SelectGenderPhase,
|
SelectGenderPhase,
|
||||||
SelectModifierPhase,
|
SelectRewardPhase,
|
||||||
SelectStarterPhase,
|
SelectStarterPhase,
|
||||||
SelectTargetPhase,
|
SelectTargetPhase,
|
||||||
ShinySparklePhase,
|
ShinySparklePhase,
|
||||||
|
@ -187,7 +187,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
pokemon.usedTMs = [];
|
pokemon.usedTMs = [];
|
||||||
}
|
}
|
||||||
pokemon.usedTMs.push(this.moveId);
|
pokemon.usedTMs.push(this.moveId);
|
||||||
globalScene.phaseManager.tryRemovePhase(phase => phase.is("SelectModifierPhase"));
|
globalScene.phaseManager.tryRemovePhase(phase => phase.is("SelectRewardPhase"));
|
||||||
} else if (this.learnMoveType === LearnMoveType.MEMORY) {
|
} else if (this.learnMoveType === LearnMoveType.MEMORY) {
|
||||||
if (this.cost !== -1) {
|
if (this.cost !== -1) {
|
||||||
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||||
@ -197,7 +197,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
}
|
}
|
||||||
globalScene.playSound("se/buy");
|
globalScene.playSound("se/buy");
|
||||||
} else {
|
} else {
|
||||||
globalScene.phaseManager.tryRemovePhase(phase => phase.is("SelectModifierPhase"));
|
globalScene.phaseManager.tryRemovePhase(phase => phase.is("SelectRewardPhase"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pokemon.setMove(index, this.moveId);
|
pokemon.setMove(index, this.moveId);
|
||||||
|
@ -551,8 +551,8 @@ export class MysteryEncounterRewardsPhase extends Phase {
|
|||||||
if (encounter.doEncounterRewards) {
|
if (encounter.doEncounterRewards) {
|
||||||
encounter.doEncounterRewards();
|
encounter.doEncounterRewards();
|
||||||
} else if (this.addHealPhase) {
|
} else if (this.addHealPhase) {
|
||||||
globalScene.phaseManager.tryRemovePhase(p => p.is("SelectModifierPhase"));
|
globalScene.phaseManager.tryRemovePhase(p => p.is("SelectRewardPhase"));
|
||||||
globalScene.phaseManager.unshiftNew("SelectModifierPhase", 0, undefined, {
|
globalScene.phaseManager.unshiftNew("SelectRewardPhase", 0, undefined, {
|
||||||
fillRemaining: false,
|
fillRemaining: false,
|
||||||
rerollMultiplier: -1,
|
rerollMultiplier: -1,
|
||||||
});
|
});
|
||||||
|
@ -31,8 +31,8 @@ import { TrainerItemEffect } from "#app/items/trainer-item";
|
|||||||
|
|
||||||
export type ModifierSelectCallback = (rowCursor: number, cursor: number) => boolean;
|
export type ModifierSelectCallback = (rowCursor: number, cursor: number) => boolean;
|
||||||
|
|
||||||
export class SelectModifierPhase extends BattlePhase {
|
export class SelectRewardPhase extends BattlePhase {
|
||||||
public readonly phaseName = "SelectModifierPhase";
|
public readonly phaseName = "SelectRewardPhase";
|
||||||
private rerollCount: number;
|
private rerollCount: number;
|
||||||
private modifierTiers?: RewardTier[];
|
private modifierTiers?: RewardTier[];
|
||||||
private customModifierSettings?: CustomModifierSettings;
|
private customModifierSettings?: CustomModifierSettings;
|
||||||
@ -199,7 +199,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
globalScene.reroll = true;
|
globalScene.reroll = true;
|
||||||
globalScene.phaseManager.unshiftNew(
|
globalScene.phaseManager.unshiftNew(
|
||||||
"SelectModifierPhase",
|
"SelectRewardPhase",
|
||||||
this.rerollCount + 1,
|
this.rerollCount + 1,
|
||||||
this.typeOptions.map(o => o.type?.tier).filter(t => t !== undefined) as RewardTier[],
|
this.typeOptions.map(o => o.type?.tier).filter(t => t !== undefined) as RewardTier[],
|
||||||
);
|
);
|
||||||
@ -288,7 +288,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
globalScene.animateMoneyChanged(false);
|
globalScene.animateMoneyChanged(false);
|
||||||
}
|
}
|
||||||
globalScene.playSound("se/buy");
|
globalScene.playSound("se/buy");
|
||||||
(globalScene.ui.getHandler() as ModifierSelectUiHandler).updateCostText();
|
(globalScene.ui.getHandler() as RewardSelectUiHandler).updateCostText();
|
||||||
} else {
|
} else {
|
||||||
globalScene.ui.playError();
|
globalScene.ui.playError();
|
||||||
}
|
}
|
||||||
@ -491,9 +491,9 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
copy(): SelectModifierPhase {
|
copy(): SelectRewardPhase {
|
||||||
return globalScene.phaseManager.create(
|
return globalScene.phaseManager.create(
|
||||||
"SelectModifierPhase",
|
"SelectRewardPhase",
|
||||||
this.rerollCount,
|
this.rerollCount,
|
||||||
this.modifierTiers,
|
this.modifierTiers,
|
||||||
{
|
{
|
@ -65,7 +65,7 @@ export class VictoryPhase extends PokemonPhase {
|
|||||||
}
|
}
|
||||||
if (globalScene.currentBattle.waveIndex % 10) {
|
if (globalScene.currentBattle.waveIndex % 10) {
|
||||||
globalScene.phaseManager.pushNew(
|
globalScene.phaseManager.pushNew(
|
||||||
"SelectModifierPhase",
|
"SelectRewardPhase",
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
this.getFixedBattleCustomModifiers(),
|
this.getFixedBattleCustomModifiers(),
|
||||||
@ -124,7 +124,7 @@ export class VictoryPhase extends PokemonPhase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* If this wave is a fixed battle with special custom modifier rewards,
|
* If this wave is a fixed battle with special custom modifier rewards,
|
||||||
* will pass those settings to the upcoming {@linkcode SelectModifierPhase}`.
|
* will pass those settings to the upcoming {@linkcode SelectRewardPhase}`.
|
||||||
*/
|
*/
|
||||||
getFixedBattleCustomModifiers(): CustomModifierSettings | undefined {
|
getFixedBattleCustomModifiers(): CustomModifierSettings | undefined {
|
||||||
const gameMode = globalScene.gameMode;
|
const gameMode = globalScene.gameMode;
|
||||||
|
@ -125,7 +125,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||||||
const ui = this.getUi();
|
const ui = this.getUi();
|
||||||
this.excludedMenus = () => [
|
this.excludedMenus = () => [
|
||||||
{
|
{
|
||||||
condition: !!globalScene.phaseManager.getCurrentPhase()?.is("SelectModifierPhase"),
|
condition: !!globalScene.phaseManager.getCurrentPhase()?.is("SelectRewardPhase"),
|
||||||
options: [MenuOptions.EGG_GACHA],
|
options: [MenuOptions.EGG_GACHA],
|
||||||
},
|
},
|
||||||
{ condition: bypassLogin, options: [MenuOptions.LOG_OUT] },
|
{ condition: bypassLogin, options: [MenuOptions.LOG_OUT] },
|
||||||
|
@ -737,7 +737,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
// TODO: This risks hitting the other options (.MOVE_i and ALL) so does it? Do we need an extra check?
|
// TODO: This risks hitting the other options (.MOVE_i and ALL) so does it? Do we need an extra check?
|
||||||
if (
|
if (
|
||||||
option >= PartyOption.FORM_CHANGE_ITEM &&
|
option >= PartyOption.FORM_CHANGE_ITEM &&
|
||||||
globalScene.phaseManager.getCurrentPhase()?.is("SelectModifierPhase") &&
|
globalScene.phaseManager.getCurrentPhase()?.is("SelectRewardPhase") &&
|
||||||
this.partyUiMode === PartyUiMode.CHECK
|
this.partyUiMode === PartyUiMode.CHECK
|
||||||
) {
|
) {
|
||||||
const formChangeItems = this.getFormChangeItems(pokemon);
|
const formChangeItems = this.getFormChangeItems(pokemon);
|
||||||
@ -1309,7 +1309,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
this.addCommonOptions(pokemon);
|
this.addCommonOptions(pokemon);
|
||||||
break;
|
break;
|
||||||
case PartyUiMode.CHECK:
|
case PartyUiMode.CHECK:
|
||||||
if (globalScene.phaseManager.getCurrentPhase()?.is("SelectModifierPhase")) {
|
if (globalScene.phaseManager.getCurrentPhase()?.is("SelectRewardPhase")) {
|
||||||
const formChangeItems = this.getFormChangeItems(pokemon);
|
const formChangeItems = this.getFormChangeItems(pokemon);
|
||||||
for (let i = 0; i < formChangeItems.length; i++) {
|
for (let i = 0; i < formChangeItems.length; i++) {
|
||||||
this.options.push(PartyOption.FORM_CHANGE_ITEM + i);
|
this.options.push(PartyOption.FORM_CHANGE_ITEM + i);
|
||||||
|
@ -6,7 +6,7 @@ import PartyUiHandler from "./party-ui-handler";
|
|||||||
import FightUiHandler from "./fight-ui-handler";
|
import FightUiHandler from "./fight-ui-handler";
|
||||||
import MessageUiHandler from "./message-ui-handler";
|
import MessageUiHandler from "./message-ui-handler";
|
||||||
import ConfirmUiHandler from "./confirm-ui-handler";
|
import ConfirmUiHandler from "./confirm-ui-handler";
|
||||||
import RewardSelectUiHandler from "./modifier-select-ui-handler";
|
import RewardSelectUiHandler from "./reward-select-ui-handler";
|
||||||
import BallUiHandler from "./ball-ui-handler";
|
import BallUiHandler from "./ball-ui-handler";
|
||||||
import SummaryUiHandler from "./summary-ui-handler";
|
import SummaryUiHandler from "./summary-ui-handler";
|
||||||
import StarterSelectUiHandler from "./starter-select-ui-handler";
|
import StarterSelectUiHandler from "./starter-select-ui-handler";
|
||||||
|
@ -547,7 +547,7 @@ describe("Abilities - Wimp Out", () => {
|
|||||||
await game.move.selectEnemyMove(MoveId.SPLASH);
|
await game.move.selectEnemyMove(MoveId.SPLASH);
|
||||||
await game.move.selectEnemyMove(MoveId.ENDURE);
|
await game.move.selectEnemyMove(MoveId.ENDURE);
|
||||||
|
|
||||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
await game.phaseInterceptor.to("SelectRewardPhase");
|
||||||
expect(game.scene.currentBattle.waveIndex).toBe(wave + 1);
|
expect(game.scene.currentBattle.waveIndex).toBe(wave + 1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -93,7 +93,7 @@ describe("Test Battle Phase", () => {
|
|||||||
game.override.enemySpecies(SpeciesId.RATTATA).startingLevel(2000).battleStyle("single").startingWave(3);
|
game.override.enemySpecies(SpeciesId.RATTATA).startingLevel(2000).battleStyle("single").startingWave(3);
|
||||||
await game.classicMode.startBattle([SpeciesId.MEWTWO]);
|
await game.classicMode.startBattle([SpeciesId.MEWTWO]);
|
||||||
game.move.use(MoveId.TACKLE);
|
game.move.use(MoveId.TACKLE);
|
||||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
await game.phaseInterceptor.to("SelectRewardPhase");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("do attack wave 3 - single battle - regular - NO OHKO with opponent using non damage attack", async () => {
|
it("do attack wave 3 - single battle - regular - NO OHKO with opponent using non damage attack", async () => {
|
||||||
|
@ -76,7 +76,7 @@ describe("Shop modifications", async () => {
|
|||||||
game.move.select(MoveId.SPLASH);
|
game.move.select(MoveId.SPLASH);
|
||||||
await game.doKillOpponents();
|
await game.doKillOpponents();
|
||||||
await game.phaseInterceptor.to("BattleEndPhase");
|
await game.phaseInterceptor.to("BattleEndPhase");
|
||||||
game.onNextPrompt("SelectModifierPhase", UiMode.MODIFIER_SELECT, () => {
|
game.onNextPrompt("SelectRewardPhase", UiMode.MODIFIER_SELECT, () => {
|
||||||
expect(game.scene.ui.getHandler()).toBeInstanceOf(RewardSelectUiHandler);
|
expect(game.scene.ui.getHandler()).toBeInstanceOf(RewardSelectUiHandler);
|
||||||
game.modifiers.testCheck("EVIOLITE", false).testCheck("MINI_BLACK_HOLE", false);
|
game.modifiers.testCheck("EVIOLITE", false).testCheck("MINI_BLACK_HOLE", false);
|
||||||
});
|
});
|
||||||
@ -87,7 +87,7 @@ describe("Shop modifications", async () => {
|
|||||||
game.move.select(MoveId.SPLASH);
|
game.move.select(MoveId.SPLASH);
|
||||||
await game.doKillOpponents();
|
await game.doKillOpponents();
|
||||||
await game.phaseInterceptor.to("BattleEndPhase");
|
await game.phaseInterceptor.to("BattleEndPhase");
|
||||||
game.onNextPrompt("SelectModifierPhase", UiMode.MODIFIER_SELECT, () => {
|
game.onNextPrompt("SelectRewardPhase", UiMode.MODIFIER_SELECT, () => {
|
||||||
expect(game.scene.ui.getHandler()).toBeInstanceOf(RewardSelectUiHandler);
|
expect(game.scene.ui.getHandler()).toBeInstanceOf(RewardSelectUiHandler);
|
||||||
game.modifiers.testCheck("EVIOLITE", true).testCheck("MINI_BLACK_HOLE", true);
|
game.modifiers.testCheck("EVIOLITE", true).testCheck("MINI_BLACK_HOLE", true);
|
||||||
});
|
});
|
||||||
|
@ -68,7 +68,7 @@ describe("Items - Dire Hit", () => {
|
|||||||
|
|
||||||
// Forced DIRE_HIT to spawn in the first slot with override
|
// Forced DIRE_HIT to spawn in the first slot with override
|
||||||
game.onNextPrompt(
|
game.onNextPrompt(
|
||||||
"SelectModifierPhase",
|
"SelectRewardPhase",
|
||||||
UiMode.MODIFIER_SELECT,
|
UiMode.MODIFIER_SELECT,
|
||||||
() => {
|
() => {
|
||||||
const handler = game.scene.ui.getHandler() as RewardSelectUiHandler;
|
const handler = game.scene.ui.getHandler() as RewardSelectUiHandler;
|
||||||
|
@ -74,7 +74,7 @@ describe("Items - Double Battle Chance Boosters", () => {
|
|||||||
|
|
||||||
// Forced LURE to spawn in the first slot with override
|
// Forced LURE to spawn in the first slot with override
|
||||||
game.onNextPrompt(
|
game.onNextPrompt(
|
||||||
"SelectModifierPhase",
|
"SelectRewardPhase",
|
||||||
UiMode.MODIFIER_SELECT,
|
UiMode.MODIFIER_SELECT,
|
||||||
() => {
|
() => {
|
||||||
const handler = game.scene.ui.getHandler() as RewardSelectUiHandler;
|
const handler = game.scene.ui.getHandler() as RewardSelectUiHandler;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { RewardTier } from "#enums/reward-tier";
|
import { RewardTier } from "#enums/reward-tier";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
import Phase from "phaser";
|
import Phase from "phaser";
|
||||||
@ -36,19 +36,19 @@ describe("Items - Lock Capsule", () => {
|
|||||||
it("doesn't set the cost of common tier items to 0", async () => {
|
it("doesn't set the cost of common tier items to 0", async () => {
|
||||||
await game.classicMode.startBattle();
|
await game.classicMode.startBattle();
|
||||||
game.scene.phaseManager.overridePhase(
|
game.scene.phaseManager.overridePhase(
|
||||||
new SelectModifierPhase(0, undefined, {
|
new SelectRewardPhase(0, undefined, {
|
||||||
guaranteedModifierTiers: [RewardTier.COMMON, RewardTier.COMMON, RewardTier.COMMON],
|
guaranteedModifierTiers: [RewardTier.COMMON, RewardTier.COMMON, RewardTier.COMMON],
|
||||||
fillRemaining: false,
|
fillRemaining: false,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
game.onNextPrompt("SelectModifierPhase", UiMode.MODIFIER_SELECT, () => {
|
game.onNextPrompt("SelectRewardPhase", UiMode.MODIFIER_SELECT, () => {
|
||||||
const selectModifierPhase = game.scene.phaseManager.getCurrentPhase() as SelectModifierPhase;
|
const selectModifierPhase = game.scene.phaseManager.getCurrentPhase() as SelectRewardPhase;
|
||||||
const rerollCost = selectModifierPhase.getRerollCost(true);
|
const rerollCost = selectModifierPhase.getRerollCost(true);
|
||||||
expect(rerollCost).toBe(150);
|
expect(rerollCost).toBe(150);
|
||||||
});
|
});
|
||||||
|
|
||||||
game.doSelectModifier();
|
game.doSelectModifier();
|
||||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
await game.phaseInterceptor.to("SelectRewardPhase");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -135,7 +135,7 @@ describe("Items - Temporary Stat Stage Boosters", () => {
|
|||||||
|
|
||||||
// Forced X_ATTACK to spawn in the first slot with override
|
// Forced X_ATTACK to spawn in the first slot with override
|
||||||
game.onNextPrompt(
|
game.onNextPrompt(
|
||||||
"SelectModifierPhase",
|
"SelectRewardPhase",
|
||||||
UiMode.MODIFIER_SELECT,
|
UiMode.MODIFIER_SELECT,
|
||||||
() => {
|
() => {
|
||||||
const handler = game.scene.ui.getHandler() as RewardSelectUiHandler;
|
const handler = game.scene.ui.getHandler() as RewardSelectUiHandler;
|
||||||
|
@ -17,7 +17,7 @@ import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils
|
|||||||
import { ATrainersTestEncounter } from "#app/data/mystery-encounters/encounters/a-trainers-test-encounter";
|
import { ATrainersTestEncounter } from "#app/data/mystery-encounters/encounters/a-trainers-test-encounter";
|
||||||
import { EggTier } from "#enums/egg-type";
|
import { EggTier } from "#enums/egg-type";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { PartyHealPhase } from "#app/phases/party-heal-phase";
|
import { PartyHealPhase } from "#app/phases/party-heal-phase";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
|
||||||
@ -130,8 +130,8 @@ describe("A Trainer's Test - Mystery Encounter", () => {
|
|||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
|
|
||||||
const eggsAfter = scene.gameData.eggs;
|
const eggsAfter = scene.gameData.eggs;
|
||||||
expect(eggsAfter).toBeDefined();
|
expect(eggsAfter).toBeDefined();
|
||||||
@ -178,8 +178,8 @@ describe("A Trainer's Test - Mystery Encounter", () => {
|
|||||||
const eggsBeforeLength = eggsBefore.length;
|
const eggsBeforeLength = eggsBefore.length;
|
||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 2);
|
await runMysteryEncounterToEnd(game, 2);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
|
|
||||||
const eggsAfter = scene.gameData.eggs;
|
const eggsAfter = scene.gameData.eggs;
|
||||||
expect(eggsAfter).toBeDefined();
|
expect(eggsAfter).toBeDefined();
|
||||||
|
@ -16,7 +16,7 @@ import { AbsoluteAvariceEncounter } from "#app/data/mystery-encounters/encounter
|
|||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
import { MovePhase } from "#app/phases/move-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { HeldItemId } from "#enums/held-item-id";
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
|
|
||||||
const namespace = "mysteryEncounters/absoluteAvarice";
|
const namespace = "mysteryEncounters/absoluteAvarice";
|
||||||
@ -143,8 +143,8 @@ describe("Absolute Avarice - Mystery Encounter", () => {
|
|||||||
await game.runToMysteryEncounter(MysteryEncounterType.ABSOLUTE_AVARICE, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.ABSOLUTE_AVARICE, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
|
|
||||||
for (const partyPokemon of scene.getPlayerParty()) {
|
for (const partyPokemon of scene.getPlayerParty()) {
|
||||||
expect(partyPokemon.heldItemManager.getStack(HeldItemId.REVIVER_SEED)).toBe(1);
|
expect(partyPokemon.heldItemManager.getStack(HeldItemId.REVIVER_SEED)).toBe(1);
|
||||||
|
@ -16,7 +16,7 @@ import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils
|
|||||||
import { getPokemonSpecies } from "#app/utils/pokemon-utils";
|
import { getPokemonSpecies } from "#app/utils/pokemon-utils";
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { ShinyRateBoosterModifier } from "#app/modifier/modifier";
|
import { ShinyRateBoosterModifier } from "#app/modifier/modifier";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ describe("An Offer You Can't Refuse - Mystery Encounter", () => {
|
|||||||
const expBefore = gyarados.exp;
|
const expBefore = gyarados.exp;
|
||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 2);
|
await runMysteryEncounterToEnd(game, 2);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
|
|
||||||
expect(gyarados.exp).toBe(
|
expect(gyarados.exp).toBe(
|
||||||
expBefore + Math.floor((getPokemonSpecies(SpeciesId.LIEPARD).baseExp * defaultWave) / 5 + 1),
|
expBefore + Math.floor((getPokemonSpecies(SpeciesId.LIEPARD).baseExp * defaultWave) / 5 + 1),
|
||||||
@ -213,7 +213,7 @@ describe("An Offer You Can't Refuse - Mystery Encounter", () => {
|
|||||||
const expBefore = abra.exp;
|
const expBefore = abra.exp;
|
||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 2);
|
await runMysteryEncounterToEnd(game, 2);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
|
|
||||||
expect(abra.exp).toBe(
|
expect(abra.exp).toBe(
|
||||||
expBefore + Math.floor((getPokemonSpecies(SpeciesId.LIEPARD).baseExp * defaultWave) / 5 + 1),
|
expBefore + Math.floor((getPokemonSpecies(SpeciesId.LIEPARD).baseExp * defaultWave) / 5 + 1),
|
||||||
|
@ -11,7 +11,6 @@ import {
|
|||||||
import type BattleScene from "#app/battle-scene";
|
import type BattleScene from "#app/battle-scene";
|
||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
||||||
import { BerryModifier } from "#app/modifier/modifier";
|
|
||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
||||||
@ -19,7 +18,7 @@ import { BerriesAboundEncounter } from "#app/data/mystery-encounters/encounters/
|
|||||||
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
import * as EncounterDialogueUtils from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
import * as EncounterDialogueUtils from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
|
|
||||||
const namespace = "mysteryEncounters/berriesAbound";
|
const namespace = "mysteryEncounters/berriesAbound";
|
||||||
@ -45,7 +44,6 @@ describe("Berries Abound - Mystery Encounter", () => {
|
|||||||
.startingWave(defaultWave)
|
.startingWave(defaultWave)
|
||||||
.startingBiome(defaultBiome)
|
.startingBiome(defaultBiome)
|
||||||
.disableTrainerWaves()
|
.disableTrainerWaves()
|
||||||
.startingModifier([])
|
|
||||||
.startingHeldItems([])
|
.startingHeldItems([])
|
||||||
.enemyAbility(AbilityId.BALL_FETCH)
|
.enemyAbility(AbilityId.BALL_FETCH)
|
||||||
.enemyPassiveAbility(AbilityId.BALL_FETCH);
|
.enemyPassiveAbility(AbilityId.BALL_FETCH);
|
||||||
@ -128,14 +126,12 @@ describe("Berries Abound - Mystery Encounter", () => {
|
|||||||
const numBerries = game.scene.currentBattle.mysteryEncounter!.misc.numBerries;
|
const numBerries = game.scene.currentBattle.mysteryEncounter!.misc.numBerries;
|
||||||
|
|
||||||
// Clear out any pesky mods that slipped through test spin-up
|
// Clear out any pesky mods that slipped through test spin-up
|
||||||
scene.modifiers.forEach(mod => {
|
scene.clearAllItems();
|
||||||
scene.removeModifier(mod);
|
|
||||||
});
|
|
||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
|
|
||||||
const berriesAfter = scene.findModifiers(m => m instanceof BerryModifier) as BerryModifier[];
|
const berriesAfter = scene.findModifiers(m => m instanceof BerryModifier) as BerryModifier[];
|
||||||
const berriesAfterCount = berriesAfter.reduce((a, b) => a + b.stackCount, 0);
|
const berriesAfterCount = berriesAfter.reduce((a, b) => a + b.stackCount, 0);
|
||||||
@ -147,9 +143,9 @@ describe("Berries Abound - Mystery Encounter", () => {
|
|||||||
await game.runToMysteryEncounter(MysteryEncounterType.BERRIES_ABOUND, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.BERRIES_ABOUND, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -232,9 +228,9 @@ describe("Berries Abound - Mystery Encounter", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 2);
|
await runMysteryEncounterToEnd(game, 2);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -21,7 +21,7 @@ import { MysteryEncounterPhase, MysteryEncounterRewardsPhase } from "#app/phases
|
|||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { BugTypeSuperfanEncounter } from "#app/data/mystery-encounters/encounters/bug-type-superfan-encounter";
|
import { BugTypeSuperfanEncounter } from "#app/data/mystery-encounters/encounters/bug-type-superfan-encounter";
|
||||||
import * as encounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
import * as encounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
||||||
import { HeldItemId } from "#enums/held-item-id";
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
|
|
||||||
@ -416,8 +416,8 @@ describe("Bug-Type Superfan - Mystery Encounter", () => {
|
|||||||
await game.runToMysteryEncounter(MysteryEncounterType.BUG_TYPE_SUPERFAN, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.BUG_TYPE_SUPERFAN, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 2);
|
await runMysteryEncounterToEnd(game, 2);
|
||||||
|
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -435,8 +435,8 @@ describe("Bug-Type Superfan - Mystery Encounter", () => {
|
|||||||
]);
|
]);
|
||||||
await runMysteryEncounterToEnd(game, 2);
|
await runMysteryEncounterToEnd(game, 2);
|
||||||
|
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -457,8 +457,8 @@ describe("Bug-Type Superfan - Mystery Encounter", () => {
|
|||||||
]);
|
]);
|
||||||
await runMysteryEncounterToEnd(game, 2);
|
await runMysteryEncounterToEnd(game, 2);
|
||||||
|
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -481,8 +481,8 @@ describe("Bug-Type Superfan - Mystery Encounter", () => {
|
|||||||
]);
|
]);
|
||||||
await runMysteryEncounterToEnd(game, 2);
|
await runMysteryEncounterToEnd(game, 2);
|
||||||
|
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -556,8 +556,8 @@ describe("Bug-Type Superfan - Mystery Encounter", () => {
|
|||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 3, { pokemonNo: 1, optionNo: 1 });
|
await runMysteryEncounterToEnd(game, 3, { pokemonNo: 1, optionNo: 1 });
|
||||||
|
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -7,20 +7,17 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite
|
|||||||
import { getPokemonSpecies } from "#app/utils/pokemon-utils";
|
import { getPokemonSpecies } from "#app/utils/pokemon-utils";
|
||||||
import * as BattleAnims from "#app/data/battle-anims";
|
import * as BattleAnims from "#app/data/battle-anims";
|
||||||
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
import { generateModifierType } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
|
||||||
import {
|
import {
|
||||||
runMysteryEncounterToEnd,
|
runMysteryEncounterToEnd,
|
||||||
skipBattleRunMysteryEncounterRewardsPhase,
|
skipBattleRunMysteryEncounterRewardsPhase,
|
||||||
} from "#test/mystery-encounter/encounter-test-utils";
|
} from "#test/mystery-encounter/encounter-test-utils";
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import type BattleScene from "#app/battle-scene";
|
import type BattleScene from "#app/battle-scene";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
|
||||||
import { PokemonMove } from "#app/data/moves/pokemon-move";
|
import { PokemonMove } from "#app/data/moves/pokemon-move";
|
||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
||||||
import { RewardTier } from "#enums/reward-tier";
|
|
||||||
import { ClowningAroundEncounter } from "#app/data/mystery-encounters/encounters/clowning-around-encounter";
|
import { ClowningAroundEncounter } from "#app/data/mystery-encounters/encounters/clowning-around-encounter";
|
||||||
import { TrainerType } from "#enums/trainer-type";
|
import { TrainerType } from "#enums/trainer-type";
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
@ -28,15 +25,14 @@ import { PostMysteryEncounterPhase } from "#app/phases/mystery-encounter-phases"
|
|||||||
import { Button } from "#enums/buttons";
|
import { Button } from "#enums/buttons";
|
||||||
import type PartyUiHandler from "#app/ui/party-ui-handler";
|
import type PartyUiHandler from "#app/ui/party-ui-handler";
|
||||||
import type OptionSelectUiHandler from "#app/ui/settings/option-select-ui-handler";
|
import type OptionSelectUiHandler from "#app/ui/settings/option-select-ui-handler";
|
||||||
import type { PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
|
||||||
import { modifierTypes } from "#app/data/data-lists";
|
|
||||||
import { BerryType } from "#enums/berry-type";
|
|
||||||
import type { PokemonHeldItemModifier } from "#app/modifier/modifier";
|
|
||||||
import { PokemonType } from "#enums/pokemon-type";
|
import { PokemonType } from "#enums/pokemon-type";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
import { MovePhase } from "#app/phases/move-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { NewBattlePhase } from "#app/phases/new-battle-phase";
|
import { NewBattlePhase } from "#app/phases/new-battle-phase";
|
||||||
|
import { HeldItemId } from "#enums/held-item-id";
|
||||||
|
import { getHeldItemTier } from "#app/items/held-item-tiers";
|
||||||
|
import { RewardTier } from "#enums/reward-tier";
|
||||||
|
|
||||||
const namespace = "mysteryEncounters/clowningAround";
|
const namespace = "mysteryEncounters/clowningAround";
|
||||||
const defaultParty = [SpeciesId.LAPRAS, SpeciesId.GENGAR, SpeciesId.ABRA];
|
const defaultParty = [SpeciesId.LAPRAS, SpeciesId.GENGAR, SpeciesId.ABRA];
|
||||||
@ -200,9 +196,9 @@ describe("Clowning Around - Mystery Encounter", () => {
|
|||||||
await game.runToMysteryEncounter(MysteryEncounterType.CLOWNING_AROUND, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.CLOWNING_AROUND, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
const abilityToTrain = scene.currentBattle.mysteryEncounter?.misc.ability;
|
const abilityToTrain = scene.currentBattle.mysteryEncounter?.misc.ability;
|
||||||
|
|
||||||
game.onNextPrompt("PostMysteryEncounterPhase", UiMode.MESSAGE, () => {
|
game.onNextPrompt("PostMysteryEncounterPhase", UiMode.MESSAGE, () => {
|
||||||
@ -266,48 +262,32 @@ describe("Clowning Around - Mystery Encounter", () => {
|
|||||||
scene.getPlayerParty()[0].moveset = [new PokemonMove(MoveId.TACKLE), new PokemonMove(MoveId.THIEF)];
|
scene.getPlayerParty()[0].moveset = [new PokemonMove(MoveId.TACKLE), new PokemonMove(MoveId.THIEF)];
|
||||||
|
|
||||||
// 2 Sitrus Berries on lead
|
// 2 Sitrus Berries on lead
|
||||||
scene.modifiers = [];
|
scene.clearAllItems();
|
||||||
let itemType = generateModifierType(modifierTypes.BERRY, [BerryType.SITRUS]) as PokemonHeldItemModifierType;
|
scene.getPlayerParty()[0].heldItemManager.add(HeldItemId.SITRUS_BERRY, 2);
|
||||||
await addItemToPokemon(scene, scene.getPlayerParty()[0], 2, itemType);
|
scene.getPlayerParty()[0].heldItemManager.add(HeldItemId.GANLON_BERRY, 2);
|
||||||
// 2 Ganlon Berries on lead
|
scene.getPlayerParty()[0].heldItemManager.add(HeldItemId.GOLDEN_PUNCH, 5);
|
||||||
itemType = generateModifierType(modifierTypes.BERRY, [BerryType.GANLON]) as PokemonHeldItemModifierType;
|
scene.getPlayerParty()[0].heldItemManager.add(HeldItemId.LUCKY_EGG, 5);
|
||||||
await addItemToPokemon(scene, scene.getPlayerParty()[0], 2, itemType);
|
scene.getPlayerParty()[0].heldItemManager.add(HeldItemId.SOOTHE_BELL, 3);
|
||||||
// 5 Golden Punch on lead (ultra)
|
scene.getPlayerParty()[0].heldItemManager.add(HeldItemId.SOUL_DEW, 5);
|
||||||
itemType = generateModifierType(modifierTypes.GOLDEN_PUNCH) as PokemonHeldItemModifierType;
|
scene.getPlayerParty()[0].heldItemManager.add(HeldItemId.GOLDEN_EGG, 2);
|
||||||
await addItemToPokemon(scene, scene.getPlayerParty()[0], 5, itemType);
|
|
||||||
// 5 Lucky Egg on lead (ultra)
|
|
||||||
itemType = generateModifierType(modifierTypes.LUCKY_EGG) as PokemonHeldItemModifierType;
|
|
||||||
await addItemToPokemon(scene, scene.getPlayerParty()[0], 5, itemType);
|
|
||||||
// 3 Soothe Bell on lead (great tier, but counted as ultra by this ME)
|
|
||||||
itemType = generateModifierType(modifierTypes.SOOTHE_BELL) as PokemonHeldItemModifierType;
|
|
||||||
await addItemToPokemon(scene, scene.getPlayerParty()[0], 3, itemType);
|
|
||||||
// 5 Soul Dew on lead (rogue)
|
|
||||||
itemType = generateModifierType(modifierTypes.SOUL_DEW) as PokemonHeldItemModifierType;
|
|
||||||
await addItemToPokemon(scene, scene.getPlayerParty()[0], 5, itemType);
|
|
||||||
// 2 Golden Egg on lead (rogue)
|
|
||||||
itemType = generateModifierType(modifierTypes.GOLDEN_EGG) as PokemonHeldItemModifierType;
|
|
||||||
await addItemToPokemon(scene, scene.getPlayerParty()[0], 2, itemType);
|
|
||||||
|
|
||||||
// 5 Soul Dew on second party pokemon (these should not change)
|
scene.getPlayerParty()[1].heldItemManager.add(HeldItemId.SOUL_DEW, 5);
|
||||||
itemType = generateModifierType(modifierTypes.SOUL_DEW) as PokemonHeldItemModifierType;
|
|
||||||
await addItemToPokemon(scene, scene.getPlayerParty()[1], 5, itemType);
|
|
||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 2);
|
await runMysteryEncounterToEnd(game, 2);
|
||||||
|
|
||||||
const leadItemsAfter = scene.getPlayerParty()[0].getHeldItems();
|
const leadItemsAfter = scene.getPlayerParty()[0].getHeldItems();
|
||||||
const ultraCountAfter = leadItemsAfter
|
const ultraCountAfter = leadItemsAfter
|
||||||
.filter(m => m.type.tier === RewardTier.ULTRA)
|
.filter(m => getHeldItemTier(m) === RewardTier.ULTRA)
|
||||||
.reduce((a, b) => a + b.stackCount, 0);
|
.reduce((a, b) => a + scene.getPlayerParty()[0].heldItemManager.getStack(b), 0);
|
||||||
const rogueCountAfter = leadItemsAfter
|
const rogueCountAfter = leadItemsAfter
|
||||||
.filter(m => m.type.tier === RewardTier.ROGUE)
|
.filter(m => getHeldItemTier(m) === RewardTier.ROGUE)
|
||||||
.reduce((a, b) => a + b.stackCount, 0);
|
.reduce((a, b) => a + scene.getPlayerParty()[0].heldItemManager.getStack(b), 0);
|
||||||
expect(ultraCountAfter).toBe(13);
|
expect(ultraCountAfter).toBe(13);
|
||||||
expect(rogueCountAfter).toBe(7);
|
expect(rogueCountAfter).toBe(7);
|
||||||
|
|
||||||
const secondItemsAfter = scene.getPlayerParty()[1].getHeldItems();
|
const secondItemsAfter = scene.getPlayerParty()[1].getHeldItems();
|
||||||
expect(secondItemsAfter.length).toBe(1);
|
expect(secondItemsAfter.length).toBe(1);
|
||||||
expect(secondItemsAfter[0].type.id).toBe("SOUL_DEW");
|
expect(scene.getPlayerParty()[0].heldItemManager.getStack(HeldItemId.SOUL_DEW)).toBe(5);
|
||||||
expect(secondItemsAfter[0]?.stackCount).toBe(5);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should leave encounter without battle", async () => {
|
it("should leave encounter without battle", async () => {
|
||||||
@ -381,15 +361,3 @@ describe("Clowning Around - Mystery Encounter", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
async function addItemToPokemon(
|
|
||||||
scene: BattleScene,
|
|
||||||
pokemon: Pokemon,
|
|
||||||
stackCount: number,
|
|
||||||
itemType: PokemonHeldItemModifierType,
|
|
||||||
) {
|
|
||||||
const itemMod = itemType.newModifier(pokemon) as PokemonHeldItemModifier;
|
|
||||||
itemMod.stackCount = stackCount;
|
|
||||||
scene.addModifier(itemMod, true, false, false, true);
|
|
||||||
await scene.updateItems(true);
|
|
||||||
}
|
|
||||||
|
@ -21,7 +21,7 @@ import { PokemonMove } from "#app/data/moves/pokemon-move";
|
|||||||
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
import { MovePhase } from "#app/phases/move-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
||||||
|
|
||||||
const namespace = "mysteryEncounters/dancingLessons";
|
const namespace = "mysteryEncounters/dancingLessons";
|
||||||
@ -126,9 +126,9 @@ describe("Dancing Lessons - Mystery Encounter", () => {
|
|||||||
partyLead.calculateStats();
|
partyLead.calculateStats();
|
||||||
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -13,7 +13,7 @@ import { DepartmentStoreSaleEncounter } from "#app/data/mystery-encounters/encou
|
|||||||
import { CIVILIZATION_ENCOUNTER_BIOMES } from "#app/data/mystery-encounters/mystery-encounters";
|
import { CIVILIZATION_ENCOUNTER_BIOMES } from "#app/data/mystery-encounters/mystery-encounters";
|
||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
|
|
||||||
const namespace = "mysteryEncounters/departmentStoreSale";
|
const namespace = "mysteryEncounters/departmentStoreSale";
|
||||||
const defaultParty = [SpeciesId.LAPRAS, SpeciesId.GENGAR, SpeciesId.ABRA];
|
const defaultParty = [SpeciesId.LAPRAS, SpeciesId.GENGAR, SpeciesId.ABRA];
|
||||||
@ -93,8 +93,8 @@ describe("Department Store Sale - Mystery Encounter", () => {
|
|||||||
it("should have shop with only TMs", async () => {
|
it("should have shop with only TMs", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.DEPARTMENT_STORE_SALE, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.DEPARTMENT_STORE_SALE, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 1);
|
await runMysteryEncounterToEnd(game, 1);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -130,8 +130,8 @@ describe("Department Store Sale - Mystery Encounter", () => {
|
|||||||
it("should have shop with only Vitamins", async () => {
|
it("should have shop with only Vitamins", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.DEPARTMENT_STORE_SALE, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.DEPARTMENT_STORE_SALE, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 2);
|
await runMysteryEncounterToEnd(game, 2);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -170,8 +170,8 @@ describe("Department Store Sale - Mystery Encounter", () => {
|
|||||||
it("should have shop with only X Items", async () => {
|
it("should have shop with only X Items", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.DEPARTMENT_STORE_SALE, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.DEPARTMENT_STORE_SALE, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 3);
|
await runMysteryEncounterToEnd(game, 3);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -210,8 +210,8 @@ describe("Department Store Sale - Mystery Encounter", () => {
|
|||||||
it("should have shop with only Pokeballs", async () => {
|
it("should have shop with only Pokeballs", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.DEPARTMENT_STORE_SALE, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.DEPARTMENT_STORE_SALE, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 4);
|
await runMysteryEncounterToEnd(game, 4);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -11,7 +11,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
|||||||
import * as MysteryEncounters from "#app/data/mystery-encounters/mystery-encounters";
|
import * as MysteryEncounters from "#app/data/mystery-encounters/mystery-encounters";
|
||||||
import { FieldTripEncounter } from "#app/data/mystery-encounters/encounters/field-trip-encounter";
|
import { FieldTripEncounter } from "#app/data/mystery-encounters/encounters/field-trip-encounter";
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
@ -85,7 +85,7 @@ describe("Field Trip - Mystery Encounter", () => {
|
|||||||
it("Should give no reward on incorrect option", async () => {
|
it("Should give no reward on incorrect option", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 1, { pokemonNo: 1, optionNo: 2 });
|
await runMysteryEncounterToEnd(game, 1, { pokemonNo: 1, optionNo: 2 });
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase);
|
await game.phaseInterceptor.to(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -97,7 +97,7 @@ describe("Field Trip - Mystery Encounter", () => {
|
|||||||
it("Should give proper rewards on correct Physical move option", async () => {
|
it("Should give proper rewards on correct Physical move option", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 1, { pokemonNo: 1, optionNo: 1 });
|
await runMysteryEncounterToEnd(game, 1, { pokemonNo: 1, optionNo: 1 });
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase);
|
await game.phaseInterceptor.to(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -146,7 +146,7 @@ describe("Field Trip - Mystery Encounter", () => {
|
|||||||
it("Should give no reward on incorrect option", async () => {
|
it("Should give no reward on incorrect option", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 2, { pokemonNo: 1, optionNo: 1 });
|
await runMysteryEncounterToEnd(game, 2, { pokemonNo: 1, optionNo: 1 });
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase);
|
await game.phaseInterceptor.to(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -158,7 +158,7 @@ describe("Field Trip - Mystery Encounter", () => {
|
|||||||
it("Should give proper rewards on correct Special move option", async () => {
|
it("Should give proper rewards on correct Special move option", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 2, { pokemonNo: 1, optionNo: 2 });
|
await runMysteryEncounterToEnd(game, 2, { pokemonNo: 1, optionNo: 2 });
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase);
|
await game.phaseInterceptor.to(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -207,7 +207,7 @@ describe("Field Trip - Mystery Encounter", () => {
|
|||||||
it("Should give no reward on incorrect option", async () => {
|
it("Should give no reward on incorrect option", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 3, { pokemonNo: 1, optionNo: 1 });
|
await runMysteryEncounterToEnd(game, 3, { pokemonNo: 1, optionNo: 1 });
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase);
|
await game.phaseInterceptor.to(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -220,7 +220,7 @@ describe("Field Trip - Mystery Encounter", () => {
|
|||||||
vi.spyOn(i18next, "t");
|
vi.spyOn(i18next, "t");
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 3, { pokemonNo: 1, optionNo: 3 });
|
await runMysteryEncounterToEnd(game, 3, { pokemonNo: 1, optionNo: 3 });
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase);
|
await game.phaseInterceptor.to(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -24,7 +24,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
|||||||
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
import { MovePhase } from "#app/phases/move-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
@ -176,8 +176,8 @@ describe("Fiery Fallout - Mystery Encounter", () => {
|
|||||||
await game.runToMysteryEncounter(MysteryEncounterType.FIERY_FALLOUT, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.FIERY_FALLOUT, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
|
|
||||||
const hasAttackBooster = scene
|
const hasAttackBooster = scene
|
||||||
.getPlayerParty()[0]
|
.getPlayerParty()[0]
|
||||||
@ -262,8 +262,8 @@ describe("Fiery Fallout - Mystery Encounter", () => {
|
|||||||
it("should give attack type boosting item to lead pokemon", async () => {
|
it("should give attack type boosting item to lead pokemon", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.FIERY_FALLOUT, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.FIERY_FALLOUT, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 3);
|
await runMysteryEncounterToEnd(game, 3);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
|
|
||||||
const hasAttackBooster = scene
|
const hasAttackBooster = scene
|
||||||
.getPlayerParty()[0]
|
.getPlayerParty()[0]
|
||||||
|
@ -21,7 +21,7 @@ import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encount
|
|||||||
import { FightOrFlightEncounter } from "#app/data/mystery-encounters/encounters/fight-or-flight-encounter";
|
import { FightOrFlightEncounter } from "#app/data/mystery-encounters/encounters/fight-or-flight-encounter";
|
||||||
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
|
|
||||||
const namespace = "mysteryEncounters/fightOrFlight";
|
const namespace = "mysteryEncounters/fightOrFlight";
|
||||||
const defaultParty = [SpeciesId.LAPRAS, SpeciesId.GENGAR, SpeciesId.ABRA];
|
const defaultParty = [SpeciesId.LAPRAS, SpeciesId.GENGAR, SpeciesId.ABRA];
|
||||||
@ -122,9 +122,9 @@ describe("Fight or Flight - Mystery Encounter", () => {
|
|||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
|
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -182,9 +182,9 @@ describe("Fight or Flight - Mystery Encounter", () => {
|
|||||||
const item = game.scene.currentBattle.mysteryEncounter!.misc;
|
const item = game.scene.currentBattle.mysteryEncounter!.misc;
|
||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 2);
|
await runMysteryEncounterToEnd(game, 2);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
|
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -19,7 +19,7 @@ import MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
|||||||
import { Nature } from "#enums/nature";
|
import { Nature } from "#enums/nature";
|
||||||
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { FunAndGamesEncounter } from "#app/data/mystery-encounters/encounters/fun-and-games-encounter";
|
import { FunAndGamesEncounter } from "#app/data/mystery-encounters/encounters/fun-and-games-encounter";
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { Command } from "#enums/command";
|
import { Command } from "#enums/command";
|
||||||
@ -162,10 +162,10 @@ describe("Fun And Games! - Mystery Encounter", () => {
|
|||||||
|
|
||||||
// Turn 3
|
// Turn 3
|
||||||
(game.scene.phaseManager.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, 0, MoveUseMode.NORMAL);
|
(game.scene.phaseManager.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, 0, MoveUseMode.NORMAL);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
|
|
||||||
// Rewards
|
// Rewards
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should have no items in rewards if Wubboffet doesn't take enough damage", async () => {
|
it("should have no items in rewards if Wubboffet doesn't take enough damage", async () => {
|
||||||
@ -181,11 +181,11 @@ describe("Fun And Games! - Mystery Encounter", () => {
|
|||||||
// Skip minigame
|
// Skip minigame
|
||||||
scene.currentBattle.mysteryEncounter!.misc.turnsRemaining = 0;
|
scene.currentBattle.mysteryEncounter!.misc.turnsRemaining = 0;
|
||||||
(game.scene.phaseManager.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, 0, MoveUseMode.NORMAL);
|
(game.scene.phaseManager.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, 0, MoveUseMode.NORMAL);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
|
|
||||||
// Rewards
|
// Rewards
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -210,11 +210,11 @@ describe("Fun And Games! - Mystery Encounter", () => {
|
|||||||
wobbuffet.hp = Math.floor(0.2 * wobbuffet.getMaxHp());
|
wobbuffet.hp = Math.floor(0.2 * wobbuffet.getMaxHp());
|
||||||
scene.currentBattle.mysteryEncounter!.misc.turnsRemaining = 0;
|
scene.currentBattle.mysteryEncounter!.misc.turnsRemaining = 0;
|
||||||
(game.scene.phaseManager.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, 0, MoveUseMode.NORMAL);
|
(game.scene.phaseManager.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, 0, MoveUseMode.NORMAL);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
|
|
||||||
// Rewards
|
// Rewards
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -240,11 +240,11 @@ describe("Fun And Games! - Mystery Encounter", () => {
|
|||||||
wobbuffet.hp = Math.floor(0.1 * wobbuffet.getMaxHp());
|
wobbuffet.hp = Math.floor(0.1 * wobbuffet.getMaxHp());
|
||||||
scene.currentBattle.mysteryEncounter!.misc.turnsRemaining = 0;
|
scene.currentBattle.mysteryEncounter!.misc.turnsRemaining = 0;
|
||||||
(game.scene.phaseManager.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, 0, MoveUseMode.NORMAL);
|
(game.scene.phaseManager.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, 0, MoveUseMode.NORMAL);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
|
|
||||||
// Rewards
|
// Rewards
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -270,11 +270,11 @@ describe("Fun And Games! - Mystery Encounter", () => {
|
|||||||
wobbuffet.hp = 1;
|
wobbuffet.hp = 1;
|
||||||
scene.currentBattle.mysteryEncounter!.misc.turnsRemaining = 0;
|
scene.currentBattle.mysteryEncounter!.misc.turnsRemaining = 0;
|
||||||
(game.scene.phaseManager.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, 0, MoveUseMode.NORMAL);
|
(game.scene.phaseManager.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, 0, MoveUseMode.NORMAL);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
|
|
||||||
// Rewards
|
// Rewards
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -11,7 +11,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
|||||||
import * as MysteryEncounters from "#app/data/mystery-encounters/mystery-encounters";
|
import * as MysteryEncounters from "#app/data/mystery-encounters/mystery-encounters";
|
||||||
import { GlobalTradeSystemEncounter } from "#app/data/mystery-encounters/encounters/global-trade-system-encounter";
|
import { GlobalTradeSystemEncounter } from "#app/data/mystery-encounters/encounters/global-trade-system-encounter";
|
||||||
import { CIVILIZATION_ENCOUNTER_BIOMES } from "#app/data/mystery-encounters/mystery-encounters";
|
import { CIVILIZATION_ENCOUNTER_BIOMES } from "#app/data/mystery-encounters/mystery-encounters";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
||||||
import { RewardTier } from "#enums/reward-tier";
|
import { RewardTier } from "#enums/reward-tier";
|
||||||
@ -220,8 +220,8 @@ describe("Global Trade System - Mystery Encounter", () => {
|
|||||||
await scene.updateItems(true);
|
await scene.updateItems(true);
|
||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 3, { pokemonNo: 1, optionNo: 1 });
|
await runMysteryEncounterToEnd(game, 3, { pokemonNo: 1, optionNo: 1 });
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -24,7 +24,7 @@ import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
|||||||
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
||||||
import MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
import MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
|
|
||||||
const namespace = "mysteryEncounters/mysteriousChallengers";
|
const namespace = "mysteryEncounters/mysteriousChallengers";
|
||||||
const defaultParty = [SpeciesId.LAPRAS, SpeciesId.GENGAR, SpeciesId.ABRA];
|
const defaultParty = [SpeciesId.LAPRAS, SpeciesId.GENGAR, SpeciesId.ABRA];
|
||||||
@ -162,9 +162,9 @@ describe("Mysterious Challengers - Mystery Encounter", () => {
|
|||||||
await game.runToMysteryEncounter(MysteryEncounterType.MYSTERIOUS_CHALLENGERS, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.MYSTERIOUS_CHALLENGERS, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -206,9 +206,9 @@ describe("Mysterious Challengers - Mystery Encounter", () => {
|
|||||||
await game.runToMysteryEncounter(MysteryEncounterType.MYSTERIOUS_CHALLENGERS, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.MYSTERIOUS_CHALLENGERS, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -263,9 +263,9 @@ describe("Mysterious Challengers - Mystery Encounter", () => {
|
|||||||
await game.runToMysteryEncounter(MysteryEncounterType.MYSTERIOUS_CHALLENGERS, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.MYSTERIOUS_CHALLENGERS, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 3, undefined, true);
|
await runMysteryEncounterToEnd(game, 3, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -7,7 +7,7 @@ import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
|||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
@ -299,9 +299,9 @@ describe("Teleporting Hijinks - Mystery Encounter", () => {
|
|||||||
await game.runToMysteryEncounter(MysteryEncounterType.TELEPORTING_HIJINKS, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.TELEPORTING_HIJINKS, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 3, undefined, true);
|
await runMysteryEncounterToEnd(game, 3, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -16,7 +16,7 @@ import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils
|
|||||||
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
||||||
import MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
import MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { TheExpertPokemonBreederEncounter } from "#app/data/mystery-encounters/encounters/the-expert-pokemon-breeder-encounter";
|
import { TheExpertPokemonBreederEncounter } from "#app/data/mystery-encounters/encounters/the-expert-pokemon-breeder-encounter";
|
||||||
import { TrainerType } from "#enums/trainer-type";
|
import { TrainerType } from "#enums/trainer-type";
|
||||||
import { EggTier } from "#enums/egg-type";
|
import { EggTier } from "#enums/egg-type";
|
||||||
@ -176,8 +176,8 @@ describe("The Expert Pokémon Breeder - Mystery Encounter", () => {
|
|||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
|
|
||||||
const eggsAfter = scene.gameData.eggs;
|
const eggsAfter = scene.gameData.eggs;
|
||||||
const commonEggs = scene.currentBattle.mysteryEncounter!.misc.pokemon1CommonEggs;
|
const commonEggs = scene.currentBattle.mysteryEncounter!.misc.pokemon1CommonEggs;
|
||||||
@ -261,8 +261,8 @@ describe("The Expert Pokémon Breeder - Mystery Encounter", () => {
|
|||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
|
|
||||||
const eggsAfter = scene.gameData.eggs;
|
const eggsAfter = scene.gameData.eggs;
|
||||||
const commonEggs = scene.currentBattle.mysteryEncounter!.misc.pokemon2CommonEggs;
|
const commonEggs = scene.currentBattle.mysteryEncounter!.misc.pokemon2CommonEggs;
|
||||||
@ -343,8 +343,8 @@ describe("The Expert Pokémon Breeder - Mystery Encounter", () => {
|
|||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 3, undefined, true);
|
await runMysteryEncounterToEnd(game, 3, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
|
|
||||||
const eggsAfter = scene.gameData.eggs;
|
const eggsAfter = scene.gameData.eggs;
|
||||||
const commonEggs = scene.currentBattle.mysteryEncounter!.misc.pokemon3CommonEggs;
|
const commonEggs = scene.currentBattle.mysteryEncounter!.misc.pokemon3CommonEggs;
|
||||||
|
@ -25,7 +25,7 @@ import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils
|
|||||||
import { CustomPokemonData } from "#app/data/pokemon/pokemon-data";
|
import { CustomPokemonData } from "#app/data/pokemon/pokemon-data";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
import { MovePhase } from "#app/phases/move-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
import { applyHeldItems } from "#app/items/all-held-items";
|
import { applyHeldItems } from "#app/items/all-held-items";
|
||||||
import { HeldItemEffect } from "#app/items/held-item";
|
import { HeldItemEffect } from "#app/items/held-item";
|
||||||
@ -222,9 +222,9 @@ describe("The Strong Stuff - Mystery Encounter", () => {
|
|||||||
await game.runToMysteryEncounter(MysteryEncounterType.THE_STRONG_STUFF, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.THE_STRONG_STUFF, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -22,7 +22,7 @@ import { TheWinstrateChallengeEncounter } from "#app/data/mystery-encounters/enc
|
|||||||
import { Status } from "#app/data/status-effect";
|
import { Status } from "#app/data/status-effect";
|
||||||
import { MysteryEncounterRewardsPhase } from "#app/phases/mystery-encounter-phases";
|
import { MysteryEncounterRewardsPhase } from "#app/phases/mystery-encounter-phases";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { PartyHealPhase } from "#app/phases/party-heal-phase";
|
import { PartyHealPhase } from "#app/phases/party-heal-phase";
|
||||||
import { VictoryPhase } from "#app/phases/victory-phase";
|
import { VictoryPhase } from "#app/phases/victory-phase";
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
@ -295,9 +295,9 @@ describe("The Winstrate Challenge - Mystery Encounter", () => {
|
|||||||
|
|
||||||
// Should have Macho Brace in the rewards
|
// Should have Macho Brace in the rewards
|
||||||
await skipBattleToNextBattle(game, true);
|
await skipBattleToNextBattle(game, true);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -338,8 +338,8 @@ describe("The Winstrate Challenge - Mystery Encounter", () => {
|
|||||||
it("should have a Rarer Candy in the rewards", async () => {
|
it("should have a Rarer Candy in the rewards", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.THE_WINSTRATE_CHALLENGE, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.THE_WINSTRATE_CHALLENGE, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 2);
|
await runMysteryEncounterToEnd(game, 2);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -12,7 +12,7 @@ import { PokemonMove } from "#app/data/moves/pokemon-move";
|
|||||||
import { RewardTier } from "#enums/reward-tier";
|
import { RewardTier } from "#enums/reward-tier";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
import { MovePhase } from "#app/phases/move-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
import * as Utils from "#app/utils/common";
|
import * as Utils from "#app/utils/common";
|
||||||
@ -140,8 +140,8 @@ describe("Trash to Treasure - Mystery Encounter", () => {
|
|||||||
it("should give 2 Leftovers, 1 Shell Bell, and Black Sludge", async () => {
|
it("should give 2 Leftovers, 1 Shell Bell, and Black Sludge", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.TRASH_TO_TREASURE, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.TRASH_TO_TREASURE, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 1);
|
await runMysteryEncounterToEnd(game, 1);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
|
|
||||||
expect(scene.getPlayerParty()[0].heldItemManager.getStack(HeldItemId.LEFTOVERS)).toBe(2);
|
expect(scene.getPlayerParty()[0].heldItemManager.getStack(HeldItemId.LEFTOVERS)).toBe(2);
|
||||||
|
|
||||||
@ -204,9 +204,9 @@ describe("Trash to Treasure - Mystery Encounter", () => {
|
|||||||
await game.runToMysteryEncounter(MysteryEncounterType.TRASH_TO_TREASURE, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.TRASH_TO_TREASURE, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -17,7 +17,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
|||||||
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
|
||||||
import { WeirdDreamEncounter } from "#app/data/mystery-encounters/encounters/weird-dream-encounter";
|
import { WeirdDreamEncounter } from "#app/data/mystery-encounters/encounters/weird-dream-encounter";
|
||||||
import * as EncounterTransformationSequence from "#app/data/mystery-encounters/utils/encounter-transformation-sequence";
|
import * as EncounterTransformationSequence from "#app/data/mystery-encounters/utils/encounter-transformation-sequence";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { RewardTier } from "#enums/reward-tier";
|
import { RewardTier } from "#enums/reward-tier";
|
||||||
|
|
||||||
@ -116,8 +116,8 @@ describe("Weird Dream - Mystery Encounter", () => {
|
|||||||
const bstsPrior = pokemonPrior.map(species => species.getSpeciesForm().getBaseStatTotal());
|
const bstsPrior = pokemonPrior.map(species => species.getSpeciesForm().getBaseStatTotal());
|
||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 1);
|
await runMysteryEncounterToEnd(game, 1);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
|
|
||||||
const pokemonAfter = scene.getPlayerParty();
|
const pokemonAfter = scene.getPlayerParty();
|
||||||
const bstsAfter = pokemonAfter.map(pokemon => pokemon.getSpeciesForm().getBaseStatTotal());
|
const bstsAfter = pokemonAfter.map(pokemon => pokemon.getSpeciesForm().getBaseStatTotal());
|
||||||
@ -139,9 +139,9 @@ describe("Weird Dream - Mystery Encounter", () => {
|
|||||||
it("should have 1 Memory Mushroom, 5 Rogue Balls, and 3 Mints in rewards", async () => {
|
it("should have 1 Memory Mushroom, 5 Rogue Balls, and 3 Mints in rewards", async () => {
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.WEIRD_DREAM, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.WEIRD_DREAM, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 1);
|
await runMysteryEncounterToEnd(game, 1);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -195,9 +195,9 @@ describe("Weird Dream - Mystery Encounter", () => {
|
|||||||
await game.runToMysteryEncounter(MysteryEncounterType.WEIRD_DREAM, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.WEIRD_DREAM, defaultParty);
|
||||||
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
||||||
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
await game.phaseInterceptor.to(SelectRewardPhase, false);
|
||||||
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
|
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectRewardPhase.name);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -5,7 +5,7 @@ import { RewardTier } from "#enums/reward-tier";
|
|||||||
import type { CustomModifierSettings } from "#app/modifier/modifier-type";
|
import type { CustomModifierSettings } from "#app/modifier/modifier-type";
|
||||||
import { ModifierTypeOption } from "#app/modifier/modifier-type";
|
import { ModifierTypeOption } from "#app/modifier/modifier-type";
|
||||||
import { modifierTypes } from "#app/data/data-lists";
|
import { modifierTypes } from "#app/data/data-lists";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
import RewardSelectUiHandler from "#app/ui/reward-select-ui-handler";
|
||||||
import { UiMode } from "#enums/ui-mode";
|
import { UiMode } from "#enums/ui-mode";
|
||||||
import { shiftCharCodes } from "#app/utils/common";
|
import { shiftCharCodes } from "#app/utils/common";
|
||||||
@ -19,7 +19,7 @@ import Phaser from "phaser";
|
|||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import { TrainerItemId } from "#enums/trainer-item-id";
|
import { TrainerItemId } from "#enums/trainer-item-id";
|
||||||
|
|
||||||
describe("SelectModifierPhase", () => {
|
describe("SelectRewardPhase", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
let game: GameManager;
|
let game: GameManager;
|
||||||
let scene: BattleScene;
|
let scene: BattleScene;
|
||||||
@ -47,9 +47,9 @@ describe("SelectModifierPhase", () => {
|
|||||||
|
|
||||||
it("should start a select modifier phase", async () => {
|
it("should start a select modifier phase", async () => {
|
||||||
initSceneWithoutEncounterPhase(scene, [SpeciesId.ABRA, SpeciesId.VOLCARONA]);
|
initSceneWithoutEncounterPhase(scene, [SpeciesId.ABRA, SpeciesId.VOLCARONA]);
|
||||||
const selectModifierPhase = new SelectModifierPhase();
|
const selectModifierPhase = new SelectRewardPhase();
|
||||||
scene.phaseManager.unshiftPhase(selectModifierPhase);
|
scene.phaseManager.unshiftPhase(selectModifierPhase);
|
||||||
await game.phaseInterceptor.to(SelectModifierPhase);
|
await game.phaseInterceptor.to(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
});
|
});
|
||||||
@ -57,7 +57,7 @@ describe("SelectModifierPhase", () => {
|
|||||||
it("should generate random modifiers", async () => {
|
it("should generate random modifiers", async () => {
|
||||||
await game.classicMode.startBattle([SpeciesId.ABRA, SpeciesId.VOLCARONA]);
|
await game.classicMode.startBattle([SpeciesId.ABRA, SpeciesId.VOLCARONA]);
|
||||||
game.move.select(MoveId.FISSURE);
|
game.move.select(MoveId.FISSURE);
|
||||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
await game.phaseInterceptor.to("SelectRewardPhase");
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -74,10 +74,10 @@ describe("SelectModifierPhase", () => {
|
|||||||
new ModifierTypeOption(modifierTypes.REVIVE(), 0, 1000),
|
new ModifierTypeOption(modifierTypes.REVIVE(), 0, 1000),
|
||||||
];
|
];
|
||||||
|
|
||||||
const selectModifierPhase1 = new SelectModifierPhase(0, undefined, {
|
const selectModifierPhase1 = new SelectRewardPhase(0, undefined, {
|
||||||
guaranteedModifierTypeOptions: options,
|
guaranteedModifierTypeOptions: options,
|
||||||
});
|
});
|
||||||
const selectModifierPhase2 = new SelectModifierPhase(0, undefined, {
|
const selectModifierPhase2 = new SelectRewardPhase(0, undefined, {
|
||||||
guaranteedModifierTypeOptions: options,
|
guaranteedModifierTypeOptions: options,
|
||||||
rerollMultiplier: 2,
|
rerollMultiplier: 2,
|
||||||
});
|
});
|
||||||
@ -93,10 +93,10 @@ describe("SelectModifierPhase", () => {
|
|||||||
scene.shopCursorTarget = 0;
|
scene.shopCursorTarget = 0;
|
||||||
|
|
||||||
game.move.select(MoveId.FISSURE);
|
game.move.select(MoveId.FISSURE);
|
||||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
await game.phaseInterceptor.to("SelectRewardPhase");
|
||||||
|
|
||||||
// TODO: nagivate the ui to reroll somehow
|
// TODO: nagivate the ui to reroll somehow
|
||||||
//const smphase = scene.phaseManager.getCurrentPhase() as SelectModifierPhase;
|
//const smphase = scene.phaseManager.getCurrentPhase() as SelectRewardPhase;
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
h => h instanceof RewardSelectUiHandler,
|
h => h instanceof RewardSelectUiHandler,
|
||||||
@ -123,7 +123,7 @@ describe("SelectModifierPhase", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
game.move.select(MoveId.FISSURE);
|
game.move.select(MoveId.FISSURE);
|
||||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
await game.phaseInterceptor.to("SelectRewardPhase");
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -163,10 +163,10 @@ describe("SelectModifierPhase", () => {
|
|||||||
modifierTypes.GOLDEN_PUNCH,
|
modifierTypes.GOLDEN_PUNCH,
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
const selectModifierPhase = new SelectModifierPhase(0, undefined, customModifiers);
|
const selectModifierPhase = new SelectRewardPhase(0, undefined, customModifiers);
|
||||||
scene.phaseManager.unshiftPhase(selectModifierPhase);
|
scene.phaseManager.unshiftPhase(selectModifierPhase);
|
||||||
game.move.select(MoveId.SPLASH);
|
game.move.select(MoveId.SPLASH);
|
||||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
await game.phaseInterceptor.to("SelectRewardPhase");
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -200,10 +200,10 @@ describe("SelectModifierPhase", () => {
|
|||||||
}
|
}
|
||||||
scene.getPlayerParty().push(pokemon, pokemon, pokemon, pokemon, pokemon, pokemon);
|
scene.getPlayerParty().push(pokemon, pokemon, pokemon, pokemon, pokemon, pokemon);
|
||||||
|
|
||||||
const selectModifierPhase = new SelectModifierPhase(0, undefined, customModifiers);
|
const selectModifierPhase = new SelectRewardPhase(0, undefined, customModifiers);
|
||||||
scene.phaseManager.unshiftPhase(selectModifierPhase);
|
scene.phaseManager.unshiftPhase(selectModifierPhase);
|
||||||
game.move.select(MoveId.SPLASH);
|
game.move.select(MoveId.SPLASH);
|
||||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
await game.phaseInterceptor.to("SelectRewardPhase");
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -239,10 +239,10 @@ describe("SelectModifierPhase", () => {
|
|||||||
guaranteedModifierTypeFuncs: [modifierTypes.MEMORY_MUSHROOM, modifierTypes.TM_COMMON],
|
guaranteedModifierTypeFuncs: [modifierTypes.MEMORY_MUSHROOM, modifierTypes.TM_COMMON],
|
||||||
guaranteedModifierTiers: [RewardTier.MASTER, RewardTier.MASTER],
|
guaranteedModifierTiers: [RewardTier.MASTER, RewardTier.MASTER],
|
||||||
};
|
};
|
||||||
const selectModifierPhase = new SelectModifierPhase(0, undefined, customModifiers);
|
const selectModifierPhase = new SelectRewardPhase(0, undefined, customModifiers);
|
||||||
scene.phaseManager.unshiftPhase(selectModifierPhase);
|
scene.phaseManager.unshiftPhase(selectModifierPhase);
|
||||||
game.move.select(MoveId.SPLASH);
|
game.move.select(MoveId.SPLASH);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
@ -263,10 +263,10 @@ describe("SelectModifierPhase", () => {
|
|||||||
guaranteedModifierTiers: [RewardTier.MASTER],
|
guaranteedModifierTiers: [RewardTier.MASTER],
|
||||||
fillRemaining: true,
|
fillRemaining: true,
|
||||||
};
|
};
|
||||||
const selectModifierPhase = new SelectModifierPhase(0, undefined, customModifiers);
|
const selectModifierPhase = new SelectRewardPhase(0, undefined, customModifiers);
|
||||||
scene.phaseManager.unshiftPhase(selectModifierPhase);
|
scene.phaseManager.unshiftPhase(selectModifierPhase);
|
||||||
game.move.select(MoveId.SPLASH);
|
game.move.select(MoveId.SPLASH);
|
||||||
await game.phaseInterceptor.run(SelectModifierPhase);
|
await game.phaseInterceptor.run(SelectRewardPhase);
|
||||||
|
|
||||||
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||||
const modifierSelectHandler = scene.ui.handlers.find(
|
const modifierSelectHandler = scene.ui.handlers.find(
|
||||||
|
@ -311,10 +311,10 @@ export default class GameManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Queue up button presses to skip taking an item on the next {@linkcode SelectModifierPhase} */
|
/** Queue up button presses to skip taking an item on the next {@linkcode SelectRewardPhase} */
|
||||||
doSelectModifier() {
|
doSelectModifier() {
|
||||||
this.onNextPrompt(
|
this.onNextPrompt(
|
||||||
"SelectModifierPhase",
|
"SelectRewardPhase",
|
||||||
UiMode.MODIFIER_SELECT,
|
UiMode.MODIFIER_SELECT,
|
||||||
() => {
|
() => {
|
||||||
const handler = this.scene.ui.getHandler() as RewardSelectUiHandler;
|
const handler = this.scene.ui.getHandler() as RewardSelectUiHandler;
|
||||||
@ -328,7 +328,7 @@ export default class GameManager {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.onNextPrompt(
|
this.onNextPrompt(
|
||||||
"SelectModifierPhase",
|
"SelectRewardPhase",
|
||||||
UiMode.CONFIRM,
|
UiMode.CONFIRM,
|
||||||
() => {
|
() => {
|
||||||
const handler = this.scene.ui.getHandler() as RewardSelectUiHandler;
|
const handler = this.scene.ui.getHandler() as RewardSelectUiHandler;
|
||||||
@ -369,7 +369,7 @@ export default class GameManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queue up button presses to skip taking an item on the next {@linkcode SelectModifierPhase},
|
* Queue up button presses to skip taking an item on the next {@linkcode SelectRewardPhase},
|
||||||
* and then transition to the next {@linkcode CommandPhase}.
|
* and then transition to the next {@linkcode CommandPhase}.
|
||||||
*/
|
*/
|
||||||
async toNextWave() {
|
async toNextWave() {
|
||||||
|
@ -7,7 +7,7 @@ export class ModifierHelper extends GameManagerHelper {
|
|||||||
/**
|
/**
|
||||||
* Adds a Modifier to the list of modifiers to check for.
|
* Adds a Modifier to the list of modifiers to check for.
|
||||||
*
|
*
|
||||||
* Note that all modifiers are updated during the start of `SelectModifierPhase`.
|
* Note that all modifiers are updated during the start of `SelectRewardPhase`.
|
||||||
* @param modifier The Modifier to add.
|
* @param modifier The Modifier to add.
|
||||||
* @returns `this`
|
* @returns `this`
|
||||||
*/
|
*/
|
||||||
@ -23,7 +23,7 @@ export class ModifierHelper extends GameManagerHelper {
|
|||||||
*
|
*
|
||||||
* If the item is *not* in the Modifier Pool, will return `false`.
|
* If the item is *not* in the Modifier Pool, will return `false`.
|
||||||
*
|
*
|
||||||
* If a `SelectModifierPhase` has not occurred, and we do not know if the item is in the Modifier Pool or not, will return `undefined`.
|
* If a `SelectRewardPhase` has not occurred, and we do not know if the item is in the Modifier Pool or not, will return `undefined`.
|
||||||
* @param modifier
|
* @param modifier
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
@ -34,7 +34,7 @@ export class ModifierHelper extends GameManagerHelper {
|
|||||||
/**
|
/**
|
||||||
* `expect`s a Modifier `toBeTruthy` (in the Modifier Pool) or `Falsy` (unobtainable on this floor). Use during a test.
|
* `expect`s a Modifier `toBeTruthy` (in the Modifier Pool) or `Falsy` (unobtainable on this floor). Use during a test.
|
||||||
*
|
*
|
||||||
* Note that if a `SelectModifierPhase` has not been run yet, these values will be `undefined`, and the check will fail.
|
* Note that if a `SelectRewardPhase` has not been run yet, these values will be `undefined`, and the check will fail.
|
||||||
* @param modifier The modifier to check.
|
* @param modifier The modifier to check.
|
||||||
* @param expectToBePreset Whether the Modifier should be in the Modifier Pool. Set to `false` to expect it to be absent instead.
|
* @param expectToBePreset Whether the Modifier should be in the Modifier Pool. Set to `false` to expect it to be absent instead.
|
||||||
* @returns `this`
|
* @returns `this`
|
||||||
|
@ -26,7 +26,7 @@ import { NextEncounterPhase } from "#app/phases/next-encounter-phase";
|
|||||||
import { PostSummonPhase } from "#app/phases/post-summon-phase";
|
import { PostSummonPhase } from "#app/phases/post-summon-phase";
|
||||||
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
|
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
|
||||||
import { SelectGenderPhase } from "#app/phases/select-gender-phase";
|
import { SelectGenderPhase } from "#app/phases/select-gender-phase";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectRewardPhase } from "#app/phases/select-reward-phase";
|
||||||
import { SelectStarterPhase } from "#app/phases/select-starter-phase";
|
import { SelectStarterPhase } from "#app/phases/select-starter-phase";
|
||||||
import { SelectTargetPhase } from "#app/phases/select-target-phase";
|
import { SelectTargetPhase } from "#app/phases/select-target-phase";
|
||||||
import { ShinySparklePhase } from "#app/phases/shiny-sparkle-phase";
|
import { ShinySparklePhase } from "#app/phases/shiny-sparkle-phase";
|
||||||
@ -122,7 +122,7 @@ export default class PhaseInterceptor {
|
|||||||
[TurnEndPhase, this.startPhase],
|
[TurnEndPhase, this.startPhase],
|
||||||
[BattleEndPhase, this.startPhase],
|
[BattleEndPhase, this.startPhase],
|
||||||
[EggLapsePhase, this.startPhase],
|
[EggLapsePhase, this.startPhase],
|
||||||
[SelectModifierPhase, this.startPhase],
|
[SelectRewardPhase, this.startPhase],
|
||||||
[NextEncounterPhase, this.startPhase],
|
[NextEncounterPhase, this.startPhase],
|
||||||
[NewBattlePhase, this.startPhase],
|
[NewBattlePhase, this.startPhase],
|
||||||
[VictoryPhase, this.startPhase],
|
[VictoryPhase, this.startPhase],
|
||||||
@ -163,7 +163,7 @@ export default class PhaseInterceptor {
|
|||||||
TitlePhase,
|
TitlePhase,
|
||||||
SelectGenderPhase,
|
SelectGenderPhase,
|
||||||
CommandPhase,
|
CommandPhase,
|
||||||
SelectModifierPhase,
|
SelectRewardPhase,
|
||||||
MysteryEncounterPhase,
|
MysteryEncounterPhase,
|
||||||
PostMysteryEncounterPhase,
|
PostMysteryEncounterPhase,
|
||||||
];
|
];
|
||||||
|
@ -43,7 +43,7 @@ describe("UI - Transfer Items", () => {
|
|||||||
|
|
||||||
game.move.select(MoveId.DRAGON_CLAW);
|
game.move.select(MoveId.DRAGON_CLAW);
|
||||||
|
|
||||||
game.onNextPrompt("SelectModifierPhase", UiMode.MODIFIER_SELECT, () => {
|
game.onNextPrompt("SelectRewardPhase", UiMode.MODIFIER_SELECT, () => {
|
||||||
expect(game.scene.ui.getHandler()).toBeInstanceOf(RewardSelectUiHandler);
|
expect(game.scene.ui.getHandler()).toBeInstanceOf(RewardSelectUiHandler);
|
||||||
|
|
||||||
const handler = game.scene.ui.getHandler() as RewardSelectUiHandler;
|
const handler = game.scene.ui.getHandler() as RewardSelectUiHandler;
|
||||||
@ -57,7 +57,7 @@ describe("UI - Transfer Items", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("check red tint for held item limit in transfer menu", async () => {
|
it("check red tint for held item limit in transfer menu", async () => {
|
||||||
game.onNextPrompt("SelectModifierPhase", UiMode.PARTY, () => {
|
game.onNextPrompt("SelectRewardPhase", UiMode.PARTY, () => {
|
||||||
expect(game.scene.ui.getHandler()).toBeInstanceOf(PartyUiHandler);
|
expect(game.scene.ui.getHandler()).toBeInstanceOf(PartyUiHandler);
|
||||||
|
|
||||||
const handler = game.scene.ui.getHandler() as PartyUiHandler;
|
const handler = game.scene.ui.getHandler() as PartyUiHandler;
|
||||||
@ -76,11 +76,11 @@ describe("UI - Transfer Items", () => {
|
|||||||
game.phaseInterceptor.unlock();
|
game.phaseInterceptor.unlock();
|
||||||
});
|
});
|
||||||
|
|
||||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
await game.phaseInterceptor.to("SelectRewardPhase");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("check transfer option for pokemon to transfer to", async () => {
|
it("check transfer option for pokemon to transfer to", async () => {
|
||||||
game.onNextPrompt("SelectModifierPhase", UiMode.PARTY, () => {
|
game.onNextPrompt("SelectRewardPhase", UiMode.PARTY, () => {
|
||||||
expect(game.scene.ui.getHandler()).toBeInstanceOf(PartyUiHandler);
|
expect(game.scene.ui.getHandler()).toBeInstanceOf(PartyUiHandler);
|
||||||
|
|
||||||
const handler = game.scene.ui.getHandler() as PartyUiHandler;
|
const handler = game.scene.ui.getHandler() as PartyUiHandler;
|
||||||
@ -97,6 +97,6 @@ describe("UI - Transfer Items", () => {
|
|||||||
game.phaseInterceptor.unlock();
|
game.phaseInterceptor.unlock();
|
||||||
});
|
});
|
||||||
|
|
||||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
await game.phaseInterceptor.to("SelectRewardPhase");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user