diff --git a/src/data/mystery-encounters/dialogue/dark-deal-dialogue.ts b/src/data/mystery-encounters/dialogue/dark-deal-dialogue.ts index 2fe86b04640..25b31f79a50 100644 --- a/src/data/mystery-encounters/dialogue/dark-deal-dialogue.ts +++ b/src/data/mystery-encounters/dialogue/dark-deal-dialogue.ts @@ -1,4 +1,4 @@ -import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; +import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue"; export const DarkDealDialogue: MysteryEncounterDialogue = { intro: [ diff --git a/src/data/mystery-encounters/dialogue/department-store-sale-dialogue.ts b/src/data/mystery-encounters/dialogue/department-store-sale-dialogue.ts index 3a9b75b9f83..87cd8dbda55 100644 --- a/src/data/mystery-encounters/dialogue/department-store-sale-dialogue.ts +++ b/src/data/mystery-encounters/dialogue/department-store-sale-dialogue.ts @@ -1,4 +1,4 @@ -import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; +import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue"; export const DepartmentStoreSaleDialogue: MysteryEncounterDialogue = { intro: [ diff --git a/src/data/mystery-encounters/dialogue/fight-or-flight-dialogue.ts b/src/data/mystery-encounters/dialogue/fight-or-flight-dialogue.ts index 300f6c45992..93d46548d7f 100644 --- a/src/data/mystery-encounters/dialogue/fight-or-flight-dialogue.ts +++ b/src/data/mystery-encounters/dialogue/fight-or-flight-dialogue.ts @@ -1,4 +1,4 @@ -import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; +import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue"; export const FightOrFlightDialogue: MysteryEncounterDialogue = { intro: [ diff --git a/src/data/mystery-encounters/dialogue/mysterious-challengers-dialogue.ts b/src/data/mystery-encounters/dialogue/mysterious-challengers-dialogue.ts index a5699736a36..065cfceb1b7 100644 --- a/src/data/mystery-encounters/dialogue/mysterious-challengers-dialogue.ts +++ b/src/data/mystery-encounters/dialogue/mysterious-challengers-dialogue.ts @@ -1,4 +1,4 @@ -import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; +import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue"; export const MysteriousChallengersDialogue: MysteryEncounterDialogue = { intro: [ diff --git a/src/data/mystery-encounters/dialogue/mysterious-chest-dialogue.ts b/src/data/mystery-encounters/dialogue/mysterious-chest-dialogue.ts index cc14670d5b4..ba8dafc6826 100644 --- a/src/data/mystery-encounters/dialogue/mysterious-chest-dialogue.ts +++ b/src/data/mystery-encounters/dialogue/mysterious-chest-dialogue.ts @@ -1,4 +1,4 @@ -import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; +import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue"; export const MysteriousChestDialogue: MysteryEncounterDialogue = { intro: [ diff --git a/src/data/mystery-encounters/dialogue/shady-vitamin-dealer.ts b/src/data/mystery-encounters/dialogue/shady-vitamin-dealer.ts index 4a9d48913c5..cb0c5ac130e 100644 --- a/src/data/mystery-encounters/dialogue/shady-vitamin-dealer.ts +++ b/src/data/mystery-encounters/dialogue/shady-vitamin-dealer.ts @@ -1,4 +1,4 @@ -import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; +import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue"; export const ShadyVitaminDealerDialogue: MysteryEncounterDialogue = { intro: [ diff --git a/src/data/mystery-encounters/dialogue/sleeping-snorlax-dialogue.ts b/src/data/mystery-encounters/dialogue/sleeping-snorlax-dialogue.ts index 0d9381d8278..c10835f728e 100644 --- a/src/data/mystery-encounters/dialogue/sleeping-snorlax-dialogue.ts +++ b/src/data/mystery-encounters/dialogue/sleeping-snorlax-dialogue.ts @@ -1,4 +1,4 @@ -import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; +import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue"; export const SleepingSnorlaxDialogue: MysteryEncounterDialogue = { intro: [ diff --git a/src/data/mystery-encounters/dialogue/training-session-dialogue.ts b/src/data/mystery-encounters/dialogue/training-session-dialogue.ts index 9f49fc389b6..87f30ca14c2 100644 --- a/src/data/mystery-encounters/dialogue/training-session-dialogue.ts +++ b/src/data/mystery-encounters/dialogue/training-session-dialogue.ts @@ -1,4 +1,4 @@ -import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; +import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue"; export const TrainingSessionDialogue: MysteryEncounterDialogue = { intro: [ diff --git a/src/data/mystery-encounters/dark-deal.ts b/src/data/mystery-encounters/encounters/dark-deal.ts similarity index 83% rename from src/data/mystery-encounters/dark-deal.ts rename to src/data/mystery-encounters/encounters/dark-deal.ts index a092613b612..a78144347af 100644 --- a/src/data/mystery-encounters/dark-deal.ts +++ b/src/data/mystery-encounters/encounters/dark-deal.ts @@ -1,22 +1,22 @@ -import BattleScene from "../../battle-scene"; -import {AddPokeballModifierType} from "../../modifier/modifier-type"; +import BattleScene from "../../../battle-scene"; +import { AddPokeballModifierType } from "../../../modifier/modifier-type"; import { EnemyPartyConfig, EnemyPokemonConfig, getRandomPlayerPokemon, getRandomSpeciesByStarterTier, initBattleWithEnemyConfig, leaveEncounterWithoutBattle -} from "./mystery-encounter-utils"; -import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; -import {ModifierRewardPhase} from "#app/phases"; -import {getPokemonSpecies} from "../pokemon-species"; -import {MysteryEncounterType} from "#enums/mystery-encounter-type"; -import {PokeballType} from "../pokeball"; -import {PartySizeRequirement, WaveCountRequirement} from "../mystery-encounter-requirements"; -import {MysteryEncounterOptionBuilder} from "../mystery-encounter-option"; -import {Type} from "#app/data/type"; -import {Species} from "#enums/species"; -import {isNullOrUndefined, randSeedInt} from "#app/utils"; +} from "../mystery-encounter-utils"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import { ModifierRewardPhase } from "#app/phases"; +import { getPokemonSpecies } from "../../pokemon-species"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import { PokeballType } from "../../pokeball"; +import { PartySizeRequirement, WaveCountRequirement } from "../mystery-encounter-requirements"; +import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; +import { Type } from "#app/data/type"; +import { Species } from "#enums/species"; +import { isNullOrUndefined, randSeedInt } from "#app/utils"; // Exclude Ultra Beasts, Paradox, Necrozma, Eternatus, and egg-locked mythicals const excludedBosses = [ diff --git a/src/data/mystery-encounters/department-store-sale.ts b/src/data/mystery-encounters/encounters/department-store-sale.ts similarity index 86% rename from src/data/mystery-encounters/department-store-sale.ts rename to src/data/mystery-encounters/encounters/department-store-sale.ts index 6ed4bce5262..935ed635f9e 100644 --- a/src/data/mystery-encounters/department-store-sale.ts +++ b/src/data/mystery-encounters/encounters/department-store-sale.ts @@ -1,15 +1,15 @@ -import BattleScene from "../../battle-scene"; +import BattleScene from "../../../battle-scene"; import { leaveEncounterWithoutBattle, setEncounterExp, setEncounterRewards, } from "#app/data/mystery-encounters/mystery-encounter-utils"; -import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; -import {WaveCountRequirement} from "../mystery-encounter-requirements"; +import { WaveCountRequirement } from "../mystery-encounter-requirements"; import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; -import {modifierTypes} from "#app/modifier/modifier-type"; -import {Species} from "#enums/species"; -import {randSeedInt} from "#app/utils"; +import { modifierTypes } from "#app/modifier/modifier-type"; +import { Species } from "#enums/species"; +import { randSeedInt } from "#app/utils"; export const DepartmentStoreSaleEncounter: MysteryEncounter = new MysteryEncounterBuilder() .withEncounterType(MysteryEncounterType.DEPARTMENT_STORE_SALE) @@ -50,7 +50,7 @@ export const DepartmentStoreSaleEncounter: MysteryEncounter = new MysteryEncount } setEncounterExp(scene, scene.getParty().map(p => p.id), 300); - setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false}); + setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false }); leaveEncounterWithoutBattle(scene); }) .build()) @@ -70,7 +70,7 @@ export const DepartmentStoreSaleEncounter: MysteryEncounter = new MysteryEncount i++; } - setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false}); + setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false }); leaveEncounterWithoutBattle(scene); }) .build()) @@ -90,7 +90,7 @@ export const DepartmentStoreSaleEncounter: MysteryEncounter = new MysteryEncount i++; } - setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false}); + setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false }); leaveEncounterWithoutBattle(scene); }) .build()) @@ -108,13 +108,13 @@ export const DepartmentStoreSaleEncounter: MysteryEncounter = new MysteryEncount modifiers.push(modifierTypes.GREAT_BALL); } else if (roll < 60) { modifiers.push(modifierTypes.ULTRA_BALL); - } else { + } else { modifiers.push(modifierTypes.ROGUE_BALL); } i++; } - setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false}); + setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false }); leaveEncounterWithoutBattle(scene); }) .build()) diff --git a/src/data/mystery-encounters/fight-or-flight.ts b/src/data/mystery-encounters/encounters/fight-or-flight.ts similarity index 87% rename from src/data/mystery-encounters/fight-or-flight.ts rename to src/data/mystery-encounters/encounters/fight-or-flight.ts index 1deb26149ee..8669f6259fe 100644 --- a/src/data/mystery-encounters/fight-or-flight.ts +++ b/src/data/mystery-encounters/encounters/fight-or-flight.ts @@ -1,5 +1,5 @@ -import BattleScene from "../../battle-scene"; -import {ModifierTier} from "#app/modifier/modifier-tier"; +import BattleScene from "../../../battle-scene"; +import { ModifierTier } from "#app/modifier/modifier-tier"; import { EnemyPartyConfig, initBattleWithEnemyConfig, @@ -7,10 +7,10 @@ import { setEncounterRewards, showEncounterText } from "#app/data/mystery-encounters/mystery-encounter-utils"; -import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; -import {MysteryEncounterType} from "#enums/mystery-encounter-type"; -import {MoveRequirement, WaveCountRequirement} from "../mystery-encounter-requirements"; -import {MysteryEncounterOptionBuilder} from "../mystery-encounter-option"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import { MoveRequirement, WaveCountRequirement } from "../mystery-encounter-requirements"; +import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; import { getPartyLuckValue, getPlayerModifierTypeOptions, @@ -18,13 +18,13 @@ import { ModifierTypeOption, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type"; -import {BattlerTagType} from "#enums/battler-tag-type"; -import {StatChangePhase} from "#app/phases"; -import {BattleStat} from "#app/data/battle-stat"; +import { BattlerTagType } from "#enums/battler-tag-type"; +import { StatChangePhase } from "#app/phases"; +import { BattleStat } from "#app/data/battle-stat"; import Pokemon from "#app/field/pokemon"; -import {randSeedInt} from "#app/utils"; -import {Moves} from "#enums/moves"; -import {TextStyle} from "#app/ui/text"; +import { randSeedInt } from "#app/utils"; +import { Moves } from "#enums/moves"; +import { TextStyle } from "#app/ui/text"; const validMovesForSteal = [ Moves.PLUCK, @@ -50,7 +50,7 @@ export const FightOrFlightEncounter: MysteryEncounter = new MysteryEncounterBuil const bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, scene.currentBattle.waveIndex, 0, getPartyLuckValue(scene.getParty()), true); const config: EnemyPartyConfig = { levelAdditiveMultiplier: 1, - pokemonConfigs: [{species: bossSpecies, isBoss: true}] + pokemonConfigs: [{ species: bossSpecies, isBoss: true }] }; encounter.enemyPartyConfigs = [config]; @@ -58,7 +58,7 @@ export const FightOrFlightEncounter: MysteryEncounter = new MysteryEncounterBuil // 10-60 GREAT, 60-110 ULTRA, 110-160 ROGUE, 160-180 MASTER const tier = scene.currentBattle.waveIndex > 160 ? ModifierTier.MASTER : scene.currentBattle.waveIndex > 110 ? ModifierTier.ROGUE : scene.currentBattle.waveIndex > 60 ? ModifierTier.ULTRA : ModifierTier.GREAT; regenerateModifierPoolThresholds(scene.getParty(), ModifierPoolType.PLAYER, 0); // refresh player item pool - const item = getPlayerModifierTypeOptions(1, scene.getParty(), [], { guaranteedModifierTiers: [tier]})[0]; + const item = getPlayerModifierTypeOptions(1, scene.getParty(), [], { guaranteedModifierTiers: [tier] })[0]; encounter.setDialogueToken("itemName", item.type.name); encounter.misc = item; @@ -103,7 +103,7 @@ export const FightOrFlightEncounter: MysteryEncounter = new MysteryEncounterBuil .withOptionPhase(async (scene: BattleScene) => { // Pick battle const item = scene.currentBattle.mysteryEncounter.misc as ModifierTypeOption; - setEncounterRewards(scene, { guaranteedModifierTypeOptions: [item], fillRemaining: false}); + setEncounterRewards(scene, { guaranteedModifierTypeOptions: [item], fillRemaining: false }); await initBattleWithEnemyConfig(scene, scene.currentBattle.mysteryEncounter.enemyPartyConfigs[0]); }) .build()) @@ -112,7 +112,7 @@ export const FightOrFlightEncounter: MysteryEncounter = new MysteryEncounterBuil // Pick steal const encounter = scene.currentBattle.mysteryEncounter; const item = scene.currentBattle.mysteryEncounter.misc as ModifierTypeOption; - setEncounterRewards(scene, { guaranteedModifierTypeOptions: [item], fillRemaining: false}); + setEncounterRewards(scene, { guaranteedModifierTypeOptions: [item], fillRemaining: false }); // If player has a stealing move, they succeed automatically const moveRequirement = new MoveRequirement(validMovesForSteal); diff --git a/src/data/mystery-encounters/mysterious-challengers.ts b/src/data/mystery-encounters/encounters/mysterious-challengers.ts similarity index 95% rename from src/data/mystery-encounters/mysterious-challengers.ts rename to src/data/mystery-encounters/encounters/mysterious-challengers.ts index 6986b738b4c..d3e753cc91b 100644 --- a/src/data/mystery-encounters/mysterious-challengers.ts +++ b/src/data/mystery-encounters/encounters/mysterious-challengers.ts @@ -1,9 +1,9 @@ -import BattleScene from "../../battle-scene"; +import BattleScene from "../../../battle-scene"; import { ModifierTier } from "#app/modifier/modifier-tier"; -import {modifierTypes} from "#app/modifier/modifier-type"; +import { modifierTypes } from "#app/modifier/modifier-type"; import { EnemyPartyConfig, initBattleWithEnemyConfig, setEncounterRewards } from "#app/data/mystery-encounters/mystery-encounter-utils"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; -import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; import { WaveCountRequirement } from "../mystery-encounter-requirements"; import { @@ -12,8 +12,8 @@ import { TrainerPartyTemplate, trainerPartyTemplates } from "#app/data/trainer-config"; -import * as Utils from "../../utils"; -import {PartyMemberStrength} from "#enums/party-member-strength"; +import * as Utils from "../../../utils"; +import { PartyMemberStrength } from "#enums/party-member-strength"; export const MysteriousChallengersEncounter: MysteryEncounter = new MysteryEncounterBuilder() .withEncounterType(MysteryEncounterType.MYSTERIOUS_CHALLENGERS) diff --git a/src/data/mystery-encounters/mysterious-chest.ts b/src/data/mystery-encounters/encounters/mysterious-chest.ts similarity index 89% rename from src/data/mystery-encounters/mysterious-chest.ts rename to src/data/mystery-encounters/encounters/mysterious-chest.ts index 7e221424650..9f8faf278fa 100644 --- a/src/data/mystery-encounters/mysterious-chest.ts +++ b/src/data/mystery-encounters/encounters/mysterious-chest.ts @@ -1,4 +1,4 @@ -import BattleScene from "../../battle-scene"; +import BattleScene from "../../../battle-scene"; import { ModifierTier } from "#app/modifier/modifier-tier"; import { getHighestLevelPlayerPokemon, @@ -8,12 +8,12 @@ import { setEncounterRewards, showEncounterText } from "#app/data/mystery-encounters/mystery-encounter-utils"; -import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; -import {WaveCountRequirement} from "../mystery-encounter-requirements"; +import { WaveCountRequirement } from "../mystery-encounter-requirements"; import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; -import {GameOverPhase} from "#app/phases"; -import {randSeedInt} from "#app/utils"; +import { GameOverPhase } from "#app/phases"; +import { randSeedInt } from "#app/utils"; export const MysteriousChestEncounter: MysteryEncounter = new MysteryEncounterBuilder() .withEncounterType(MysteryEncounterType.MYSTERIOUS_CHEST) @@ -42,25 +42,25 @@ export const MysteriousChestEncounter: MysteryEncounter = new MysteryEncounterBu const roll = randSeedInt(100); if (roll > 60) { // Choose between 2 COMMON / 2 GREAT tier items (40%) - setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.COMMON, ModifierTier.COMMON, ModifierTier.GREAT, ModifierTier.GREAT]}); + setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.COMMON, ModifierTier.COMMON, ModifierTier.GREAT, ModifierTier.GREAT] }); // Display result message then proceed to rewards queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_normal_result"); leaveEncounterWithoutBattle(scene); } else if (roll > 40) { // Choose between 3 ULTRA tier items (20%) - setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ULTRA, ModifierTier.ULTRA, ModifierTier.ULTRA]}); + setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ULTRA, ModifierTier.ULTRA, ModifierTier.ULTRA] }); // Display result message then proceed to rewards queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_good_result"); leaveEncounterWithoutBattle(scene); } else if (roll > 36) { // Choose between 2 ROGUE tier items (4%) - setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ROGUE]}); + setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ROGUE] }); // Display result message then proceed to rewards queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_great_result"); leaveEncounterWithoutBattle(scene); } else if (roll > 35) { // Choose 1 MASTER tier item (1%) - setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.MASTER]}); + setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.MASTER] }); // Display result message then proceed to rewards queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_amazing_result"); leaveEncounterWithoutBattle(scene); diff --git a/src/data/mystery-encounters/mystery-encounters.ts b/src/data/mystery-encounters/encounters/mystery-encounters.ts similarity index 70% rename from src/data/mystery-encounters/mystery-encounters.ts rename to src/data/mystery-encounters/encounters/mystery-encounters.ts index 003b544ce50..b9966d3891a 100644 --- a/src/data/mystery-encounters/mystery-encounters.ts +++ b/src/data/mystery-encounters/encounters/mystery-encounters.ts @@ -1,21 +1,21 @@ import MysteryEncounter from "../mystery-encounter"; -import {DarkDealEncounter} from "./dark-deal"; -import {MysteriousChallengersEncounter} from "./mysterious-challengers"; -import {MysteriousChestEncounter} from "./mysterious-chest"; -import {FightOrFlightEncounter} from "#app/data/mystery-encounters/fight-or-flight"; -import {TrainingSessionEncounter} from "#app/data/mystery-encounters/training-session"; -import { Biome } from "#app/enums/biome"; +import { DarkDealEncounter } from "./dark-deal"; +import { MysteriousChallengersEncounter } from "./mysterious-challengers"; +import { MysteriousChestEncounter } from "./mysterious-chest"; +import { FightOrFlightEncounter } from "#app/data/mystery-encounters/encounters/fight-or-flight"; +import { TrainingSessionEncounter } from "#app/data/mystery-encounters/encounters/training-session"; +import { Biome } from "#enums/biome"; import { SleepingSnorlaxEncounter } from "./sleeping-snorlax"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; -import {DepartmentStoreSaleEncounter} from "#app/data/mystery-encounters/department-store-sale"; -import {ShadyVitaminDealerEncounter} from "#app/data/mystery-encounters/shady-vitamin-dealer"; +import { DepartmentStoreSaleEncounter } from "#app/data/mystery-encounters/encounters/department-store-sale"; +import { ShadyVitaminDealerEncounter } from "#app/data/mystery-encounters/encounters/shady-vitamin-dealer"; // Spawn chance: (BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT + WIGHT_INCREMENT_ON_SPAWN_MISS * ) / 256 export const BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT = 1; export const WIGHT_INCREMENT_ON_SPAWN_MISS = 5; export const AVERAGE_ENCOUNTERS_PER_RUN_TARGET = 15; -export const allMysteryEncounters : {[encounterType:string]: MysteryEncounter} = {}; +export const allMysteryEncounters: { [encounterType: string]: MysteryEncounter } = {}; // Add MysteryEncounterType to biomes to enable it exclusively for those biomes // To enable an encounter in all biomes, do not add to this map @@ -23,7 +23,7 @@ export const mysteryEncountersByBiome = new Map([ [Biome.TOWN, [ MysteryEncounterType.DEPARTMENT_STORE_SALE ]], - [Biome.PLAINS,[ + [Biome.PLAINS, [ MysteryEncounterType.DEPARTMENT_STORE_SALE ]], [Biome.GRASS, [ @@ -40,90 +40,50 @@ export const mysteryEncountersByBiome = new Map([ MysteryEncounterType.SLEEPING_SNORLAX ]], - [Biome.SEA, [ - - ]], - [Biome.SWAMP, [ - - ]], + [Biome.SEA, []], + [Biome.SWAMP, []], [Biome.BEACH, [ MysteryEncounterType.DEPARTMENT_STORE_SALE ]], - [Biome.LAKE, [ - - ]], - [Biome.SEABED, [ - - ]], + [Biome.LAKE, []], + [Biome.SEABED, []], [Biome.MOUNTAIN, [ MysteryEncounterType.SLEEPING_SNORLAX ]], - [Biome.BADLANDS, [ - - ]], + [Biome.BADLANDS, []], [Biome.CAVE, [ MysteryEncounterType.SLEEPING_SNORLAX ]], - [Biome.DESERT, [ - - ]], - [Biome.ICE_CAVE, [ - - ]], + [Biome.DESERT, []], + [Biome.ICE_CAVE, []], [Biome.MEADOW, [ MysteryEncounterType.DEPARTMENT_STORE_SALE ]], [Biome.POWER_PLANT, [ MysteryEncounterType.DEPARTMENT_STORE_SALE ]], - [Biome.VOLCANO, [ - - ]], - [Biome.GRAVEYARD, [ - - ]], - [Biome.DOJO, [ - - ]], + [Biome.VOLCANO, []], + [Biome.GRAVEYARD, []], + [Biome.DOJO, []], [Biome.FACTORY, [ MysteryEncounterType.DEPARTMENT_STORE_SALE ]], - [Biome.RUINS, [ - - ]], - [Biome.WASTELAND, [ - - ]], - [Biome.ABYSS, [ - - ]], - [Biome.SPACE, [ - - ]], + [Biome.RUINS, []], + [Biome.WASTELAND, []], + [Biome.ABYSS, []], + [Biome.SPACE, []], [Biome.CONSTRUCTION_SITE, [ MysteryEncounterType.DEPARTMENT_STORE_SALE ]], - [Biome.JUNGLE, [ - - ]], - [Biome.FAIRY_CAVE, [ - - ]], - [Biome.TEMPLE, [ - - ]], + [Biome.JUNGLE, []], + [Biome.FAIRY_CAVE, []], + [Biome.TEMPLE, []], [Biome.SLUM, [ MysteryEncounterType.DEPARTMENT_STORE_SALE ]], - [Biome.SNOWY_FOREST, [ - - ]], - [Biome.ISLAND, [ - - ]], - [Biome.LABORATORY, [ - - ]] + [Biome.SNOWY_FOREST, []], + [Biome.ISLAND, []], + [Biome.LABORATORY, []] ]); // Only add your MysterEncounter here if you want it to be in every biome. @@ -131,7 +91,7 @@ export const mysteryEncountersByBiome = new Map([ export function initMysteryEncounters() { allMysteryEncounters[MysteryEncounterType.MYSTERIOUS_CHALLENGERS] = MysteriousChallengersEncounter; allMysteryEncounters[MysteryEncounterType.MYSTERIOUS_CHEST] = MysteriousChestEncounter; - allMysteryEncounters[MysteryEncounterType.DARK_DEAL] = DarkDealEncounter; + allMysteryEncounters[MysteryEncounterType.DARK_DEAL] = DarkDealEncounter; allMysteryEncounters[MysteryEncounterType.FIGHT_OR_FLIGHT] = FightOrFlightEncounter; allMysteryEncounters[MysteryEncounterType.TRAINING_SESSION] = TrainingSessionEncounter; allMysteryEncounters[MysteryEncounterType.SLEEPING_SNORLAX] = SleepingSnorlaxEncounter; diff --git a/src/data/mystery-encounters/shady-vitamin-dealer.ts b/src/data/mystery-encounters/encounters/shady-vitamin-dealer.ts similarity index 89% rename from src/data/mystery-encounters/shady-vitamin-dealer.ts rename to src/data/mystery-encounters/encounters/shady-vitamin-dealer.ts index b6ac5eacd22..06cdfbff4c8 100644 --- a/src/data/mystery-encounters/shady-vitamin-dealer.ts +++ b/src/data/mystery-encounters/encounters/shady-vitamin-dealer.ts @@ -1,4 +1,4 @@ -import BattleScene from "../../battle-scene"; +import BattleScene from "../../../battle-scene"; import { generateModifierType, leaveEncounterWithoutBattle, @@ -7,20 +7,20 @@ import { setEncounterRewards, updatePlayerMoney, } from "#app/data/mystery-encounters/mystery-encounter-utils"; -import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; -import {MysteryEncounterType} from "#enums/mystery-encounter-type"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { HealthRatioRequirement, MoneyRequirement, StatusEffectRequirement, WaveCountRequirement } from "../mystery-encounter-requirements"; -import {MysteryEncounterOptionBuilder} from "../mystery-encounter-option"; -import {modifierTypes} from "#app/modifier/modifier-type"; -import {Species} from "#enums/species"; -import {randSeedInt} from "#app/utils"; -import Pokemon, {PlayerPokemon} from "#app/field/pokemon"; -import {StatusEffect} from "#app/data/status-effect"; +import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; +import { modifierTypes } from "#app/modifier/modifier-type"; +import { Species } from "#enums/species"; +import { randSeedInt } from "#app/utils"; +import Pokemon, { PlayerPokemon } from "#app/field/pokemon"; +import { StatusEffect } from "#app/data/status-effect"; export const ShadyVitaminDealerEncounter: MysteryEncounter = new MysteryEncounterBuilder() .withEncounterType(MysteryEncounterType.SHADY_VITAMIN_DEALER) @@ -134,7 +134,7 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = new MysteryEncounte i++; } - setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false}); + setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false }); leaveEncounterWithoutBattle(scene); }) .build()) diff --git a/src/data/mystery-encounters/sleeping-snorlax.ts b/src/data/mystery-encounters/encounters/sleeping-snorlax.ts similarity index 82% rename from src/data/mystery-encounters/sleeping-snorlax.ts rename to src/data/mystery-encounters/encounters/sleeping-snorlax.ts index 410a9081db3..b75787ad566 100644 --- a/src/data/mystery-encounters/sleeping-snorlax.ts +++ b/src/data/mystery-encounters/encounters/sleeping-snorlax.ts @@ -1,23 +1,23 @@ -import BattleScene from "../../battle-scene"; +import BattleScene from "../../../battle-scene"; import { EnemyPartyConfig, EnemyPokemonConfig, generateModifierType, initBattleWithEnemyConfig, leaveEncounterWithoutBattle, queueEncounterMessage, setEncounterRewards -} from "./mystery-encounter-utils"; -import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; -import * as Utils from "../../utils"; -import {MysteryEncounterType} from "#enums/mystery-encounter-type"; -import {MoveRequirement, WaveCountRequirement} from "../mystery-encounter-requirements"; -import {MysteryEncounterOptionBuilder} from "../mystery-encounter-option"; +} from "../mystery-encounter-utils"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import * as Utils from "../../../utils"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import { MoveRequirement, WaveCountRequirement } from "../mystery-encounter-requirements"; +import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; import { ModifierTypeOption, modifierTypes } from "#app/modifier/modifier-type"; -import { getPokemonSpecies } from "../pokemon-species"; +import { getPokemonSpecies } from "../../pokemon-species"; import { Species } from "#enums/species"; -import { Status, StatusEffect } from "../status-effect"; +import { Status, StatusEffect } from "../../status-effect"; import { Moves } from "#enums/moves"; import { BerryType } from "#enums/berry-type"; @@ -65,7 +65,7 @@ export const SleepingSnorlaxEncounter: MysteryEncounter = new MysteryEncounterBu .withOption(new MysteryEncounterOptionBuilder() .withOptionPhase(async (scene: BattleScene) => { const instance = scene.currentBattle.mysteryEncounter; - let roll:integer; + let roll: integer; scene.executeWithSeedOffset(() => { roll = Utils.randSeedInt(16, 0); }, scene.currentBattle.waveIndex); @@ -73,12 +73,12 @@ export const SleepingSnorlaxEncounter: MysteryEncounter = new MysteryEncounterBu if (roll > 4) { // Fall asleep and get a sitrus berry (75%) const p = instance.primaryPokemon; - p.status = new Status(StatusEffect.SLEEP, 0, 3); + p.status = new Status(StatusEffect.SLEEP, 0, 3); p.updateInfo(true); // const sitrus = (modifierTypes.BERRY?.() as ModifierTypeGenerator).generateType(scene.getParty(), [BerryType.SITRUS]); const sitrus = generateModifierType(scene, modifierTypes.BERRY, [BerryType.SITRUS]); - setEncounterRewards(scene, { guaranteedModifierTypeOptions: [new ModifierTypeOption(sitrus, 0)], fillRemaining: false}); + setEncounterRewards(scene, { guaranteedModifierTypeOptions: [new ModifierTypeOption(sitrus, 0)], fillRemaining: false }); queueEncounterMessage(scene, "mysteryEncounter:sleeping_snorlax_option_2_bad_result"); leaveEncounterWithoutBattle(scene); } else { @@ -101,7 +101,7 @@ export const SleepingSnorlaxEncounter: MysteryEncounter = new MysteryEncounterBu .withPrimaryPokemonRequirement(new MoveRequirement([Moves.PLUCK, Moves.COVET, Moves.KNOCK_OFF, Moves.THIEF, Moves.TRICK, Moves.SWITCHEROO])) .withOptionPhase(async (scene: BattleScene) => { // Leave encounter with no rewards or exp - setEncounterRewards(scene, { guaranteedModifierTypeFuncs: [modifierTypes.LEFTOVERS], fillRemaining: false}); + setEncounterRewards(scene, { guaranteedModifierTypeFuncs: [modifierTypes.LEFTOVERS], fillRemaining: false }); queueEncounterMessage(scene, "mysteryEncounter:sleeping_snorlax_option_3_good_result"); leaveEncounterWithoutBattle(scene); }) diff --git a/src/data/mystery-encounters/training-session.ts b/src/data/mystery-encounters/encounters/training-session.ts similarity index 90% rename from src/data/mystery-encounters/training-session.ts rename to src/data/mystery-encounters/encounters/training-session.ts index ab1bacc71f9..6c50209e4ca 100644 --- a/src/data/mystery-encounters/training-session.ts +++ b/src/data/mystery-encounters/encounters/training-session.ts @@ -1,4 +1,4 @@ -import BattleScene from "../../battle-scene"; +import BattleScene from "../../../battle-scene"; import { EnemyPartyConfig, getEncounterText, @@ -6,23 +6,23 @@ import { selectPokemonForOption, setEncounterRewards } from "#app/data/mystery-encounters/mystery-encounter-utils"; -import {MysteryEncounterType} from "#enums/mystery-encounter-type"; -import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; -import {MysteryEncounterOptionBuilder} from "../mystery-encounter-option"; -import {WaveCountRequirement} from "../mystery-encounter-requirements"; -import {PlayerPokemon} from "#app/field/pokemon"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; +import { WaveCountRequirement } from "../mystery-encounter-requirements"; +import { PlayerPokemon } from "#app/field/pokemon"; import PokemonData from "#app/system/pokemon-data"; -import {randSeedShuffle} from "#app/utils"; -import {getNatureName, Nature} from "#app/data/nature"; -import {BattlerTagType} from "#enums/battler-tag-type"; -import {OptionSelectItem} from "#app/ui/abstact-option-select-ui-handler"; -import {PokemonHeldItemModifier} from "#app/modifier/modifier"; -import {PokemonHeldItemModifierType} from "#app/modifier/modifier-type"; -import {Ability, allAbilities} from "#app/data/ability"; -import {speciesStarters} from "#app/data/pokemon-species"; -import {AbilityAttr} from "#app/system/game-data"; -import {Stat} from "#app/data/pokemon-stat"; -import {pokemonInfo} from "#app/locales/en/pokemon-info"; +import { randSeedShuffle } from "#app/utils"; +import { getNatureName, Nature } from "#app/data/nature"; +import { BattlerTagType } from "#enums/battler-tag-type"; +import { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"; +import { PokemonHeldItemModifier } from "#app/modifier/modifier"; +import { PokemonHeldItemModifierType } from "#app/modifier/modifier-type"; +import { Ability, allAbilities } from "#app/data/ability"; +import { speciesStarters } from "#app/data/pokemon-species"; +import { AbilityAttr } from "#app/system/game-data"; +import { Stat } from "#app/data/pokemon-stat"; +import { pokemonInfo } from "#app/locales/en/pokemon-info"; export const TrainingSessionEncounter: MysteryEncounter = new MysteryEncounterBuilder() .withEncounterType(MysteryEncounterType.TRAINING_SESSION) @@ -83,7 +83,7 @@ export const TrainingSessionEncounter: MysteryEncounter = new MysteryEncounterBu const ivIndexes = []; playerPokemon.ivs.forEach((iv, index) => { if (iv < 31) { - ivIndexes.push({iv: iv, index: index}); + ivIndexes.push({ iv: iv, index: index }); } }); @@ -302,5 +302,6 @@ function getEnemyConfig(scene: BattleScene, playerPokemon: PlayerPokemon, segmen class ModifiersHolder { public value: PokemonHeldItemModifier[] = []; - constructor() {} + constructor() { + } } diff --git a/src/data/mystery-encounter-data.ts b/src/data/mystery-encounters/mystery-encounter-data.ts similarity index 53% rename from src/data/mystery-encounter-data.ts rename to src/data/mystery-encounters/mystery-encounter-data.ts index 922bc30cbc3..ae58d5249b3 100644 --- a/src/data/mystery-encounter-data.ts +++ b/src/data/mystery-encounters/mystery-encounter-data.ts @@ -1,7 +1,7 @@ -import {MysteryEncounterTier} from "#app/data/mystery-encounter"; -import {MysteryEncounterType} from "#enums/mystery-encounter-type"; -import {BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT} from "#app/data/mystery-encounters/mystery-encounters"; -import {isNullOrUndefined} from "../utils"; +import { MysteryEncounterTier } from "#app/data/mystery-encounters/mystery-encounter"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import { BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT } from "#app/data/mystery-encounters/encounters/mystery-encounters"; +import { isNullOrUndefined } from "#app/utils"; export class MysteryEncounterData { encounteredEvents: [MysteryEncounterType, MysteryEncounterTier][] = []; diff --git a/src/data/mystery-encounters/dialogue/mystery-encounter-dialogue.ts b/src/data/mystery-encounters/mystery-encounter-dialogue.ts similarity index 78% rename from src/data/mystery-encounters/dialogue/mystery-encounter-dialogue.ts rename to src/data/mystery-encounters/mystery-encounter-dialogue.ts index c64d9627388..0a5387639c7 100644 --- a/src/data/mystery-encounters/dialogue/mystery-encounter-dialogue.ts +++ b/src/data/mystery-encounters/mystery-encounter-dialogue.ts @@ -1,13 +1,13 @@ -import {MysteryEncounterType} from "#enums/mystery-encounter-type"; -import {MysteriousChallengersDialogue} from "#app/data/mystery-encounters/dialogue/mysterious-challengers-dialogue"; -import {MysteriousChestDialogue} from "#app/data/mystery-encounters/dialogue/mysterious-chest-dialogue"; -import {DarkDealDialogue} from "#app/data/mystery-encounters/dialogue/dark-deal-dialogue"; -import {FightOrFlightDialogue} from "#app/data/mystery-encounters/dialogue/fight-or-flight-dialogue"; -import {TrainingSessionDialogue} from "#app/data/mystery-encounters/dialogue/training-session-dialogue"; -import { SleepingSnorlaxDialogue } from "./sleeping-snorlax-dialogue"; -import {DepartmentStoreSaleDialogue} from "#app/data/mystery-encounters/dialogue/department-store-sale-dialogue"; -import {ShadyVitaminDealerDialogue} from "#app/data/mystery-encounters/dialogue/shady-vitamin-dealer"; -import {TextStyle} from "#app/ui/text"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import { MysteriousChallengersDialogue } from "#app/data/mystery-encounters/dialogue/mysterious-challengers-dialogue"; +import { MysteriousChestDialogue } from "#app/data/mystery-encounters/dialogue/mysterious-chest-dialogue"; +import { DarkDealDialogue } from "#app/data/mystery-encounters/dialogue/dark-deal-dialogue"; +import { FightOrFlightDialogue } from "#app/data/mystery-encounters/dialogue/fight-or-flight-dialogue"; +import { TrainingSessionDialogue } from "#app/data/mystery-encounters/dialogue/training-session-dialogue"; +import { SleepingSnorlaxDialogue } from "./dialogue/sleeping-snorlax-dialogue"; +import { DepartmentStoreSaleDialogue } from "#app/data/mystery-encounters/dialogue/department-store-sale-dialogue"; +import { ShadyVitaminDealerDialogue } from "#app/data/mystery-encounters/dialogue/shady-vitamin-dealer"; +import { TextStyle } from "#app/ui/text"; export class TextDisplay { speaker?: TemplateStringsArray | `mysteryEncounter:${string}`; @@ -87,7 +87,7 @@ export interface EncounterTypeDialogue { */ -export const allMysteryEncounterDialogue: EncounterTypeDialogue = {}; +export const allMysteryEncounterDialogue: EncounterTypeDialogue = {}; export function initMysteryEncounterDialogue() { allMysteryEncounterDialogue[MysteryEncounterType.MYSTERIOUS_CHALLENGERS] = MysteriousChallengersDialogue; diff --git a/src/data/mystery-encounter-option.ts b/src/data/mystery-encounters/mystery-encounter-option.ts similarity index 89% rename from src/data/mystery-encounter-option.ts rename to src/data/mystery-encounters/mystery-encounter-option.ts index 9f23a94e3f3..995b10f2714 100644 --- a/src/data/mystery-encounter-option.ts +++ b/src/data/mystery-encounters/mystery-encounter-option.ts @@ -1,13 +1,13 @@ import { PlayerPokemon } from "#app/field/pokemon"; -import * as Utils from "../utils"; -import BattleScene from "../battle-scene"; +import * as Utils from "../../utils"; +import BattleScene from "../../battle-scene"; import { EncounterPokemonRequirement, EncounterSceneRequirement } from "./mystery-encounter-requirements"; -import {OptionTextDisplay} from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; +import { OptionTextDisplay } from "#app/data/mystery-encounters/mystery-encounter-dialogue"; export default interface MysteryEncounterOption { requirements?: EncounterSceneRequirement[]; primaryPokemonRequirements?: EncounterPokemonRequirement[]; - secondaryPokemonRequirements ?: EncounterPokemonRequirement[]; + secondaryPokemonRequirements?: EncounterPokemonRequirement[]; primaryPokemon?: PlayerPokemon; secondaryPokemon?: PlayerPokemon[]; excludePrimaryFromSecondaryRequirements?: boolean; @@ -37,15 +37,16 @@ export default class MysteryEncounterOption implements MysteryEncounterOption { this.meetsPrimaryRequirementAndPrimaryPokemonSelected(scene) && this.meetsSupportingRequirementAndSupportingPokemonSelected(scene); } + meetsPrimaryRequirementAndPrimaryPokemonSelected?(scene: BattleScene) { if (!this.primaryPokemonRequirements) { return true; } - let qualified:PlayerPokemon[] = scene.getParty(); + let qualified: PlayerPokemon[] = scene.getParty(); for (const req of this.primaryPokemonRequirements) { console.log(req); if (req.meetsRequirement(scene)) { - if (req instanceof EncounterPokemonRequirement) { + if (req instanceof EncounterPokemonRequirement) { qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn)); } } else { @@ -71,14 +72,14 @@ export default class MysteryEncounterOption implements MysteryEncounterOption { } if (truePrimaryPool.length > 0) { // always choose from the non-overlapping pokemon first - this.primaryPokemon = truePrimaryPool[Utils.randSeedInt(truePrimaryPool.length, 0)]; + this.primaryPokemon = truePrimaryPool[Utils.randSeedInt(truePrimaryPool.length, 0)]; return true; } else { // if there are multiple overlapping pokemon, we're okay - just choose one and take it out of the supporting pokemon pool if (overlap.length > 1 || (this.secondaryPokemon.length - overlap.length >= 1)) { // is this working? this.primaryPokemon = overlap[Utils.randSeedInt(overlap.length, 0)]; - this.secondaryPokemon = this.secondaryPokemon.filter((supp)=> supp !== this.primaryPokemon); + this.secondaryPokemon = this.secondaryPokemon.filter((supp) => supp !== this.primaryPokemon); return true; } console.log("Mystery Encounter Edge Case: Requirement not met due to primay pokemon overlapping with support pokemon. There's no valid primary pokemon left."); @@ -97,10 +98,10 @@ export default class MysteryEncounterOption implements MysteryEncounterOption { return true; } - let qualified:PlayerPokemon[] = scene.getParty(); + let qualified: PlayerPokemon[] = scene.getParty(); for (const req of this.secondaryPokemonRequirements) { if (req.meetsRequirement(scene)) { - if (req instanceof EncounterPokemonRequirement) { + if (req instanceof EncounterPokemonRequirement) { qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn)); } @@ -150,7 +151,7 @@ export class MysteryEncounterOptionBuilder implements Partial> { + withSecondaryPokemonRequirement(requirement: EncounterPokemonRequirement, excludePrimaryFromSecondaryRequirements?: boolean): this & Required> { this.secondaryPokemonRequirements.push(requirement); this.excludePrimaryFromSecondaryRequirements = excludePrimaryFromSecondaryRequirements; return Object.assign(this, { secondaryPokemonRequirements: this.secondaryPokemonRequirements }); diff --git a/src/data/mystery-encounter-requirements.ts b/src/data/mystery-encounters/mystery-encounter-requirements.ts similarity index 93% rename from src/data/mystery-encounter-requirements.ts rename to src/data/mystery-encounters/mystery-encounter-requirements.ts index 26ca5163fe5..9e530e451c6 100644 --- a/src/data/mystery-encounter-requirements.ts +++ b/src/data/mystery-encounters/mystery-encounter-requirements.ts @@ -1,19 +1,19 @@ -import {PlayerPokemon} from "#app/field/pokemon"; -import {ModifierType, PokemonHeldItemModifierType} from "#app/modifier/modifier-type"; -import BattleScene from "../battle-scene"; -import {isNullOrUndefined} from "../utils"; -import {Abilities} from "#enums/abilities"; -import {Moves} from "#enums/moves"; -import {Species} from "#enums/species"; -import {TimeOfDay} from "#enums/time-of-day"; -import {Nature} from "./nature"; -import {EvolutionItem, pokemonEvolutions} from "./pokemon-evolutions"; -import {FormChangeItem, pokemonFormChanges, SpeciesFormChangeItemTrigger} from "./pokemon-forms"; -import {SpeciesFormKey} from "./pokemon-species"; -import {StatusEffect} from "./status-effect"; -import {Type} from "./type"; -import {WeatherType} from "./weather"; -import {MysteryEncounterType} from "#enums/mystery-encounter-type"; +import { PlayerPokemon } from "#app/field/pokemon"; +import { ModifierType, PokemonHeldItemModifierType } from "#app/modifier/modifier-type"; +import BattleScene from "../../battle-scene"; +import { isNullOrUndefined } from "#app/utils"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import { TimeOfDay } from "#enums/time-of-day"; +import { Nature } from "../nature"; +import { EvolutionItem, pokemonEvolutions } from "../pokemon-evolutions"; +import { FormChangeItem, pokemonFormChanges, SpeciesFormChangeItemTrigger } from "../pokemon-forms"; +import { SpeciesFormKey } from "../pokemon-species"; +import { StatusEffect } from "../status-effect"; +import { Type } from "../type"; +import { WeatherType } from "../weather"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; export interface EncounterRequirement { meetsRequirement(scene: BattleScene): boolean; // Boolean to see if a requirement is met @@ -147,6 +147,7 @@ export class WeatherRequirement extends EncounterSceneRequirement { return true; } + getDialogueToken(scene: BattleScene, pokemon?: PlayerPokemon): [string, string] { return ["weather", WeatherType[scene.arena?.weather?.weatherType].replace("_", " ").toLocaleLowerCase()]; } @@ -205,7 +206,7 @@ export class PersistentModifierRequirement extends EncounterSceneRequirement { getDialogueToken(scene: BattleScene, pokemon?: PlayerPokemon): [string, string] { const requiredItemsInInventory = this.requiredItems.filter((a) => { - scene.modifiers.filter((itemInScene) => itemInScene.type.id === a.id).length > 0; + scene.modifiers.filter((itemInScene) => itemInScene.type.id === a.id).length > 0; }); if (requiredItemsInInventory.length > 0) { return ["requiredItem", requiredItemsInInventory[0].name]; @@ -245,8 +246,8 @@ export class MoneyRequirement extends EncounterSceneRequirement { export class SpeciesRequirement extends EncounterPokemonRequirement { requiredSpecies: Species[]; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(species: Species | Species[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); @@ -288,8 +289,8 @@ export class SpeciesRequirement extends EncounterPokemonRequirement { export class NatureRequirement extends EncounterPokemonRequirement { requiredNature: Nature[]; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(nature: Nature | Nature[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); @@ -330,8 +331,8 @@ export class NatureRequirement extends EncounterPokemonRequirement { export class TypeRequirement extends EncounterPokemonRequirement { requiredType: Type[]; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(type: Type | Type[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); @@ -374,8 +375,8 @@ export class TypeRequirement extends EncounterPokemonRequirement { export class MoveRequirement extends EncounterPokemonRequirement { requiredMoves: Moves[] = []; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(moves: Moves | Moves[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); @@ -423,8 +424,8 @@ export class MoveRequirement extends EncounterPokemonRequirement { */ export class CompatibleMoveRequirement extends EncounterPokemonRequirement { requiredMoves: Moves[]; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(learnableMove: Moves | Moves[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); @@ -512,8 +513,8 @@ export class EvolutionTargetSpeciesRequirement extends EncounterPokemonRequireme export class AbilityRequirement extends EncounterPokemonRequirement { requiredAbilities: Abilities[]; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(abilities: Abilities | Abilities[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); @@ -557,8 +558,8 @@ export class AbilityRequirement extends EncounterPokemonRequirement { export class StatusEffectRequirement extends EncounterPokemonRequirement { requiredStatusEffect: StatusEffect[]; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(statusEffect: StatusEffect | StatusEffect[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); @@ -632,8 +633,8 @@ export class StatusEffectRequirement extends EncounterPokemonRequirement { */ export class CanFormChangeWithItemRequirement extends EncounterPokemonRequirement { requiredFormChangeItem: FormChangeItem[]; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(formChangeItem: FormChangeItem | FormChangeItem[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); @@ -654,13 +655,14 @@ export class CanFormChangeWithItemRequirement extends EncounterPokemonRequiremen } return this.queryParty(partyPokemon).length >= this.minNumberOfPokemon; } - filterByForm(pokemon, formChangeItem) { + + filterByForm(pokemon, formChangeItem) { if (pokemonFormChanges.hasOwnProperty(pokemon.species.speciesId) - // Get all form changes for this species with an item trigger, including any compound triggers - && pokemonFormChanges[pokemon.species.speciesId].filter(fc => fc.trigger.hasTriggerType(SpeciesFormChangeItemTrigger)) - // Returns true if any form changes match this item - .map(fc => fc.findTrigger(SpeciesFormChangeItemTrigger) as SpeciesFormChangeItemTrigger) - .flat().flatMap(fc => fc.item).includes(formChangeItem)) { + // Get all form changes for this species with an item trigger, including any compound triggers + && pokemonFormChanges[pokemon.species.speciesId].filter(fc => fc.trigger.hasTriggerType(SpeciesFormChangeItemTrigger)) + // Returns true if any form changes match this item + .map(fc => fc.findTrigger(SpeciesFormChangeItemTrigger) as SpeciesFormChangeItemTrigger) + .flat().flatMap(fc => fc.item).includes(formChangeItem)) { return true; } else { return false; @@ -688,8 +690,8 @@ export class CanFormChangeWithItemRequirement extends EncounterPokemonRequiremen export class CanEvolveWithItemRequirement extends EncounterPokemonRequirement { requiredEvolutionItem: EvolutionItem[]; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(evolutionItems: EvolutionItem | EvolutionItem[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); @@ -716,7 +718,7 @@ export class CanEvolveWithItemRequirement extends EncounterPokemonRequirement { && (!e.condition || e.condition.predicate(pokemon))).length && (pokemon.getFormKey() !== SpeciesFormKey.GIGANTAMAX)) { return true; } else if (pokemon.isFusion() && pokemonEvolutions.hasOwnProperty(pokemon.fusionSpecies.speciesId) && pokemonEvolutions[pokemon.fusionSpecies.speciesId].filter(e => e.item === evolutionItem - && (!e.condition || e.condition.predicate(pokemon))).length && (pokemon.getFusionFormKey() !== SpeciesFormKey.GIGANTAMAX)) { + && (!e.condition || e.condition.predicate(pokemon))).length && (pokemon.getFusionFormKey() !== SpeciesFormKey.GIGANTAMAX)) { return true; } return false; @@ -742,8 +744,8 @@ export class CanEvolveWithItemRequirement extends EncounterPokemonRequirement { export class HeldItemRequirement extends EncounterPokemonRequirement { requiredHeldItemModifier: PokemonHeldItemModifierType[]; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(heldItem: PokemonHeldItemModifierType | PokemonHeldItemModifierType[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); @@ -776,7 +778,7 @@ export class HeldItemRequirement extends EncounterPokemonRequirement { getDialogueToken(scene: BattleScene, pokemon?: PlayerPokemon): [string, string] { const requiredItems = this.requiredHeldItemModifier.filter((a) => { - pokemon.getHeldItems().filter((it) => it.type.id === a.id ).length > 0; + pokemon.getHeldItems().filter((it) => it.type.id === a.id).length > 0; }); if (requiredItems.length > 0) { return ["heldItem", requiredItems[0].name]; @@ -787,8 +789,8 @@ export class HeldItemRequirement extends EncounterPokemonRequirement { export class LevelRequirement extends EncounterPokemonRequirement { requiredLevelRange?: [number, number]; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(requiredLevelRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); @@ -826,8 +828,8 @@ export class LevelRequirement extends EncounterPokemonRequirement { export class FriendshipRequirement extends EncounterPokemonRequirement { requiredFriendshipRange?: [number, number]; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(requiredFriendshipRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); @@ -869,8 +871,8 @@ export class FriendshipRequirement extends EncounterPokemonRequirement { */ export class HealthRatioRequirement extends EncounterPokemonRequirement { requiredHealthRange?: [number, number]; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(requiredHealthRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); @@ -903,14 +905,14 @@ export class HealthRatioRequirement extends EncounterPokemonRequirement { } getDialogueToken(scene: BattleScene, pokemon?: PlayerPokemon): [string, string] { - return ["healthRatio", Math.floor(pokemon.getHpRatio()*100).toString() + "%"]; + return ["healthRatio", Math.floor(pokemon.getHpRatio() * 100).toString() + "%"]; } } export class WeightRequirement extends EncounterPokemonRequirement { requiredWeightRange?: [number, number]; - minNumberOfPokemon:number; - invertQuery:boolean; + minNumberOfPokemon: number; + invertQuery: boolean; constructor(requiredWeightRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { super(); diff --git a/src/data/mystery-encounters/mystery-encounter-utils.ts b/src/data/mystery-encounters/mystery-encounter-utils.ts index 89e497d22f9..4b898478fa3 100644 --- a/src/data/mystery-encounters/mystery-encounter-utils.ts +++ b/src/data/mystery-encounters/mystery-encounter-utils.ts @@ -1,12 +1,12 @@ import i18next from "i18next"; -import {BattleType} from "#app/battle"; +import { BattleType } from "#app/battle"; import BattleScene from "../../battle-scene"; -import PokemonSpecies, {getPokemonSpecies, speciesStarters} from "../pokemon-species"; -import {MysteryEncounterVariant} from "../mystery-encounter"; -import {Status, StatusEffect} from "../status-effect"; -import {TrainerConfig, trainerConfigs, TrainerSlot} from "../trainer-config"; -import Pokemon, {FieldPosition, PlayerPokemon} from "#app/field/pokemon"; -import Trainer, {TrainerVariant} from "../../field/trainer"; +import PokemonSpecies, { getPokemonSpecies, speciesStarters } from "../pokemon-species"; +import { MysteryEncounterVariant } from "./mystery-encounter"; +import { Status, StatusEffect } from "../status-effect"; +import { TrainerConfig, trainerConfigs, TrainerSlot } from "../trainer-config"; +import Pokemon, { FieldPosition, PlayerPokemon } from "#app/field/pokemon"; +import Trainer, { TrainerVariant } from "../../field/trainer"; import { ExpBalanceModifier, ExpShareModifier, @@ -32,24 +32,24 @@ import { ShowPartyExpBarPhase, TrainerVictoryPhase } from "#app/phases"; -import {MysteryEncounterBattlePhase, MysteryEncounterRewardsPhase} from "#app/phases/mystery-encounter-phase"; +import { MysteryEncounterBattlePhase, MysteryEncounterRewardsPhase } from "#app/phases/mystery-encounter-phase"; import * as Utils from "../../utils"; -import {isNullOrUndefined} from "#app/utils"; -import {SelectModifierPhase} from "#app/phases/select-modifier-phase"; -import {TrainerType} from "#enums/trainer-type"; -import {Species} from "#enums/species"; -import {Type} from "#app/data/type"; -import {BattlerTagType} from "#enums/battler-tag-type"; +import { isNullOrUndefined } from "#app/utils"; +import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; +import { TrainerType } from "#enums/trainer-type"; +import { Species } from "#enums/species"; +import { Type } from "#app/data/type"; +import { BattlerTagType } from "#enums/battler-tag-type"; import PokemonData from "#app/system/pokemon-data"; -import {Biome} from "#enums/biome"; -import {biomeLinks} from "#app/data/biomes"; -import {Mode} from "#app/ui/ui"; -import {PartyOption, PartyUiMode} from "#app/ui/party-ui-handler"; -import {OptionSelectConfig, OptionSelectItem} from "#app/ui/abstact-option-select-ui-handler"; -import {WIGHT_INCREMENT_ON_SPAWN_MISS} from "#app/data/mystery-encounters/mystery-encounters"; -import {getTextWithColors, TextStyle} from "#app/ui/text"; +import { Biome } from "#enums/biome"; +import { biomeLinks } from "#app/data/biomes"; +import { Mode } from "#app/ui/ui"; +import { PartyOption, PartyUiMode } from "#app/ui/party-ui-handler"; +import { OptionSelectConfig, OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"; +import { WIGHT_INCREMENT_ON_SPAWN_MISS } from "#app/data/mystery-encounters/encounters/mystery-encounters"; +import { getTextWithColors, TextStyle } from "#app/ui/text"; import * as Overrides from "#app/overrides"; -import {UiTheme} from "#enums/ui-theme"; +import { UiTheme } from "#enums/ui-theme"; /** * @@ -402,7 +402,7 @@ export async function initBattleWithEnemyConfig(scene: BattleScene, partyConfig: // Set Status if (partyConfig.pokemonConfigs[e].status) { // Default to cureturn 3 for sleep - const cureTurn = partyConfig.pokemonConfigs[e].status === StatusEffect.SLEEP ? 3: null; + const cureTurn = partyConfig.pokemonConfigs[e].status === StatusEffect.SLEEP ? 3 : null; enemyPokemon.status = new Status(partyConfig.pokemonConfigs[e].status, 0, cureTurn); } diff --git a/src/data/mystery-encounter.ts b/src/data/mystery-encounters/mystery-encounter.ts similarity index 94% rename from src/data/mystery-encounter.ts rename to src/data/mystery-encounters/mystery-encounter.ts index 090a9aa6ded..9e956e6050f 100644 --- a/src/data/mystery-encounter.ts +++ b/src/data/mystery-encounters/mystery-encounter.ts @@ -1,18 +1,18 @@ -import BattleScene from "../battle-scene"; -import MysteryEncounterIntroVisuals, { MysteryEncounterSpriteConfig } from "../field/mystery-encounter-intro"; +import BattleScene from "../../battle-scene"; +import MysteryEncounterIntroVisuals, { MysteryEncounterSpriteConfig } from "../../field/mystery-encounter-intro"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import MysteryEncounterDialogue, { allMysteryEncounterDialogue -} from "./mystery-encounters/dialogue/mystery-encounter-dialogue"; +} from "./mystery-encounter-dialogue"; import MysteryEncounterOption from "./mystery-encounter-option"; import { EncounterPokemonRequirement, EncounterSceneRequirement } from "./mystery-encounter-requirements"; -import * as Utils from "../utils"; -import {EnemyPartyConfig} from "#app/data/mystery-encounters/mystery-encounter-utils"; +import * as Utils from "../../utils"; +import { EnemyPartyConfig } from "#app/data/mystery-encounters/mystery-encounter-utils"; import Pokemon, { PlayerPokemon } from "#app/field/pokemon"; -import {isNullOrUndefined} from "../utils"; +import { isNullOrUndefined } from "#app/utils"; export enum MysteryEncounterVariant { DEFAULT, @@ -53,7 +53,7 @@ export default interface MysteryEncounter { */ requirements?: EncounterSceneRequirement[]; primaryPokemonRequirements?: EncounterPokemonRequirement[]; - secondaryPokemonRequirements ?: EncounterPokemonRequirement[]; // A list of requirements that must ALL be met by a subset of pokemon to trigger the event + secondaryPokemonRequirements?: EncounterPokemonRequirement[]; // A list of requirements that must ALL be met by a subset of pokemon to trigger the event excludePrimaryFromSupportRequirements?: boolean; // Primary Pokemon is a single pokemon randomly selected from a set of pokemon that meet ALL primary pokemon requirements primaryPokemon?: PlayerPokemon; @@ -157,7 +157,7 @@ export default class MysteryEncounter implements MysteryEncounter { * @returns */ meetsRequirements?(scene: BattleScene) { - const sceneReq = !this.requirements.some(requirement => !requirement.meetsRequirement(scene)); + const sceneReq = !this.requirements.some(requirement => !requirement.meetsRequirement(scene)); const secReqs = this.meetsSecondaryRequirementAndSecondaryPokemonSelected(scene); // secondary is checked first to handle cases of primary overlapping with secondary const priReqs = this.meetsPrimaryRequirementAndPrimaryPokemonSelected(scene); @@ -179,17 +179,17 @@ export default class MysteryEncounter implements MysteryEncounter { if (this.primaryPokemonRequirements.length === 0) { const activeMon = scene.getParty().filter(p => p.isActive(true)); if (activeMon.length > 0) { - this.primaryPokemon = activeMon[0]; + this.primaryPokemon = activeMon[0]; } else { this.primaryPokemon = scene.getParty().filter(p => !p.isFainted())[0]; } return true; } - let qualified:PlayerPokemon[] = scene.getParty(); + let qualified: PlayerPokemon[] = scene.getParty(); for (const req of this.primaryPokemonRequirements) { console.log(req); if (req.meetsRequirement(scene)) { - if (req instanceof EncounterPokemonRequirement) { + if (req instanceof EncounterPokemonRequirement) { qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn)); } } else { @@ -215,14 +215,14 @@ export default class MysteryEncounter implements MysteryEncounter { } if (truePrimaryPool.length > 0) { // always choose from the non-overlapping pokemon first - this.primaryPokemon = truePrimaryPool[Utils.randSeedInt(truePrimaryPool.length, 0)]; + this.primaryPokemon = truePrimaryPool[Utils.randSeedInt(truePrimaryPool.length, 0)]; return true; } else { // if there are multiple overlapping pokemon, we're okay - just choose one and take it out of the primary pokemon pool if (overlap.length > 1 || (this.secondaryPokemon.length - overlap.length >= 1)) { // is this working? this.primaryPokemon = overlap[Utils.randSeedInt(overlap.length, 0)]; - this.secondaryPokemon = this.secondaryPokemon.filter((supp)=> supp !== this.primaryPokemon); + this.secondaryPokemon = this.secondaryPokemon.filter((supp) => supp !== this.primaryPokemon); return true; } console.log("Mystery Encounter Edge Case: Requirement not met due to primary pokemon overlapping with secondary pokemon. There's no valid primary pokemon left."); @@ -241,10 +241,10 @@ export default class MysteryEncounter implements MysteryEncounter { return true; } - let qualified:PlayerPokemon[] = scene.getParty(); + let qualified: PlayerPokemon[] = scene.getParty(); for (const req of this.secondaryPokemonRequirements) { if (req.meetsRequirement(scene)) { - if (req instanceof EncounterPokemonRequirement) { + if (req instanceof EncounterPokemonRequirement) { qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn)); } @@ -376,9 +376,9 @@ export class MysteryEncounterBuilder implements Partial { */ withOption(option: MysteryEncounterOption): this & Pick { if (this.options[0] === null) { - return Object.assign(this, { options: [ option, this.options[0] ] }); + return Object.assign(this, { options: [option, this.options[0]] }); } else if (this.options[1] === null) { - return Object.assign(this, { options: [this.options[0], option ] }); + return Object.assign(this, { options: [this.options[0], option] }); } else { this.options.push(option); return Object.assign(this, { options: this.options }); @@ -438,7 +438,7 @@ export class MysteryEncounterBuilder implements Partial { // TODO: Maybe add an optional parameter for excluding primary pokemon from the support cast? // ex. if your only grass type pokemon, a snivy, is chosen as primary, if the support pokemon requires a grass type, the event won't trigger because // it's already been - withSecondaryPokemonRequirement(requirement: EncounterPokemonRequirement, excludePrimaryFromSecondaryRequirements:boolean = false): this & Required> { + withSecondaryPokemonRequirement(requirement: EncounterPokemonRequirement, excludePrimaryFromSecondaryRequirements: boolean = false): this & Required> { this.secondaryPokemonRequirements.push(requirement); this.excludePrimaryFromSupportRequirements = excludePrimaryFromSecondaryRequirements; return Object.assign(this, { excludePrimaryFromSecondaryRequirements: this.excludePrimaryFromSupportRequirements, secondaryPokemonRequirements: this.secondaryPokemonRequirements }); diff --git a/src/field/mystery-encounter-intro.ts b/src/field/mystery-encounter-intro.ts index 8fdbd27ac9b..adb700b4854 100644 --- a/src/field/mystery-encounter-intro.ts +++ b/src/field/mystery-encounter-intro.ts @@ -1,6 +1,6 @@ import { GameObjects } from "phaser"; import BattleScene from "../battle-scene"; -import MysteryEncounter from "../data/mystery-encounter"; +import MysteryEncounter from "../data/mystery-encounters/mystery-encounter"; export class MysteryEncounterSpriteConfig { spriteKey: string; // e.g. "ace_trainer_f" @@ -40,7 +40,7 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con const getSprite = (spriteKey: string, hasShadow?: boolean) => { const ret = this.scene.addFieldSprite(0, 0, spriteKey); ret.setOrigin(0.5, 1); - ret.setPipeline(this.scene.spritePipeline, {tone: [0.0, 0.0, 0.0, 0.0], hasShadow: !!hasShadow}); + ret.setPipeline(this.scene.spritePipeline, { tone: [0.0, 0.0, 0.0, 0.0], hasShadow: !!hasShadow }); return ret; }; diff --git a/src/loading-scene.ts b/src/loading-scene.ts index fdb9f5f6610..5407f7d9417 100644 --- a/src/loading-scene.ts +++ b/src/loading-scene.ts @@ -22,8 +22,8 @@ import { initStatsKeys } from "./ui/game-stats-ui-handler"; import { initVouchers } from "./system/voucher"; import { Biome } from "#enums/biome"; import { TrainerType } from "#enums/trainer-type"; -import {initMysteryEncounterDialogue} from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; -import {initMysteryEncounters} from "#app/data/mystery-encounters/mystery-encounters"; +import {initMysteryEncounterDialogue} from "#app/data/mystery-encounters/mystery-encounter-dialogue"; +import {initMysteryEncounters} from "#app/data/mystery-encounters/encounters/mystery-encounters"; export class LoadingScene extends SceneBase { readonly LOAD_EVENTS = Phaser.Loader.Events; diff --git a/src/locales/en/mystery-encounter.ts b/src/locales/en/mystery-encounter.ts index 8bcf5df76d9..ac04eed2688 100644 --- a/src/locales/en/mystery-encounter.ts +++ b/src/locales/en/mystery-encounter.ts @@ -1,4 +1,4 @@ -import {SimpleTranslationEntries} from "#app/interfaces/locales"; +import { SimpleTranslationEntries } from "#app/interfaces/locales"; /** * Patterns that can be used: diff --git a/src/overrides.ts b/src/overrides.ts index 6634ca32788..ce706173691 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -19,7 +19,7 @@ import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; import { TimeOfDay } from "#enums/time-of-day"; import {MysteryEncounterType} from "#enums/mystery-encounter-type"; // eslint-disable-line @typescript-eslint/no-unused-vars -import {MysteryEncounterTier} from "#app/data/mystery-encounter"; // eslint-disable-line @typescript-eslint/no-unused-vars +import {MysteryEncounterTier} from "#app/data/mystery-encounters/mystery-encounter"; // eslint-disable-line @typescript-eslint/no-unused-vars /** * Overrides for testing different in game situations diff --git a/src/phases.ts b/src/phases.ts index 730797c3d2f..015897afb50 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -65,7 +65,7 @@ import { PlayerGender } from "#enums/player-gender"; import { Species } from "#enums/species"; import { TrainerType } from "#enums/trainer-type"; import { BattlePhase } from "#app/phases/battle-phase"; -import { MysteryEncounterVariant } from "#app/data/mystery-encounter"; +import { MysteryEncounterVariant } from "#app/data/mystery-encounters/mystery-encounter"; import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phase"; import { getEncounterText, handleMysteryEncounterVictory } from "#app/data/mystery-encounters/mystery-encounter-utils"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; diff --git a/src/phases/battle-phase.ts b/src/phases/battle-phase.ts index 62c35403f3f..110ecb615e8 100644 --- a/src/phases/battle-phase.ts +++ b/src/phases/battle-phase.ts @@ -1,6 +1,6 @@ -import {Phase} from "#app/phase"; +import { Phase } from "#app/phase"; import BattleScene from "#app/battle-scene"; -import {TrainerSlot} from "#app/data/trainer-config"; +import { TrainerSlot } from "#app/data/trainer-config"; export class BattlePhase extends Phase { constructor(scene: BattleScene) { diff --git a/src/phases/mystery-encounter-phase.ts b/src/phases/mystery-encounter-phase.ts index f4a6d955fb6..6af4c42ed4d 100644 --- a/src/phases/mystery-encounter-phase.ts +++ b/src/phases/mystery-encounter-phase.ts @@ -6,16 +6,16 @@ import { getEncounterText } from "../data/mystery-encounters/mystery-encounter-utils"; import { CheckSwitchPhase, NewBattlePhase, PostSummonPhase, ReturnPhase, ScanIvsPhase, SummonPhase, ToggleDoublePositionPhase } from "../phases"; -import MysteryEncounterOption from "../data/mystery-encounter-option"; -import { MysteryEncounterVariant } from "../data/mystery-encounter"; +import MysteryEncounterOption from "../data/mystery-encounters/mystery-encounter-option"; +import { MysteryEncounterVariant } from "../data/mystery-encounters/mystery-encounter"; import { getCharVariantFromDialogue } from "../data/dialogue"; import { TrainerSlot } from "../data/trainer-config"; import { BattleSpec } from "../enums/battle-spec"; import { Tutorial, handleTutorial } from "../tutorial"; import { IvScannerModifier } from "../modifier/modifier"; import * as Utils from "../utils"; -import {SelectModifierPhase} from "#app/phases/select-modifier-phase"; -import {isNullOrUndefined} from "../utils"; +import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; +import { isNullOrUndefined } from "../utils"; /** * Will handle (in order): @@ -402,7 +402,7 @@ export class MysteryEncounterRewardsPhase extends Phase { this.scene.currentBattle.mysteryEncounter.doEncounterRewards(this.scene); } else if (this.addHealPhase) { this.scene.tryRemovePhase(p => p instanceof SelectModifierPhase); - this.scene.unshiftPhase(new SelectModifierPhase(this.scene, 0, null, { fillRemaining: false, rerollMultiplier: 0})); + this.scene.unshiftPhase(new SelectModifierPhase(this.scene, 0, null, { fillRemaining: false, rerollMultiplier: 0 })); } }, this.scene.currentBattle.waveIndex * 1000); diff --git a/src/phases/select-modifier-phase.ts b/src/phases/select-modifier-phase.ts index 5e53281ba84..0e17d9562fb 100644 --- a/src/phases/select-modifier-phase.ts +++ b/src/phases/select-modifier-phase.ts @@ -1,4 +1,4 @@ -import {ModifierTier} from "#app/modifier/modifier-tier"; +import { ModifierTier } from "#app/modifier/modifier-tier"; import { CustomModifierSettings, FusePokemonModifierType, getPlayerModifierTypeOptions, @@ -15,13 +15,13 @@ import { } from "#app/modifier/modifier-type"; import BattleScene from "#app/battle-scene"; import * as Utils from "#app/utils"; -import {ExtraModifierModifier, Modifier, PokemonHeldItemModifier} from "#app/modifier/modifier"; +import { ExtraModifierModifier, Modifier, PokemonHeldItemModifier } from "#app/modifier/modifier"; import i18next from "#app/plugins/i18n"; -import {Mode} from "#app/ui/ui"; -import PartyUiHandler, {PartyOption, PartyUiMode} from "#app/ui/party-ui-handler"; -import ModifierSelectUiHandler, {SHOP_OPTIONS_ROW_LIMIT} from "#app/ui/modifier-select-ui-handler"; -import {BattlePhase} from "#app/phases/battle-phase"; -import {isNullOrUndefined} from "#app/utils"; +import { Mode } from "#app/ui/ui"; +import PartyUiHandler, { PartyOption, PartyUiMode } from "#app/ui/party-ui-handler"; +import ModifierSelectUiHandler, { SHOP_OPTIONS_ROW_LIMIT } from "#app/ui/modifier-select-ui-handler"; +import { BattlePhase } from "#app/phases/battle-phase"; +import { isNullOrUndefined } from "#app/utils"; export class SelectModifierPhase extends BattlePhase { private rerollCount: integer; @@ -47,7 +47,7 @@ export class SelectModifierPhase extends BattlePhase { const party = this.scene.getParty(); regenerateModifierPoolThresholds(party, this.getPoolType(), this.rerollCount); - const modifierCount = new Utils.IntegerHolder(3); + const modifierCount = new Utils.IntegerHolder(3); if (this.isPlayer()) { this.scene.applyModifiers(ExtraModifierModifier, true, modifierCount); } @@ -241,7 +241,7 @@ export class SelectModifierPhase extends BattlePhase { } else { baseValue = 250; } - const multiplier = !isNullOrUndefined(this.customModifierSettings?.rerollMultiplier) ? this.customModifierSettings.rerollMultiplier : 1; + const multiplier = !isNullOrUndefined(this.customModifierSettings?.rerollMultiplier) ? this.customModifierSettings.rerollMultiplier : 1; return Math.min(Math.ceil(this.scene.currentBattle.waveIndex / 10) * baseValue * Math.pow(2, this.rerollCount) * multiplier, Number.MAX_SAFE_INTEGER); } diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 07ecfc74f0a..6c578ac4160 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -40,8 +40,8 @@ import { GameDataType } from "#enums/game-data-type"; import { Moves } from "#enums/moves"; import { PlayerGender } from "#enums/player-gender"; import { Species } from "#enums/species"; -import { MysteryEncounterData } from "../data/mystery-encounter-data"; -import MysteryEncounter from "../data/mystery-encounter"; +import { MysteryEncounterData } from "../data/mystery-encounters/mystery-encounter-data"; +import MysteryEncounter from "../data/mystery-encounters/mystery-encounter"; export const defaultStarterSpecies: Species[] = [ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE, diff --git a/src/test/mystery-encounter/mystery-encounter-utils.test.ts b/src/test/mystery-encounter/mystery-encounter-utils.test.ts index cd03033ae3b..424da4d1aff 100644 --- a/src/test/mystery-encounter/mystery-encounter-utils.test.ts +++ b/src/test/mystery-encounter/mystery-encounter-utils.test.ts @@ -10,7 +10,7 @@ import {initSceneWithoutEncounterPhase} from "#test/utils/gameManagerUtils"; import {Species} from "#enums/species"; import BattleScene from "#app/battle-scene"; import {StatusEffect} from "#app/data/status-effect"; -import MysteryEncounter from "#app/data/mystery-encounter"; +import MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter"; import {MessagePhase} from "#app/phases"; import {getPokemonSpecies, speciesStarters} from "#app/data/pokemon-species"; import {Type} from "#app/data/type"; @@ -277,7 +277,7 @@ describe("Mystery Encounter Utils", () => { scene.currentBattle.mysteryEncounter.setDialogueToken("test", "value"); const result = getEncounterText(scene, "mysteryEncounter:unit_test_dialogue"); - expect(result).toEqual("[color=#f8f8f8][shadow=#6b5a73]valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}[/color][/shadow]"); + expect(result).toEqual("valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}"); }); it("can perform nested dialogue token injection", () => { @@ -286,7 +286,7 @@ describe("Mystery Encounter Utils", () => { scene.currentBattle.mysteryEncounter.setDialogueToken("testvalue", "new"); const result = getEncounterText(scene, "mysteryEncounter:unit_test_dialogue"); - expect(result).toEqual("[color=#f8f8f8][shadow=#6b5a73]valuevalue new @ec{test1} value @ec{test\\} @ec{test\\} {test}[/color][/shadow]"); + expect(result).toEqual("valuevalue new @ec{test1} value @ec{test\\} @ec{test\\} {test}"); }); }); @@ -298,7 +298,7 @@ describe("Mystery Encounter Utils", () => { const phaseSpy = vi.spyOn(game.scene, "unshiftPhase"); queueEncounterMessage(scene, "mysteryEncounter:unit_test_dialogue"); - expect(spy).toHaveBeenCalledWith("[color=#f8f8f8][shadow=#6b5a73]valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}[/color][/shadow]", null, true); + expect(spy).toHaveBeenCalledWith("valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}", null, true); expect(phaseSpy).toHaveBeenCalledWith(expect.any(MessagePhase)); }); }); @@ -310,7 +310,7 @@ describe("Mystery Encounter Utils", () => { const spy = vi.spyOn(game.scene.ui, "showText"); showEncounterText(scene, "mysteryEncounter:unit_test_dialogue"); - expect(spy).toHaveBeenCalledWith("[color=#f8f8f8][shadow=#6b5a73]valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}[/color][/shadow]", null, expect.any(Function), 0, true); + expect(spy).toHaveBeenCalledWith("valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}", null, expect.any(Function), 0, true); }); }); @@ -321,7 +321,7 @@ describe("Mystery Encounter Utils", () => { const spy = vi.spyOn(game.scene.ui, "showDialogue"); showEncounterDialogue(scene, "mysteryEncounter:unit_test_dialogue", "mysteryEncounter:unit_test_dialogue"); - expect(spy).toHaveBeenCalledWith("[color=#f8f8f8][shadow=#6b5a73]valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}[/color][/shadow]", "[color=#f8f8f8][shadow=#6b5a73]valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}[/color][/shadow]", null, undefined, 0, 0); + expect(spy).toHaveBeenCalledWith("valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}", "valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}", null, undefined, 0, 0); }); }); diff --git a/src/test/phases/mystery-encounter-phase.test.ts b/src/test/phases/mystery-encounter-phase.test.ts index efe7dab810a..0ae9ad35ed7 100644 --- a/src/test/phases/mystery-encounter-phase.test.ts +++ b/src/test/phases/mystery-encounter-phase.test.ts @@ -8,7 +8,7 @@ import {Mode} from "#app/ui/ui"; import {Button} from "#enums/buttons"; import MysteryEncounterUiHandler from "#app/ui/mystery-encounter-ui-handler"; import {MysteryEncounterType} from "#enums/mystery-encounter-type"; -import {MysteryEncounterTier} from "#app/data/mystery-encounter"; +import {MysteryEncounterTier} from "#app/data/mystery-encounters/mystery-encounter"; describe("Mystery Encounter Phases", () => { let phaserGame: Phaser.Game; @@ -89,8 +89,8 @@ describe("Mystery Encounter Phases", () => { expect(dialogueSpy).toHaveBeenCalledTimes(1); expect(messageSpy).toHaveBeenCalledTimes(2); expect(dialogueSpy).toHaveBeenCalledWith("What's this?", "???", null, expect.any(Function)); - expect(messageSpy).toHaveBeenCalledWith("[color=#f8f8f8][shadow=#6b5a73]Mysterious challengers have appeared![/color][/shadow]", null, expect.any(Function), 750, true); - expect(messageSpy).toHaveBeenCalledWith("[color=#f8f8f8][shadow=#6b5a73]The trainer steps forward...[/color][/shadow]", null, expect.any(Function), 750, true); + expect(messageSpy).toHaveBeenCalledWith("Mysterious challengers have appeared!", null, expect.any(Function), 750, true); + expect(messageSpy).toHaveBeenCalledWith("The trainer steps forward...", null, expect.any(Function), 750, true); }); }); diff --git a/src/ui/modifier-select-ui-handler.ts b/src/ui/modifier-select-ui-handler.ts index e9fc495a847..c5c3f94b75d 100644 --- a/src/ui/modifier-select-ui-handler.ts +++ b/src/ui/modifier-select-ui-handler.ts @@ -6,7 +6,7 @@ import AwaitableUiHandler from "./awaitable-ui-handler"; import { Mode } from "./ui"; import { LockModifierTiersModifier, PokemonHeldItemModifier } from "../modifier/modifier"; import { handleTutorial, Tutorial } from "../tutorial"; -import {Button} from "#enums/buttons"; +import { Button } from "#enums/buttons"; import MoveInfoOverlay from "./move-info-overlay"; import { allMoves } from "../data/move"; import * as Utils from "./../utils"; @@ -23,8 +23,8 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { private continueButtonContainer: Phaser.GameObjects.Container; private rerollCostText: Phaser.GameObjects.Text; private lockRarityButtonText: Phaser.GameObjects.Text; - private moveInfoOverlay : MoveInfoOverlay; - private moveInfoOverlayActive : boolean = false; + private moveInfoOverlay: MoveInfoOverlay; + private moveInfoOverlayActive: boolean = false; private rowCursor: integer = 0; private player: boolean; @@ -52,7 +52,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { const canvas = document.createElement("canvas"); const context = canvas.getContext("2d"); - const [ , styleOptions, , , ] = getTextStyleOptions(TextStyle.PARTY, (this.scene as BattleScene).uiTheme); + const [, styleOptions, , ,] = getTextStyleOptions(TextStyle.PARTY, (this.scene as BattleScene).uiTheme); context.font = styleOptions.fontSize + "px " + styleOptions.fontFamily; this.transferButtonWidth = context.measureText(i18next.t("modifierSelectUiHandler:transfer")).width; this.checkButtonWidth = context.measureText(i18next.t("modifierSelectUiHandler:checkTeam")).width; @@ -113,7 +113,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { onSide: true, right: true, x: 1, - y: -MoveInfoOverlay.getHeight(overlayScale, true) -1, + y: -MoveInfoOverlay.getHeight(overlayScale, true) - 1, width: (this.scene.game.canvas.width / 6) - 2, }); ui.add(this.moveInfoOverlay); @@ -433,10 +433,10 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { this.cursorObj.setPosition(6, this.lockRarityButtonContainer.visible ? -72 : -60); ui.showText(i18next.t("modifierSelectUiHandler:rerollDesc")); } else if (cursor === 1) { - this.cursorObj.setPosition((this.scene.game.canvas.width - this.transferButtonWidth - this.checkButtonWidth)/6 - 30, -60); + this.cursorObj.setPosition((this.scene.game.canvas.width - this.transferButtonWidth - this.checkButtonWidth) / 6 - 30, -60); ui.showText(i18next.t("modifierSelectUiHandler:transferDesc")); } else if (cursor === 2) { - this.cursorObj.setPosition((this.scene.game.canvas.width - this.checkButtonWidth)/6 - 10, -60); + this.cursorObj.setPosition((this.scene.game.canvas.width - this.checkButtonWidth) / 6 - 10, -60); ui.showText(i18next.t("modifierSelectUiHandler:checkTeamDesc")); } else { this.cursorObj.setPosition(6, -60); diff --git a/src/ui/mystery-encounter-ui-handler.ts b/src/ui/mystery-encounter-ui-handler.ts index 7714f280197..163d79784f8 100644 --- a/src/ui/mystery-encounter-ui-handler.ts +++ b/src/ui/mystery-encounter-ui-handler.ts @@ -6,7 +6,7 @@ import {Button} from "#enums/buttons"; import {addWindow, WindowVariant} from "./ui-theme"; import {MysteryEncounterPhase} from "../phases/mystery-encounter-phase"; import {PartyUiMode} from "./party-ui-handler"; -import MysteryEncounterOption from "../data/mystery-encounter-option"; +import MysteryEncounterOption from "../data/mystery-encounters/mystery-encounter-option"; import * as Utils from "../utils"; import {isNullOrUndefined} from "../utils"; import {getPokeballAtlasKey} from "../data/pokeball";