add 2 new MysteryEncounterBuilder methods:

- `.withPrimaryPokemonStatusEffectRequirement()`
- `.withPrimaryPokemonHealthRatioRequirement`
This commit is contained in:
Felix Staud 2024-07-09 22:37:14 -07:00 committed by ImperialSympathizer
parent a8be171305
commit 434104f9ee
2 changed files with 19 additions and 10 deletions

View File

@ -16,9 +16,7 @@ import BattleScene from "../../../battle-scene";
import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter";
import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
import { import {
HealthRatioRequirement, MoneyRequirement
MoneyRequirement,
StatusEffectRequirement
} from "../mystery-encounter-requirements"; } from "../mystery-encounter-requirements";
export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBuilder export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBuilder
@ -42,8 +40,8 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui
} }
]) ])
.withSceneWaveRangeRequirement(10, 180) .withSceneWaveRangeRequirement(10, 180)
.withPrimaryPokemonRequirement(new StatusEffectRequirement([StatusEffect.NONE])) // Pokemon must not have status .withPrimaryPokemonStatusEffectRequirement([StatusEffect.NONE]) // Pokemon must not have status
.withPrimaryPokemonRequirement(new HealthRatioRequirement([0.34, 1])) // Pokemon must have above 1/3rd HP .withPrimaryPokemonHealthRatioRequirement([0.34, 1]) // Pokemon must have above 1/3rd HP
.withOption(new MysteryEncounterOptionBuilder() .withOption(new MysteryEncounterOptionBuilder()
.withSceneRequirement(new MoneyRequirement(0, 2)) // Wave scaling multiplier of 2 for cost .withSceneRequirement(new MoneyRequirement(0, 2)) // Wave scaling multiplier of 2 for cost
.withPreOptionPhase(async (scene: BattleScene): Promise<boolean> => { .withPreOptionPhase(async (scene: BattleScene): Promise<boolean> => {

View File

@ -1,6 +1,11 @@
import { EnemyPartyConfig } from "#app/data/mystery-encounters/mystery-encounter-utils";
import Pokemon, { PlayerPokemon } from "#app/field/pokemon";
import { isNullOrUndefined } from "#app/utils";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import BattleScene from "../../battle-scene"; import BattleScene from "../../battle-scene";
import MysteryEncounterIntroVisuals, { MysteryEncounterSpriteConfig } from "../../field/mystery-encounter-intro"; import MysteryEncounterIntroVisuals, { MysteryEncounterSpriteConfig } from "../../field/mystery-encounter-intro";
import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import * as Utils from "../../utils";
import { StatusEffect } from "../status-effect";
import MysteryEncounterDialogue, { import MysteryEncounterDialogue, {
allMysteryEncounterDialogue allMysteryEncounterDialogue
} from "./mystery-encounter-dialogue"; } from "./mystery-encounter-dialogue";
@ -8,13 +13,11 @@ import MysteryEncounterOption, { MysteryEncounterOptionBuilder, OptionPhaseCallb
import { import {
EncounterPokemonRequirement, EncounterPokemonRequirement,
EncounterSceneRequirement, EncounterSceneRequirement,
HealthRatioRequirement,
PartySizeRequirement, PartySizeRequirement,
StatusEffectRequirement,
WaveRangeRequirement WaveRangeRequirement
} from "./mystery-encounter-requirements"; } from "./mystery-encounter-requirements";
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 "#app/utils";
export enum MysteryEncounterVariant { export enum MysteryEncounterVariant {
DEFAULT, DEFAULT,
@ -470,6 +473,14 @@ export class MysteryEncounterBuilder implements Partial<MysteryEncounter> {
return Object.assign(this, { primaryPokemonRequirements: this.primaryPokemonRequirements }); return Object.assign(this, { primaryPokemonRequirements: this.primaryPokemonRequirements });
} }
withPrimaryPokemonStatusEffectRequirement(statusEffect: StatusEffect | StatusEffect[], minNumberOfPokemon: number = 1, invertQuery: boolean = false): this & Required<Pick<MysteryEncounter, "primaryPokemonRequirements">> {
return this.withPrimaryPokemonRequirement(new StatusEffectRequirement(statusEffect, minNumberOfPokemon, invertQuery));
}
withPrimaryPokemonHealthRatioRequirement(requiredHealthRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false): this & Required<Pick<MysteryEncounter, "primaryPokemonRequirements">> {
return this.withPrimaryPokemonRequirement(new HealthRatioRequirement(requiredHealthRange, minNumberOfPokemon, invertQuery));
}
// TODO: Maybe add an optional parameter for excluding primary pokemon from the support cast? // 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 // 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 // it's already been