add `MysteryEncounterOptionBuilder.withSceneMoneyRequirement()`

This commit is contained in:
Felix Staud 2024-07-09 22:38:58 -07:00 committed by ImperialSympathizer
parent 434104f9ee
commit f1b074755e
2 changed files with 10 additions and 6 deletions

View File

@ -43,7 +43,7 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui
.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
.withSceneMoneyRequirement(0, 2) // Wave scaling multiplier of 2 for cost
.withPreOptionPhase(async (scene: BattleScene): Promise<boolean> => {
const encounter = scene.currentBattle.mysteryEncounter;
const onPokemonSelected = (pokemon: PlayerPokemon) => {
@ -116,7 +116,7 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui
.build())
.withOption(new MysteryEncounterOptionBuilder()
.withSceneRequirement(new MoneyRequirement(0, 5)) // Wave scaling multiplier of 2 for cost
.withSceneMoneyRequirement(0, 5) // Wave scaling multiplier of 2 for cost
.withOptionPhase(async (scene: BattleScene) => {
// Choose Expensive Option
const modifiers = [];

View File

@ -1,8 +1,8 @@
import { PlayerPokemon } from "#app/field/pokemon";
import * as Utils from "../../utils";
import BattleScene from "../../battle-scene";
import { EncounterPokemonRequirement, EncounterSceneRequirement } from "./mystery-encounter-requirements";
import { OptionTextDisplay } from "#app/data/mystery-encounters/mystery-encounter-dialogue";
import { PlayerPokemon } from "#app/field/pokemon";
import BattleScene from "../../battle-scene";
import * as Utils from "../../utils";
import { EncounterPokemonRequirement, EncounterSceneRequirement, MoneyRequirement } from "./mystery-encounter-requirements";
export type OptionPhaseCallback = (scene: BattleScene) => Promise<void | boolean>;
@ -133,6 +133,10 @@ export class MysteryEncounterOptionBuilder implements Partial<MysteryEncounterOp
return Object.assign(this, { requirements: this.requirements });
}
withSceneMoneyRequirement(requiredMoney: number, scalingMultiplier?: number) {
return this.withSceneRequirement(new MoneyRequirement(requiredMoney, scalingMultiplier));
}
withPreOptionPhase(onPreOptionPhase: OptionPhaseCallback): this & Required<Pick<MysteryEncounterOption, "onPreOptionPhase">> {
return Object.assign(this, { onPreOptionPhase: onPreOptionPhase });
}