migrate lost at sea encounter to new dialogue pattern
This commit is contained in:
parent
1ae7a86cf9
commit
58d533fb34
|
@ -1,45 +0,0 @@
|
|||
import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue";
|
||||
|
||||
const namepsace = "mysteryEncounter:lostAtSea";
|
||||
|
||||
export const LostAtSeaDialogue: MysteryEncounterDialogue = {
|
||||
intro: [
|
||||
{
|
||||
text: `${namepsace}:intro`,
|
||||
},
|
||||
],
|
||||
encounterOptionsDialogue: {
|
||||
title: `${namepsace}:title`,
|
||||
description: `${namepsace}:description`,
|
||||
query: `${namepsace}:query`,
|
||||
options: [
|
||||
{
|
||||
buttonLabel: `${namepsace}:option:1:label`,
|
||||
buttonTooltip: `${namepsace}:option:1:tooltip`,
|
||||
selected: [
|
||||
{
|
||||
text: `${namepsace}:option:1:selected`,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
buttonLabel: `${namepsace}:option:2:label`,
|
||||
buttonTooltip: `${namepsace}:option:2:tooltip`,
|
||||
selected: [
|
||||
{
|
||||
text: `${namepsace}:option:2:selected`,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
buttonLabel: `${namepsace}:option:3:label`,
|
||||
buttonTooltip: `${namepsace}:option:3:tooltip`,
|
||||
selected: [
|
||||
{
|
||||
text: `${namepsace}:option:3:selected`,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
|
@ -7,7 +7,10 @@ import MysteryEncounter, {
|
|||
MysteryEncounterBuilder,
|
||||
MysteryEncounterTier,
|
||||
} from "../mystery-encounter";
|
||||
import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
|
||||
import {
|
||||
EncounterOptionMode,
|
||||
MysteryEncounterOptionBuilder,
|
||||
} from "../mystery-encounter-option";
|
||||
import {
|
||||
applyDamageToPokemon,
|
||||
leaveEncounterWithoutBattle,
|
||||
|
@ -20,6 +23,8 @@ import {
|
|||
* The higher the more damage taken (100% = instant KO).
|
||||
*/
|
||||
const DAMAGE_PERCENTAGE: number = 30; // 0 - 100
|
||||
/** The i18n namespace for the encounter */
|
||||
const namepsace = "mysteryEncounter:lostAtSea";
|
||||
|
||||
let waterPkm: PlayerPokemon;
|
||||
let flyingPkm: PlayerPokemon;
|
||||
|
@ -32,6 +37,7 @@ let flyingPkm: PlayerPokemon;
|
|||
export const LostAtSeaEncounter: MysteryEncounter =
|
||||
MysteryEncounterBuilder.withEncounterType(MysteryEncounterType.LOST_AT_SEA)
|
||||
.withEncounterTier(MysteryEncounterTier.COMMON)
|
||||
.withSceneWaveRangeRequirement(11, 179)
|
||||
.withIntroSpriteConfigs([
|
||||
{
|
||||
fileRoot: "pokemon",
|
||||
|
@ -44,7 +50,11 @@ export const LostAtSeaEncounter: MysteryEncounter =
|
|||
alpha: 0.25,
|
||||
},
|
||||
])
|
||||
.withSceneWaveRangeRequirement(11, 179)
|
||||
.withIntroDialogue([
|
||||
{
|
||||
text: `${namepsace}:intro`,
|
||||
},
|
||||
])
|
||||
.withOnInit((scene: BattleScene) => {
|
||||
const allowedPokemon = scene
|
||||
.getParty()
|
||||
|
@ -69,34 +79,67 @@ export const LostAtSeaEncounter: MysteryEncounter =
|
|||
|
||||
return true;
|
||||
})
|
||||
.withTitle(`${namepsace}:title`)
|
||||
.withDescription(`${namepsace}:description`)
|
||||
.withQuery(`${namepsace}:query`)
|
||||
.withOption(
|
||||
/**
|
||||
* Option 1: Use a (non fainted) water pokemon to guide you back.
|
||||
* Receives EXP similar to defeating a Lapras
|
||||
*/
|
||||
.withOption(
|
||||
new MysteryEncounterOptionBuilder()
|
||||
.withPokemonTypeRequirement(Type.WATER, true, 1)
|
||||
.withOptionMode(EncounterOptionMode.DISABLED_OR_DEFAULT)
|
||||
.withDialogue({
|
||||
buttonLabel: `${namepsace}:option:1:label`,
|
||||
buttonTooltip: `${namepsace}:option:1:tooltip`,
|
||||
selected: [
|
||||
{
|
||||
text: `${namepsace}:option:1:selected`,
|
||||
},
|
||||
],
|
||||
})
|
||||
.withOptionPhase(async (scene: BattleScene) =>
|
||||
handleGuidingOption(scene, waterPkm)
|
||||
handleGuidingOptionPhase(scene, waterPkm)
|
||||
)
|
||||
.build()
|
||||
)
|
||||
.withOption(
|
||||
/**
|
||||
* Option 2: Use a (non fainted) flying pokemon to guide you back.
|
||||
* Receives EXP similar to defeating a Lapras
|
||||
*/
|
||||
.withOption(
|
||||
new MysteryEncounterOptionBuilder()
|
||||
.withPokemonTypeRequirement(Type.FLYING, true, 1)
|
||||
.withOptionMode(EncounterOptionMode.DISABLED_OR_DEFAULT)
|
||||
.withDialogue({
|
||||
buttonLabel: `${namepsace}:option:2:label`,
|
||||
buttonTooltip: `${namepsace}:option:2:tooltip`,
|
||||
selected: [
|
||||
{
|
||||
text: `${namepsace}:option:2:selected`,
|
||||
},
|
||||
],
|
||||
})
|
||||
.withOptionPhase(async (scene: BattleScene) =>
|
||||
handleGuidingOption(scene, flyingPkm)
|
||||
handleGuidingOptionPhase(scene, flyingPkm)
|
||||
)
|
||||
.build()
|
||||
)
|
||||
.withSimpleOption(
|
||||
/**
|
||||
* Option 3: Wander aimlessly. All pokemons lose 30% of their HP (or KO on 0 HP).
|
||||
* Option 3: Wander aimlessly. All pokemons lose {@linkcode DAMAGE_PERCENTAGE}}% of their HP (or KO on 0 HP).
|
||||
*/
|
||||
.withOptionPhase(async (scene: BattleScene) => {
|
||||
{
|
||||
buttonLabel: `${namepsace}:option:3:label`,
|
||||
buttonTooltip: `${namepsace}:option:3:tooltip`,
|
||||
selected: [
|
||||
{
|
||||
text: `${namepsace}:option:3:selected`,
|
||||
},
|
||||
],
|
||||
},
|
||||
async (scene: BattleScene) => {
|
||||
const allowedPokemon = scene
|
||||
.getParty()
|
||||
.filter((p) => p.isAllowedInBattle());
|
||||
|
@ -108,7 +151,8 @@ export const LostAtSeaEncounter: MysteryEncounter =
|
|||
});
|
||||
leaveEncounterWithoutBattle(scene);
|
||||
return true;
|
||||
})
|
||||
}
|
||||
)
|
||||
.build();
|
||||
|
||||
/**
|
||||
|
@ -128,7 +172,10 @@ function findPokemonByType(party: PlayerPokemon[], type: Type) {
|
|||
* @param scene Battle scene
|
||||
* @param guidePokemon pokemon choosen as a guide
|
||||
*/
|
||||
function handleGuidingOption(scene: BattleScene, guidePokemon: PlayerPokemon) {
|
||||
function handleGuidingOptionPhase(
|
||||
scene: BattleScene,
|
||||
guidePokemon: PlayerPokemon
|
||||
) {
|
||||
/** Base EXP value for guiding pokemon. Currently Lapras base-value */
|
||||
const baseExpValue: number = 187;
|
||||
|
||||
|
|
Loading…
Reference in New Issue