apply `namespace` for shady vitamin dealer encounter

This commit is contained in:
Felix Staud 2024-07-11 15:13:01 -07:00
parent e8670c4f00
commit 55805d1804
1 changed files with 25 additions and 46 deletions

View File

@ -21,6 +21,9 @@ import IMysteryEncounter, {
import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
import { MoneyRequirement } from "../mystery-encounter-requirements"; import { MoneyRequirement } from "../mystery-encounter-requirements";
/** the i18n namespace for this encounter */
const namespace = "mysteryEncounter:shady_vitamin_dealer";
export const ShadyVitaminDealerEncounter: IMysteryEncounter = export const ShadyVitaminDealerEncounter: IMysteryEncounter =
MysteryEncounterBuilder.withEncounterType( MysteryEncounterBuilder.withEncounterType(
MysteryEncounterType.SHADY_VITAMIN_DEALER MysteryEncounterType.SHADY_VITAMIN_DEALER
@ -48,26 +51,25 @@ export const ShadyVitaminDealerEncounter: IMysteryEncounter =
]) ])
.withIntroDialogue([ .withIntroDialogue([
{ {
text: "mysteryEncounter:shady_vitamin_dealer_intro_message", text: `${namespace}_intro_message`,
}, },
{ {
text: "mysteryEncounter:shady_vitamin_dealer_intro_dialogue", text: `${namespace}_intro_dialogue`,
speaker: "mysteryEncounter:shady_vitamin_dealer_speaker", speaker: `${namespace}_speaker`,
}, },
]) ])
.withTitle("mysteryEncounter:shady_vitamin_dealer_title") .withTitle(`${namespace}_title`)
.withDescription("mysteryEncounter:shady_vitamin_dealer_description") .withDescription(`${namespace}_description`)
.withQuery("mysteryEncounter:shady_vitamin_dealer_query") .withQuery(`${namespace}_query`)
.withOption( .withOption(
new MysteryEncounterOptionBuilder() new MysteryEncounterOptionBuilder()
.withSceneMoneyRequirement(0, 2) // Wave scaling money multiplier of 2 .withSceneMoneyRequirement(0, 2) // Wave scaling money multiplier of 2
.withDialogue({ .withDialogue({
buttonLabel: "mysteryEncounter:shady_vitamin_dealer_option_1_label", buttonLabel: `${namespace}_option_1_label`,
buttonTooltip: buttonTooltip: `${namespace}_option_1_tooltip`,
"mysteryEncounter:shady_vitamin_dealer_option_1_tooltip",
selected: [ selected: [
{ {
text: "mysteryEncounter:shady_vitamin_dealer_option_selected", text: `${namespace}_option_selected`,
}, },
], ],
}) })
@ -103,9 +105,7 @@ export const ShadyVitaminDealerEncounter: IMysteryEncounter =
pokemon pokemon
); );
if (!meetsReqs) { if (!meetsReqs) {
return i18next.t( return i18next.t(`${namespace}_invalid_selection`);
"mysteryEncounter:shady_vitamin_dealer_invalid_selection"
);
} }
return null; return null;
@ -145,22 +145,13 @@ export const ShadyVitaminDealerEncounter: IMysteryEncounter =
if (randSeedInt(10) < 8) { if (randSeedInt(10) < 8) {
if (chosenPokemon.trySetStatus(StatusEffect.TOXIC)) { if (chosenPokemon.trySetStatus(StatusEffect.TOXIC)) {
// Toxic applied // Toxic applied
queueEncounterMessage( queueEncounterMessage(scene, `${namespace}_bad_poison`);
scene,
"mysteryEncounter:shady_vitamin_dealer_bad_poison"
);
} else { } else {
// Pokemon immune or something else prevents status // Pokemon immune or something else prevents status
queueEncounterMessage( queueEncounterMessage(scene, `${namespace}_damage_only`);
scene,
"mysteryEncounter:shady_vitamin_dealer_damage_only"
);
} }
} else { } else {
queueEncounterMessage( queueEncounterMessage(scene, `${namespace}_damage_only`);
scene,
"mysteryEncounter:shady_vitamin_dealer_damage_only"
);
} }
setEncounterExp(scene, [chosenPokemon.id], 100); setEncounterExp(scene, [chosenPokemon.id], 100);
@ -172,12 +163,11 @@ export const ShadyVitaminDealerEncounter: IMysteryEncounter =
.withOption( .withOption(
new MysteryEncounterOptionBuilder() new MysteryEncounterOptionBuilder()
.withDialogue({ .withDialogue({
buttonLabel: "mysteryEncounter:shady_vitamin_dealer_option_2_label", buttonLabel: `${namespace}_option_2_label`,
buttonTooltip: buttonTooltip: `${namespace}_option_2_tooltip`,
"mysteryEncounter:shady_vitamin_dealer_option_2_tooltip",
selected: [ selected: [
{ {
text: "mysteryEncounter:shady_vitamin_dealer_option_selected", text: `${namespace}_option_selected`,
}, },
], ],
}) })
@ -214,9 +204,7 @@ export const ShadyVitaminDealerEncounter: IMysteryEncounter =
pokemon pokemon
); );
if (!meetsReqs) { if (!meetsReqs) {
return i18next.t( return i18next.t(`${namespace}_invalid_selection`);
"mysteryEncounter:shady_vitamin_dealer_invalid_selection"
);
} }
return null; return null;
@ -252,22 +240,13 @@ export const ShadyVitaminDealerEncounter: IMysteryEncounter =
if (randSeedInt(10) < 2) { if (randSeedInt(10) < 2) {
if (chosenPokemon.trySetStatus(StatusEffect.POISON)) { if (chosenPokemon.trySetStatus(StatusEffect.POISON)) {
// Poison applied // Poison applied
queueEncounterMessage( queueEncounterMessage(scene, `${namespace}_poison`);
scene,
"mysteryEncounter:shady_vitamin_dealer_poison"
);
} else { } else {
// Pokemon immune or something else prevents status // Pokemon immune or something else prevents status
queueEncounterMessage( queueEncounterMessage(scene, `${namespace}_no_bad_effects`);
scene,
"mysteryEncounter:shady_vitamin_dealer_no_bad_effects"
);
} }
} else { } else {
queueEncounterMessage( queueEncounterMessage(scene, `${namespace}_no_bad_effects`);
scene,
"mysteryEncounter:shady_vitamin_dealer_no_bad_effects"
);
} }
setEncounterExp(scene, [chosenPokemon.id], 100); setEncounterExp(scene, [chosenPokemon.id], 100);
@ -278,8 +257,8 @@ export const ShadyVitaminDealerEncounter: IMysteryEncounter =
) )
.withSimpleOption( .withSimpleOption(
{ {
buttonLabel: "mysteryEncounter:shady_vitamin_dealer_option_3_label", buttonLabel: `${namespace}_option_3_label`,
buttonTooltip: "mysteryEncounter:shady_vitamin_dealer_option_3_tooltip", buttonTooltip: `${namespace}_option_3_tooltip`,
}, },
async (scene: BattleScene) => { async (scene: BattleScene) => {
// Leave encounter with no rewards or exp // Leave encounter with no rewards or exp