diff --git a/src/data/mystery-encounters/encounters/dark-deal.ts b/src/data/mystery-encounters/encounters/dark-deal.ts index 7bdbac2a42f..95757c901ab 100644 --- a/src/data/mystery-encounters/encounters/dark-deal.ts +++ b/src/data/mystery-encounters/encounters/dark-deal.ts @@ -1,5 +1,15 @@ +import { Type } from "#app/data/type"; +import { ModifierRewardPhase } from "#app/phases"; +import { isNullOrUndefined, randSeedInt } from "#app/utils"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import { Species } from "#enums/species"; import BattleScene from "../../../battle-scene"; import { AddPokeballModifierType } from "../../../modifier/modifier-type"; +import { PokeballType } from "../../pokeball"; +import { getPokemonSpecies } from "../../pokemon-species"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; +import { PartySizeRequirement } from "../mystery-encounter-requirements"; import { EnemyPartyConfig, EnemyPokemonConfig, getRandomPlayerPokemon, @@ -7,16 +17,6 @@ import { 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"; // Exclude Ultra Beasts, Paradox, Necrozma, Eternatus, and egg-locked mythicals const excludedBosses = [ @@ -83,7 +83,7 @@ export const DarkDealEncounter: MysteryEncounter = MysteryEncounterBuilder repeat: true } ]) - .withSceneRequirement(new WaveCountRequirement([30, 180])) // waves 30 to 180 + .withSceneWaveRangeRequirement(30, 180) // waves 30 to 180 .withSceneRequirement(new PartySizeRequirement([2, 6])) // Must have at least 2 pokemon in party .withCatchAllowed(true) .withOption(new MysteryEncounterOptionBuilder() diff --git a/src/data/mystery-encounters/encounters/department-store-sale.ts b/src/data/mystery-encounters/encounters/department-store-sale.ts index a60b6dfa4bf..38b599c5390 100644 --- a/src/data/mystery-encounters/encounters/department-store-sale.ts +++ b/src/data/mystery-encounters/encounters/department-store-sale.ts @@ -1,15 +1,14 @@ -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 { MysteryEncounterType } from "#enums/mystery-encounter-type"; -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 { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import { Species } from "#enums/species"; +import BattleScene from "../../../battle-scene"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; export const DepartmentStoreSaleEncounter: MysteryEncounter = MysteryEncounterBuilder .withEncounterType(MysteryEncounterType.DEPARTMENT_STORE_SALE) @@ -30,7 +29,7 @@ export const DepartmentStoreSaleEncounter: MysteryEncounter = MysteryEncounterBu } ]) // .withHideIntroVisuals(false) - .withSceneRequirement(new WaveCountRequirement([10, 100])) + .withSceneWaveRangeRequirement(10, 100) .withOption(new MysteryEncounterOptionBuilder() .withOptionPhase(async (scene: BattleScene) => { // Choose TMs diff --git a/src/data/mystery-encounters/encounters/fight-or-flight.ts b/src/data/mystery-encounters/encounters/fight-or-flight.ts index 6b852ea7512..e5f58cb7cda 100644 --- a/src/data/mystery-encounters/encounters/fight-or-flight.ts +++ b/src/data/mystery-encounters/encounters/fight-or-flight.ts @@ -1,5 +1,4 @@ -import BattleScene from "../../../battle-scene"; -import { ModifierTier } from "#app/modifier/modifier-tier"; +import { BattleStat } from "#app/data/battle-stat"; import { EnemyPartyConfig, initBattleWithEnemyConfig, @@ -7,10 +6,8 @@ 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 Pokemon from "#app/field/pokemon"; +import { ModifierTier } from "#app/modifier/modifier-tier"; import { getPartyLuckValue, getPlayerModifierTypeOptions, @@ -18,13 +15,16 @@ 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 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 { BattlerTagType } from "#enums/battler-tag-type"; +import { Moves } from "#enums/moves"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import BattleScene from "../../../battle-scene"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; +import { MoveRequirement } from "../mystery-encounter-requirements"; const validMovesForSteal = [ Moves.PLUCK, @@ -40,7 +40,7 @@ export const FightOrFlightEncounter: MysteryEncounter = MysteryEncounterBuilder .withEncounterType(MysteryEncounterType.FIGHT_OR_FLIGHT) .withEncounterTier(MysteryEncounterTier.COMMON) .withIntroSpriteConfigs([]) // Set in onInit() - .withSceneRequirement(new WaveCountRequirement([10, 180])) // waves 10 to 180 + .withSceneWaveRangeRequirement(10, 180) // waves 10 to 180 .withCatchAllowed(true) .withHideWildIntroMessage(true) .withOnInit((scene: BattleScene) => { diff --git a/src/data/mystery-encounters/encounters/mysterious-challengers.ts b/src/data/mystery-encounters/encounters/mysterious-challengers.ts index 25b39b0667a..df363e89c2d 100644 --- a/src/data/mystery-encounters/encounters/mysterious-challengers.ts +++ b/src/data/mystery-encounters/encounters/mysterious-challengers.ts @@ -1,25 +1,24 @@ -import BattleScene from "../../../battle-scene"; -import { ModifierTier } from "#app/modifier/modifier-tier"; -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 { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; -import { WaveCountRequirement } from "../mystery-encounter-requirements"; import { trainerConfigs, TrainerPartyCompoundTemplate, TrainerPartyTemplate, trainerPartyTemplates } from "#app/data/trainer-config"; -import * as Utils from "../../../utils"; +import { ModifierTier } from "#app/modifier/modifier-tier"; +import { modifierTypes } from "#app/modifier/modifier-type"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { PartyMemberStrength } from "#enums/party-member-strength"; +import BattleScene from "../../../battle-scene"; +import * as Utils from "../../../utils"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounterBuilder .withEncounterType(MysteryEncounterType.MYSTERIOUS_CHALLENGERS) .withEncounterTier(MysteryEncounterTier.GREAT) .withIntroSpriteConfigs([]) // These are set in onInit() - .withSceneRequirement(new WaveCountRequirement([10, 180])) // waves 10 to 180 + .withSceneWaveRangeRequirement(10, 180) // waves 10 to 180 .withOnInit((scene: BattleScene) => { const encounter = scene.currentBattle.mysteryEncounter; // Calculates what trainers are available for battle in the encounter diff --git a/src/data/mystery-encounters/encounters/mysterious-chest.ts b/src/data/mystery-encounters/encounters/mysterious-chest.ts index 8ad0a5adb52..9068c8521a5 100644 --- a/src/data/mystery-encounters/encounters/mysterious-chest.ts +++ b/src/data/mystery-encounters/encounters/mysterious-chest.ts @@ -1,5 +1,3 @@ -import BattleScene from "../../../battle-scene"; -import { ModifierTier } from "#app/modifier/modifier-tier"; import { getHighestLevelPlayerPokemon, koPlayerPokemon, @@ -8,12 +6,13 @@ 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 { WaveCountRequirement } from "../mystery-encounter-requirements"; -import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; +import { ModifierTier } from "#app/modifier/modifier-tier"; import { GameOverPhase } from "#app/phases"; import { randSeedInt } from "#app/utils"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import BattleScene from "../../../battle-scene"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; export const MysteriousChestEncounter: MysteryEncounter = MysteryEncounterBuilder .withEncounterType(MysteryEncounterType.MYSTERIOUS_CHEST) @@ -29,7 +28,7 @@ export const MysteriousChestEncounter: MysteryEncounter = MysteryEncounterBuilde } ]) .withHideIntroVisuals(false) - .withSceneRequirement(new WaveCountRequirement([10, 180])) // waves 2 to 180 + .withSceneWaveRangeRequirement(10, 180) // waves 2 to 180 .withOption(new MysteryEncounterOptionBuilder() .withPreOptionPhase(async (scene: BattleScene) => { // Play animation diff --git a/src/data/mystery-encounters/encounters/shady-vitamin-dealer.ts b/src/data/mystery-encounters/encounters/shady-vitamin-dealer.ts index 866b63f7533..1cdfdfa00e0 100644 --- a/src/data/mystery-encounters/encounters/shady-vitamin-dealer.ts +++ b/src/data/mystery-encounters/encounters/shady-vitamin-dealer.ts @@ -1,4 +1,3 @@ -import BattleScene from "../../../battle-scene"; import { generateModifierType, leaveEncounterWithoutBattle, @@ -7,20 +6,20 @@ import { setEncounterRewards, updatePlayerMoney, } from "#app/data/mystery-encounters/mystery-encounter-utils"; -import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import { StatusEffect } from "#app/data/status-effect"; +import Pokemon, { PlayerPokemon } from "#app/field/pokemon"; +import { modifierTypes } from "#app/modifier/modifier-type"; +import { randSeedInt } from "#app/utils"; import { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import { Species } from "#enums/species"; +import BattleScene from "../../../battle-scene"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; import { HealthRatioRequirement, MoneyRequirement, - StatusEffectRequirement, - WaveCountRequirement + StatusEffectRequirement } 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"; export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBuilder .withEncounterType(MysteryEncounterType.SHADY_VITAMIN_DEALER) @@ -42,7 +41,7 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui y: 2 } ]) - .withSceneRequirement(new WaveCountRequirement([10, 180])) + .withSceneWaveRangeRequirement(10, 180) .withPrimaryPokemonRequirement(new StatusEffectRequirement([StatusEffect.NONE])) // Pokemon must not have status .withPrimaryPokemonRequirement(new HealthRatioRequirement([0.34, 1])) // Pokemon must have above 1/3rd HP .withOption(new MysteryEncounterOptionBuilder() diff --git a/src/data/mystery-encounters/encounters/sleeping-snorlax.ts b/src/data/mystery-encounters/encounters/sleeping-snorlax.ts index 3c94da5129b..9931ff1c16d 100644 --- a/src/data/mystery-encounters/encounters/sleeping-snorlax.ts +++ b/src/data/mystery-encounters/encounters/sleeping-snorlax.ts @@ -1,4 +1,18 @@ +import { + ModifierTypeOption, + modifierTypes +} from "#app/modifier/modifier-type"; +import { BerryType } from "#enums/berry-type"; +import { Moves } from "#enums/moves"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import { Species } from "#enums/species"; import BattleScene from "../../../battle-scene"; +import * as Utils from "../../../utils"; +import { getPokemonSpecies } from "../../pokemon-species"; +import { Status, StatusEffect } from "../../status-effect"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; +import { MoveRequirement } from "../mystery-encounter-requirements"; import { EnemyPartyConfig, EnemyPokemonConfig, generateModifierType, @@ -6,20 +20,6 @@ import { 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"; -import { - ModifierTypeOption, - modifierTypes -} from "#app/modifier/modifier-type"; -import { getPokemonSpecies } from "../../pokemon-species"; -import { Species } from "#enums/species"; -import { Status, StatusEffect } from "../../status-effect"; -import { Moves } from "#enums/moves"; -import { BerryType } from "#enums/berry-type"; export const SleepingSnorlaxEncounter: MysteryEncounter = MysteryEncounterBuilder .withEncounterType(MysteryEncounterType.SLEEPING_SNORLAX) @@ -33,7 +33,7 @@ export const SleepingSnorlaxEncounter: MysteryEncounter = MysteryEncounterBuilde repeat: true } ]) - .withSceneRequirement(new WaveCountRequirement([10, 180])) // waves 10 to 180 + .withSceneWaveRangeRequirement(10, 180) // waves 10 to 180 .withCatchAllowed(true) .withHideWildIntroMessage(true) .withOnInit((scene: BattleScene) => { diff --git a/src/data/mystery-encounters/encounters/training-session.ts b/src/data/mystery-encounters/encounters/training-session.ts index ad5da7ded36..e6167171036 100644 --- a/src/data/mystery-encounters/encounters/training-session.ts +++ b/src/data/mystery-encounters/encounters/training-session.ts @@ -1,4 +1,4 @@ -import BattleScene from "../../../battle-scene"; +import { Ability, allAbilities } from "#app/data/ability"; import { EnemyPartyConfig, getEncounterText, @@ -6,23 +6,22 @@ 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 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 { speciesStarters } from "#app/data/pokemon-species"; +import { Stat } from "#app/data/pokemon-stat"; +import { PlayerPokemon } from "#app/field/pokemon"; +import { pokemonInfo } from "#app/locales/en/pokemon-info"; 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 PokemonData from "#app/system/pokemon-data"; +import { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"; +import { randSeedShuffle } from "#app/utils"; +import { BattlerTagType } from "#enums/battler-tag-type"; +import { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import BattleScene from "../../../battle-scene"; +import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; export const TrainingSessionEncounter: MysteryEncounter = MysteryEncounterBuilder .withEncounterType(MysteryEncounterType.TRAINING_SESSION) @@ -35,7 +34,7 @@ export const TrainingSessionEncounter: MysteryEncounter = MysteryEncounterBuilde y: 3 } ]) - .withSceneRequirement(new WaveCountRequirement([10, 180])) // waves 10 to 180 + .withSceneWaveRangeRequirement(10, 180) // waves 10 to 180 .withHideWildIntroMessage(true) .withOption(new MysteryEncounterOptionBuilder() .withPreOptionPhase(async (scene: BattleScene): Promise => { diff --git a/src/data/mystery-encounters/mystery-encounter-requirements.ts b/src/data/mystery-encounters/mystery-encounter-requirements.ts index 9e530e451c6..8781e5a4cdc 100644 --- a/src/data/mystery-encounters/mystery-encounter-requirements.ts +++ b/src/data/mystery-encounters/mystery-encounter-requirements.ts @@ -71,7 +71,7 @@ export class PreviousEncounterRequirement extends EncounterSceneRequirement { } } -export class WaveCountRequirement extends EncounterSceneRequirement { +export class WaveRangeRequirement extends EncounterSceneRequirement { waveRange: [number, number]; /** diff --git a/src/data/mystery-encounters/mystery-encounter.ts b/src/data/mystery-encounters/mystery-encounter.ts index 8071dc81c8f..37038af684c 100644 --- a/src/data/mystery-encounters/mystery-encounter.ts +++ b/src/data/mystery-encounters/mystery-encounter.ts @@ -7,7 +7,8 @@ import MysteryEncounterDialogue, { import MysteryEncounterOption from "./mystery-encounter-option"; import { EncounterPokemonRequirement, - EncounterSceneRequirement + EncounterSceneRequirement, + WaveRangeRequirement } from "./mystery-encounter-requirements"; import * as Utils from "../../utils"; import { EnemyPartyConfig } from "#app/data/mystery-encounters/mystery-encounter-utils"; @@ -430,6 +431,17 @@ export class MysteryEncounterBuilder implements Partial { return Object.assign(this, { requirements: this.requirements }); } + /** + * Specifies a wave range requirement for an encounter. + * + * @param min min wave (or exact wave if only min is given) + * @param max optional max wave. If not given, defaults to min => exact wave + * @returns + */ + withSceneWaveRangeRequirement(min: number, max?: number) { + return this.withSceneRequirement(new WaveRangeRequirement([min, max ?? min])); + } + withPrimaryPokemonRequirement(requirement: EncounterPokemonRequirement): this & Required> { this.primaryPokemonRequirements.push(requirement); return Object.assign(this, { primaryPokemonRequirements: this.primaryPokemonRequirements });