mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-21 14:59:26 +02:00
some unit test cleanup and general tidying
This commit is contained in:
parent
dcc99ebea0
commit
ecf9103350
@ -19,6 +19,7 @@ import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
||||
import { CustomModifierSettings } from "#app/modifier/modifier-type";
|
||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { isNullOrUndefined } from "./utils";
|
||||
|
||||
export enum ClassicFixedBossWaves {
|
||||
// TODO: other fixed wave battles should be added here
|
||||
@ -414,7 +415,7 @@ export default class Battle {
|
||||
* Returns if the battle is of type {@linkcode BattleType.MYSTERY_ENCOUNTER}
|
||||
*/
|
||||
isBattleMysteryEncounter(): boolean {
|
||||
return this.battleType === BattleType.MYSTERY_ENCOUNTER;
|
||||
return !isNullOrUndefined(this.battleType) && this.battleType === BattleType.MYSTERY_ENCOUNTER;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import Pokemon, { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
|
||||
import {
|
||||
BerryModifierType,
|
||||
BerryModifierType, getPartyLuckValue,
|
||||
ModifierPoolType,
|
||||
ModifierTypeOption, modifierTypes,
|
||||
regenerateModifierPoolThresholds,
|
||||
@ -30,8 +30,6 @@ import { BerryType } from "#enums/berry-type";
|
||||
import { PERMANENT_STATS, Stat } from "#enums/stat";
|
||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { Species } from "#enums/species";
|
||||
|
||||
/** the i18n namespace for the encounter */
|
||||
const namespace = "mysteryEncounters/berriesAbound";
|
||||
@ -59,8 +57,7 @@ export const BerriesAboundEncounter: MysteryEncounter =
|
||||
|
||||
// Calculate boss mon
|
||||
const level = getEncounterPokemonLevelForWave(scene, STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER);
|
||||
// const bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getParty()), true);
|
||||
const bossSpecies = getPokemonSpecies(Species.KELDEO);
|
||||
const bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getParty()), true);
|
||||
const bossPokemon = new EnemyPokemon(scene, bossSpecies, level, TrainerSlot.NONE, true);
|
||||
encounter.setDialogueToken("enemyPokemon", getPokemonNameWithAffix(bossPokemon));
|
||||
const config: EnemyPartyConfig = {
|
||||
|
@ -361,10 +361,10 @@ export const BugTypeSuperfanEncounter: MysteryEncounter =
|
||||
const specialOptions: ModifierTypeOption[] = [];
|
||||
|
||||
if (!scene.findModifier(m => m instanceof MegaEvolutionAccessModifier)) {
|
||||
specialOptions.push(generateModifierTypeOption(scene, modifierTypes.MEGA_BRACELET)!);
|
||||
modifierOptions.push(generateModifierTypeOption(scene, modifierTypes.MEGA_BRACELET)!);
|
||||
}
|
||||
if (!scene.findModifier(m => m instanceof GigantamaxAccessModifier)) {
|
||||
specialOptions.push(generateModifierTypeOption(scene, modifierTypes.DYNAMAX_BAND)!);
|
||||
modifierOptions.push(generateModifierTypeOption(scene, modifierTypes.DYNAMAX_BAND)!);
|
||||
}
|
||||
const nonRareEvolutionModifier = generateModifierTypeOption(scene, modifierTypes.EVOLUTION_ITEM);
|
||||
if (nonRareEvolutionModifier) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { SettingKeys } from "../../settings/settings";
|
||||
import { AbilityAttr, defaultStarterSpecies, DexAttr, SystemSaveData, SessionSaveData } from "../../game-data";
|
||||
import { allSpecies } from "../../../data/pokemon-species";
|
||||
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
|
||||
|
||||
export const systemMigrators = [
|
||||
/**
|
||||
@ -132,19 +131,5 @@ export const sessionMigrators = [
|
||||
m.className = "ResetNegativeStatStageModifier";
|
||||
}
|
||||
});
|
||||
|
||||
// Fix Pokemon nature overrides and custom data migration
|
||||
data.party.forEach(pokemon => {
|
||||
if (pokemon["mysteryEncounterData"]) {
|
||||
pokemon.customPokemonData = new CustomPokemonData(pokemon["mysteryEncounterData"]);
|
||||
}
|
||||
if (pokemon["fusionMysteryEncounterData"]) {
|
||||
pokemon.fusionCustomPokemonData = new CustomPokemonData(pokemon["fusionMysteryEncounterData"]);
|
||||
}
|
||||
pokemon.customPokemonData = pokemon.customPokemonData ?? new CustomPokemonData();
|
||||
if (pokemon["natureOverride"]) {
|
||||
pokemon.customPokemonData.nature = pokemon["natureOverride"];
|
||||
}
|
||||
});
|
||||
}
|
||||
] as const;
|
||||
|
@ -476,10 +476,11 @@ describe("Bug-Type Superfan - Mystery Encounter", () => {
|
||||
|
||||
expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT);
|
||||
const modifierSelectHandler = scene.ui.handlers.find(h => h instanceof ModifierSelectUiHandler) as ModifierSelectUiHandler;
|
||||
expect(modifierSelectHandler.options.length).toEqual(3);
|
||||
expect(modifierSelectHandler.options.length).toEqual(4);
|
||||
expect(modifierSelectHandler.options[0].modifierTypeOption.type.id).toBe("MASTER_BALL");
|
||||
expect(modifierSelectHandler.options[1].modifierTypeOption.type.id).toBe("MAX_LURE");
|
||||
expect(modifierSelectHandler.options[2].modifierTypeOption.type.id).toBe("FORM_CHANGE_ITEM");
|
||||
expect(modifierSelectHandler.options[1].modifierTypeOption.type.id).toBe("MEGA_BRACELET");
|
||||
expect(modifierSelectHandler.options[2].modifierTypeOption.type.id).toBe("DYNAMAX_BAND");
|
||||
expect(modifierSelectHandler.options[3].modifierTypeOption.type.id).toBe("FORM_CHANGE_ITEM");
|
||||
});
|
||||
|
||||
it("should leave encounter without battle", async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user