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 { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
import {
HealthRatioRequirement,
MoneyRequirement,
StatusEffectRequirement
MoneyRequirement
} from "../mystery-encounter-requirements";
export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBuilder
@ -42,8 +40,8 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui
}
])
.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
.withPrimaryPokemonStatusEffectRequirement([StatusEffect.NONE]) // Pokemon must not have status
.withPrimaryPokemonHealthRatioRequirement([0.34, 1]) // Pokemon must have above 1/3rd HP
.withOption(new MysteryEncounterOptionBuilder()
.withSceneRequirement(new MoneyRequirement(0, 2)) // Wave scaling multiplier of 2 for cost
.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 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, {
allMysteryEncounterDialogue
} from "./mystery-encounter-dialogue";
@ -8,13 +13,11 @@ import MysteryEncounterOption, { MysteryEncounterOptionBuilder, OptionPhaseCallb
import {
EncounterPokemonRequirement,
EncounterSceneRequirement,
HealthRatioRequirement,
PartySizeRequirement,
StatusEffectRequirement,
WaveRangeRequirement
} 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 {
DEFAULT,
@ -470,6 +473,14 @@ export class MysteryEncounterBuilder implements Partial<MysteryEncounter> {
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?
// 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