migrate shady-vitamin-dealer encounter
This commit is contained in:
parent
71a047a1f6
commit
19d96ed381
|
@ -2646,7 +2646,7 @@ export default class BattleScene extends SceneBase {
|
|||
|
||||
if (encounter) {
|
||||
encounter = new MysteryEncounter(encounter);
|
||||
encounter.meetsRequirements(this);
|
||||
encounter.populateDialogueTokensFromRequirements(this);
|
||||
return encounter;
|
||||
}
|
||||
|
||||
|
@ -2674,7 +2674,7 @@ export default class BattleScene extends SceneBase {
|
|||
tier = Overrides.MYSTERY_ENCOUNTER_TIER_OVERRIDE;
|
||||
}
|
||||
|
||||
let availableEncounters = [];
|
||||
let availableEncounters: MysteryEncounter[] = [];
|
||||
// New encounter will never be the same as the most recent encounter
|
||||
const previousEncounter = this.mysteryEncounterData.encounteredEvents?.length > 0 ? this.mysteryEncounterData.encounteredEvents[this.mysteryEncounterData.encounteredEvents.length - 1][0] : null;
|
||||
const biomeMysteryEncounters = mysteryEncountersByBiome.get(this.arena.biomeType);
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue";
|
||||
|
||||
export const ShadyVitaminDealerDialogue: MysteryEncounterDialogue = {
|
||||
intro: [
|
||||
{
|
||||
text: "mysteryEncounter:shady_vitamin_dealer_intro_message"
|
||||
},
|
||||
{
|
||||
text: "mysteryEncounter:shady_vitamin_dealer_intro_dialogue",
|
||||
speaker: "mysteryEncounter:shady_vitamin_dealer_speaker"
|
||||
}
|
||||
],
|
||||
encounterOptionsDialogue: {
|
||||
title: "mysteryEncounter:shady_vitamin_dealer_title",
|
||||
description: "mysteryEncounter:shady_vitamin_dealer_description",
|
||||
query: "mysteryEncounter:shady_vitamin_dealer_query",
|
||||
options: [
|
||||
{
|
||||
buttonLabel: "mysteryEncounter:shady_vitamin_dealer_option_1_label",
|
||||
buttonTooltip: "mysteryEncounter:shady_vitamin_dealer_option_1_tooltip",
|
||||
selected: [
|
||||
{
|
||||
text: "mysteryEncounter:shady_vitamin_dealer_option_selected"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
buttonLabel: "mysteryEncounter:shady_vitamin_dealer_option_2_label",
|
||||
buttonTooltip: "mysteryEncounter:shady_vitamin_dealer_option_2_tooltip",
|
||||
selected: [
|
||||
{
|
||||
text: "mysteryEncounter:shady_vitamin_dealer_option_selected"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
buttonLabel: "mysteryEncounter:shady_vitamin_dealer_option_3_label",
|
||||
buttonTooltip: "mysteryEncounter:shady_vitamin_dealer_option_3_tooltip"
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
|
@ -2,7 +2,8 @@ import {
|
|||
generateModifierTypeOption,
|
||||
leaveEncounterWithoutBattle,
|
||||
queueEncounterMessage,
|
||||
selectPokemonForOption, setEncounterExp,
|
||||
selectPokemonForOption,
|
||||
setEncounterExp,
|
||||
updatePlayerMoney,
|
||||
} from "#app/data/mystery-encounters/mystery-encounter-utils";
|
||||
import { StatusEffect } from "#app/data/status-effect";
|
||||
|
@ -11,17 +12,23 @@ 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 {
|
||||
MoneyRequirement
|
||||
} from "../mystery-encounter-requirements";
|
||||
import i18next from "i18next";
|
||||
import BattleScene from "../../../battle-scene";
|
||||
import MysteryEncounter, {
|
||||
MysteryEncounterBuilder,
|
||||
MysteryEncounterTier,
|
||||
} from "../mystery-encounter";
|
||||
import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
|
||||
import { MoneyRequirement } from "../mystery-encounter-requirements";
|
||||
|
||||
export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBuilder
|
||||
.withEncounterType(MysteryEncounterType.SHADY_VITAMIN_DEALER)
|
||||
export const ShadyVitaminDealerEncounter: MysteryEncounter =
|
||||
MysteryEncounterBuilder.withEncounterType(
|
||||
MysteryEncounterType.SHADY_VITAMIN_DEALER
|
||||
)
|
||||
.withEncounterTier(MysteryEncounterTier.COMMON)
|
||||
.withSceneWaveRangeRequirement(10, 180)
|
||||
.withPrimaryPokemonStatusEffectRequirement([StatusEffect.NONE]) // Pokemon must not have status
|
||||
.withPrimaryPokemonHealthRatioRequirement([0.34, 1]) // Pokemon must have above 1/3rd HP
|
||||
.withIntroSpriteConfigs([
|
||||
{
|
||||
spriteKey: Species.KROOKODILE.toString(),
|
||||
|
@ -29,51 +36,87 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui
|
|||
hasShadow: true,
|
||||
repeat: true,
|
||||
x: 10,
|
||||
y: -1
|
||||
y: -1,
|
||||
},
|
||||
{
|
||||
spriteKey: "b2w2_veteran_m",
|
||||
fileRoot: "mystery-encounters",
|
||||
hasShadow: true,
|
||||
x: -10,
|
||||
y: 2
|
||||
}
|
||||
y: 2,
|
||||
},
|
||||
])
|
||||
.withSceneWaveRangeRequirement(10, 180)
|
||||
.withPrimaryPokemonStatusEffectRequirement([StatusEffect.NONE]) // Pokemon must not have status
|
||||
.withPrimaryPokemonHealthRatioRequirement([0.34, 1]) // Pokemon must have above 1/3rd HP
|
||||
.withOption(new MysteryEncounterOptionBuilder()
|
||||
.withIntroDialogue([
|
||||
{
|
||||
text: "mysteryEncounter:shady_vitamin_dealer_intro_message",
|
||||
},
|
||||
{
|
||||
text: "mysteryEncounter:shady_vitamin_dealer_intro_dialogue",
|
||||
speaker: "mysteryEncounter:shady_vitamin_dealer_speaker",
|
||||
},
|
||||
])
|
||||
.withTitle("mysteryEncounter:shady_vitamin_dealer_title")
|
||||
.withDescription("mysteryEncounter:shady_vitamin_dealer_description")
|
||||
.withQuery("mysteryEncounter:shady_vitamin_dealer_query")
|
||||
.withOption(
|
||||
new MysteryEncounterOptionBuilder()
|
||||
.withSceneMoneyRequirement(0, 2) // Wave scaling money multiplier of 2
|
||||
.withDialogue({
|
||||
buttonLabel: "mysteryEncounter:shady_vitamin_dealer_option_1_label",
|
||||
buttonTooltip:
|
||||
"mysteryEncounter:shady_vitamin_dealer_option_1_tooltip",
|
||||
selected: [
|
||||
{
|
||||
text: "mysteryEncounter:shady_vitamin_dealer_option_selected",
|
||||
},
|
||||
],
|
||||
})
|
||||
.withPreOptionPhase(async (scene: BattleScene): Promise<boolean> => {
|
||||
const encounter = scene.currentBattle.mysteryEncounter;
|
||||
const onPokemonSelected = (pokemon: PlayerPokemon) => {
|
||||
// Update money
|
||||
updatePlayerMoney(scene, -(encounter.options[0].requirements[0] as MoneyRequirement).requiredMoney);
|
||||
updatePlayerMoney(
|
||||
scene,
|
||||
-(encounter.options[0].requirements[0] as MoneyRequirement)
|
||||
.requiredMoney
|
||||
);
|
||||
// Calculate modifiers and dialogue tokens
|
||||
const modifiers = [
|
||||
generateModifierTypeOption(scene, modifierTypes.BASE_STAT_BOOSTER).type,
|
||||
generateModifierTypeOption(scene, modifierTypes.BASE_STAT_BOOSTER).type
|
||||
generateModifierTypeOption(scene, modifierTypes.BASE_STAT_BOOSTER)
|
||||
.type,
|
||||
generateModifierTypeOption(scene, modifierTypes.BASE_STAT_BOOSTER)
|
||||
.type,
|
||||
];
|
||||
encounter.setDialogueToken("boost1", modifiers[0].name);
|
||||
encounter.setDialogueToken("boost2", modifiers[1].name);
|
||||
encounter.misc = {
|
||||
chosenPokemon: pokemon,
|
||||
modifiers: modifiers
|
||||
modifiers: modifiers,
|
||||
};
|
||||
};
|
||||
|
||||
// Only Pokemon that can gain benefits are above 1/3rd HP with no status
|
||||
const selectableFilter = (pokemon: Pokemon) => {
|
||||
// If pokemon meets primary pokemon reqs, it can be selected
|
||||
const meetsReqs = encounter.pokemonMeetsPrimaryRequirements(scene, pokemon);
|
||||
const meetsReqs = encounter.pokemonMeetsPrimaryRequirements(
|
||||
scene,
|
||||
pokemon
|
||||
);
|
||||
if (!meetsReqs) {
|
||||
return i18next.t("mysteryEncounter:shady_vitamin_dealer_invalid_selection");
|
||||
return i18next.t(
|
||||
"mysteryEncounter:shady_vitamin_dealer_invalid_selection"
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
return selectPokemonForOption(scene, onPokemonSelected, null, selectableFilter);
|
||||
return selectPokemonForOption(
|
||||
scene,
|
||||
onPokemonSelected,
|
||||
null,
|
||||
selectableFilter
|
||||
);
|
||||
})
|
||||
.withOptionPhase(async (scene: BattleScene) => {
|
||||
// Choose Cheap Option
|
||||
|
@ -102,52 +145,89 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui
|
|||
if (randSeedInt(10) < 8) {
|
||||
if (chosenPokemon.trySetStatus(StatusEffect.TOXIC)) {
|
||||
// Toxic applied
|
||||
queueEncounterMessage(scene, "mysteryEncounter:shady_vitamin_dealer_bad_poison");
|
||||
queueEncounterMessage(
|
||||
scene,
|
||||
"mysteryEncounter:shady_vitamin_dealer_bad_poison"
|
||||
);
|
||||
} else {
|
||||
// Pokemon immune or something else prevents status
|
||||
queueEncounterMessage(scene, "mysteryEncounter:shady_vitamin_dealer_damage_only");
|
||||
queueEncounterMessage(
|
||||
scene,
|
||||
"mysteryEncounter:shady_vitamin_dealer_damage_only"
|
||||
);
|
||||
}
|
||||
} else {
|
||||
queueEncounterMessage(scene, "mysteryEncounter:shady_vitamin_dealer_damage_only");
|
||||
queueEncounterMessage(
|
||||
scene,
|
||||
"mysteryEncounter:shady_vitamin_dealer_damage_only"
|
||||
);
|
||||
}
|
||||
|
||||
setEncounterExp(scene, [chosenPokemon.id], 100);
|
||||
|
||||
chosenPokemon.updateInfo();
|
||||
})
|
||||
.build())
|
||||
.withOption(new MysteryEncounterOptionBuilder()
|
||||
.build()
|
||||
)
|
||||
.withOption(
|
||||
new MysteryEncounterOptionBuilder()
|
||||
.withDialogue({
|
||||
buttonLabel: "mysteryEncounter:shady_vitamin_dealer_option_2_label",
|
||||
buttonTooltip:
|
||||
"mysteryEncounter:shady_vitamin_dealer_option_2_tooltip",
|
||||
selected: [
|
||||
{
|
||||
text: "mysteryEncounter:shady_vitamin_dealer_option_selected",
|
||||
},
|
||||
],
|
||||
})
|
||||
.withSceneMoneyRequirement(0, 5) // Wave scaling money multiplier of 5
|
||||
.withPreOptionPhase(async (scene: BattleScene): Promise<boolean> => {
|
||||
const encounter = scene.currentBattle.mysteryEncounter;
|
||||
const onPokemonSelected = (pokemon: PlayerPokemon) => {
|
||||
// Update money
|
||||
updatePlayerMoney(scene, -(encounter.options[1].requirements[0] as MoneyRequirement).requiredMoney);
|
||||
updatePlayerMoney(
|
||||
scene,
|
||||
-(encounter.options[1].requirements[0] as MoneyRequirement)
|
||||
.requiredMoney
|
||||
);
|
||||
// Calculate modifiers and dialogue tokens
|
||||
const modifiers = [
|
||||
generateModifierTypeOption(scene, modifierTypes.BASE_STAT_BOOSTER).type,
|
||||
generateModifierTypeOption(scene, modifierTypes.BASE_STAT_BOOSTER).type
|
||||
generateModifierTypeOption(scene, modifierTypes.BASE_STAT_BOOSTER)
|
||||
.type,
|
||||
generateModifierTypeOption(scene, modifierTypes.BASE_STAT_BOOSTER)
|
||||
.type,
|
||||
];
|
||||
encounter.setDialogueToken("boost1", modifiers[0].name);
|
||||
encounter.setDialogueToken("boost2", modifiers[1].name);
|
||||
encounter.misc = {
|
||||
chosenPokemon: pokemon,
|
||||
modifiers: modifiers
|
||||
modifiers: modifiers,
|
||||
};
|
||||
};
|
||||
|
||||
// Only Pokemon that can gain benefits are above 1/3rd HP with no status
|
||||
const selectableFilter = (pokemon: Pokemon) => {
|
||||
// If pokemon meets primary pokemon reqs, it can be selected
|
||||
const meetsReqs = encounter.pokemonMeetsPrimaryRequirements(scene, pokemon);
|
||||
const meetsReqs = encounter.pokemonMeetsPrimaryRequirements(
|
||||
scene,
|
||||
pokemon
|
||||
);
|
||||
if (!meetsReqs) {
|
||||
return i18next.t("mysteryEncounter:shady_vitamin_dealer_invalid_selection");
|
||||
return i18next.t(
|
||||
"mysteryEncounter:shady_vitamin_dealer_invalid_selection"
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
return selectPokemonForOption(scene, onPokemonSelected, null, selectableFilter);
|
||||
return selectPokemonForOption(
|
||||
scene,
|
||||
onPokemonSelected,
|
||||
null,
|
||||
selectableFilter
|
||||
);
|
||||
})
|
||||
.withOptionPhase(async (scene: BattleScene) => {
|
||||
// Choose Expensive Option
|
||||
|
@ -172,23 +252,39 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui
|
|||
if (randSeedInt(10) < 2) {
|
||||
if (chosenPokemon.trySetStatus(StatusEffect.POISON)) {
|
||||
// Poison applied
|
||||
queueEncounterMessage(scene, "mysteryEncounter:shady_vitamin_dealer_poison");
|
||||
queueEncounterMessage(
|
||||
scene,
|
||||
"mysteryEncounter:shady_vitamin_dealer_poison"
|
||||
);
|
||||
} else {
|
||||
// Pokemon immune or something else prevents status
|
||||
queueEncounterMessage(scene, "mysteryEncounter:shady_vitamin_dealer_no_bad_effects");
|
||||
queueEncounterMessage(
|
||||
scene,
|
||||
"mysteryEncounter:shady_vitamin_dealer_no_bad_effects"
|
||||
);
|
||||
}
|
||||
} else {
|
||||
queueEncounterMessage(scene, "mysteryEncounter:shady_vitamin_dealer_no_bad_effects");
|
||||
queueEncounterMessage(
|
||||
scene,
|
||||
"mysteryEncounter:shady_vitamin_dealer_no_bad_effects"
|
||||
);
|
||||
}
|
||||
|
||||
setEncounterExp(scene, [chosenPokemon.id], 100);
|
||||
|
||||
chosenPokemon.updateInfo();
|
||||
})
|
||||
.build())
|
||||
.withSimpleOption(async (scene: BattleScene) => {
|
||||
.build()
|
||||
)
|
||||
.withSimpleOption(
|
||||
{
|
||||
buttonLabel: "mysteryEncounter:shady_vitamin_dealer_option_3_label",
|
||||
buttonTooltip: "mysteryEncounter:shady_vitamin_dealer_option_3_tooltip",
|
||||
},
|
||||
async (scene: BattleScene) => {
|
||||
// Leave encounter with no rewards or exp
|
||||
leaveEncounterWithoutBattle(scene, true);
|
||||
return true;
|
||||
})
|
||||
}
|
||||
)
|
||||
.build();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { TrainingSessionDialogue } from "#app/data/mystery-encounters/dialogue/training-session-dialogue";
|
||||
import { SleepingSnorlaxDialogue } from "./dialogue/sleeping-snorlax-dialogue";
|
||||
import { ShadyVitaminDealerDialogue } from "#app/data/mystery-encounters/dialogue/shady-vitamin-dealer";
|
||||
import { TextStyle } from "#app/ui/text";
|
||||
|
||||
export class TextDisplay {
|
||||
|
@ -81,5 +80,4 @@ export const allMysteryEncounterDialogue: { [encounterType: number]: MysteryEnco
|
|||
export function initMysteryEncounterDialogue() {
|
||||
allMysteryEncounterDialogue[MysteryEncounterType.TRAINING_SESSION] = TrainingSessionDialogue;
|
||||
allMysteryEncounterDialogue[MysteryEncounterType.SLEEPING_SNORLAX] = SleepingSnorlaxDialogue;
|
||||
allMysteryEncounterDialogue[MysteryEncounterType.SHADY_VITAMIN_DEALER] = ShadyVitaminDealerDialogue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue