add `MysteryEncounterBuilder.withScenePartySizeRequirement`
This commit is contained in:
parent
25d0bd39ee
commit
adf52bf604
|
@ -9,7 +9,6 @@ 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,
|
||||
|
@ -84,7 +83,7 @@ export const DarkDealEncounter: MysteryEncounter = MysteryEncounterBuilder
|
|||
}
|
||||
])
|
||||
.withSceneWaveRangeRequirement(30, 180) // waves 30 to 180
|
||||
.withSceneRequirement(new PartySizeRequirement([2, 6])) // Must have at least 2 pokemon in party
|
||||
.withScenePartySizeRequirement(2, 6) // Must have at least 2 pokemon in party
|
||||
.withCatchAllowed(true)
|
||||
.withOption(new MysteryEncounterOptionBuilder()
|
||||
.withPreOptionPhase(async (scene: BattleScene) => {
|
||||
|
|
|
@ -8,6 +8,7 @@ import MysteryEncounterOption from "./mystery-encounter-option";
|
|||
import {
|
||||
EncounterPokemonRequirement,
|
||||
EncounterSceneRequirement,
|
||||
PartySizeRequirement,
|
||||
WaveRangeRequirement
|
||||
} from "./mystery-encounter-requirements";
|
||||
import * as Utils from "../../utils";
|
||||
|
@ -442,6 +443,17 @@ export class MysteryEncounterBuilder implements Partial<MysteryEncounter> {
|
|||
return this.withSceneRequirement(new WaveRangeRequirement([min, max ?? min]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a party size requirement for an encounter.
|
||||
*
|
||||
* @param min min wave (or exact size if only min is given)
|
||||
* @param max optional max size. If not given, defaults to min => exact wave
|
||||
* @returns
|
||||
*/
|
||||
withScenePartySizeRequirement(min: number, max?: number) {
|
||||
return this.withSceneRequirement(new PartySizeRequirement([min, max ?? min]));
|
||||
}
|
||||
|
||||
withPrimaryPokemonRequirement(requirement: EncounterPokemonRequirement): this & Required<Pick<MysteryEncounter, "primaryPokemonRequirements">> {
|
||||
this.primaryPokemonRequirements.push(requirement);
|
||||
return Object.assign(this, { primaryPokemonRequirements: this.primaryPokemonRequirements });
|
||||
|
|
Loading…
Reference in New Issue