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,
|
MysteryEncounterBuilder,
|
||||||
MysteryEncounterTier,
|
MysteryEncounterTier,
|
||||||
} from "../mystery-encounter";
|
} from "../mystery-encounter";
|
||||||
import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
|
import {
|
||||||
|
EncounterOptionMode,
|
||||||
|
MysteryEncounterOptionBuilder,
|
||||||
|
} from "../mystery-encounter-option";
|
||||||
import {
|
import {
|
||||||
applyDamageToPokemon,
|
applyDamageToPokemon,
|
||||||
leaveEncounterWithoutBattle,
|
leaveEncounterWithoutBattle,
|
||||||
|
@ -20,6 +23,8 @@ import {
|
||||||
* The higher the more damage taken (100% = instant KO).
|
* The higher the more damage taken (100% = instant KO).
|
||||||
*/
|
*/
|
||||||
const DAMAGE_PERCENTAGE: number = 30; // 0 - 100
|
const DAMAGE_PERCENTAGE: number = 30; // 0 - 100
|
||||||
|
/** The i18n namespace for the encounter */
|
||||||
|
const namepsace = "mysteryEncounter:lostAtSea";
|
||||||
|
|
||||||
let waterPkm: PlayerPokemon;
|
let waterPkm: PlayerPokemon;
|
||||||
let flyingPkm: PlayerPokemon;
|
let flyingPkm: PlayerPokemon;
|
||||||
|
@ -32,6 +37,7 @@ let flyingPkm: PlayerPokemon;
|
||||||
export const LostAtSeaEncounter: MysteryEncounter =
|
export const LostAtSeaEncounter: MysteryEncounter =
|
||||||
MysteryEncounterBuilder.withEncounterType(MysteryEncounterType.LOST_AT_SEA)
|
MysteryEncounterBuilder.withEncounterType(MysteryEncounterType.LOST_AT_SEA)
|
||||||
.withEncounterTier(MysteryEncounterTier.COMMON)
|
.withEncounterTier(MysteryEncounterTier.COMMON)
|
||||||
|
.withSceneWaveRangeRequirement(11, 179)
|
||||||
.withIntroSpriteConfigs([
|
.withIntroSpriteConfigs([
|
||||||
{
|
{
|
||||||
fileRoot: "pokemon",
|
fileRoot: "pokemon",
|
||||||
|
@ -44,7 +50,11 @@ export const LostAtSeaEncounter: MysteryEncounter =
|
||||||
alpha: 0.25,
|
alpha: 0.25,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
.withSceneWaveRangeRequirement(11, 179)
|
.withIntroDialogue([
|
||||||
|
{
|
||||||
|
text: `${namepsace}:intro`,
|
||||||
|
},
|
||||||
|
])
|
||||||
.withOnInit((scene: BattleScene) => {
|
.withOnInit((scene: BattleScene) => {
|
||||||
const allowedPokemon = scene
|
const allowedPokemon = scene
|
||||||
.getParty()
|
.getParty()
|
||||||
|
@ -69,46 +79,80 @@ export const LostAtSeaEncounter: MysteryEncounter =
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
/**
|
.withTitle(`${namepsace}:title`)
|
||||||
* Option 1: Use a (non fainted) water pokemon to guide you back.
|
.withDescription(`${namepsace}:description`)
|
||||||
* Receives EXP similar to defeating a Lapras
|
.withQuery(`${namepsace}:query`)
|
||||||
*/
|
|
||||||
.withOption(
|
.withOption(
|
||||||
|
/**
|
||||||
|
* Option 1: Use a (non fainted) water pokemon to guide you back.
|
||||||
|
* Receives EXP similar to defeating a Lapras
|
||||||
|
*/
|
||||||
new MysteryEncounterOptionBuilder()
|
new MysteryEncounterOptionBuilder()
|
||||||
.withPokemonTypeRequirement(Type.WATER, true, 1)
|
.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) =>
|
.withOptionPhase(async (scene: BattleScene) =>
|
||||||
handleGuidingOption(scene, waterPkm)
|
handleGuidingOptionPhase(scene, waterPkm)
|
||||||
)
|
)
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
/**
|
|
||||||
* Option 2: Use a (non fainted) flying pokemon to guide you back.
|
|
||||||
* Receives EXP similar to defeating a Lapras
|
|
||||||
*/
|
|
||||||
.withOption(
|
.withOption(
|
||||||
|
/**
|
||||||
|
* Option 2: Use a (non fainted) flying pokemon to guide you back.
|
||||||
|
* Receives EXP similar to defeating a Lapras
|
||||||
|
*/
|
||||||
new MysteryEncounterOptionBuilder()
|
new MysteryEncounterOptionBuilder()
|
||||||
.withPokemonTypeRequirement(Type.FLYING, true, 1)
|
.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) =>
|
.withOptionPhase(async (scene: BattleScene) =>
|
||||||
handleGuidingOption(scene, flyingPkm)
|
handleGuidingOptionPhase(scene, flyingPkm)
|
||||||
)
|
)
|
||||||
.build()
|
.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) => {
|
*/
|
||||||
const allowedPokemon = scene
|
{
|
||||||
.getParty()
|
buttonLabel: `${namepsace}:option:3:label`,
|
||||||
.filter((p) => p.isAllowedInBattle());
|
buttonTooltip: `${namepsace}:option:3:tooltip`,
|
||||||
|
selected: [
|
||||||
|
{
|
||||||
|
text: `${namepsace}:option:3:selected`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
async (scene: BattleScene) => {
|
||||||
|
const allowedPokemon = scene
|
||||||
|
.getParty()
|
||||||
|
.filter((p) => p.isAllowedInBattle());
|
||||||
|
|
||||||
allowedPokemon.forEach((pkm) => {
|
allowedPokemon.forEach((pkm) => {
|
||||||
const percentage = DAMAGE_PERCENTAGE / 100;
|
const percentage = DAMAGE_PERCENTAGE / 100;
|
||||||
const damage = Math.floor(pkm.getMaxHp() * percentage);
|
const damage = Math.floor(pkm.getMaxHp() * percentage);
|
||||||
return applyDamageToPokemon(pkm, damage);
|
return applyDamageToPokemon(pkm, damage);
|
||||||
});
|
});
|
||||||
leaveEncounterWithoutBattle(scene);
|
leaveEncounterWithoutBattle(scene);
|
||||||
return true;
|
return true;
|
||||||
})
|
}
|
||||||
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,7 +172,10 @@ function findPokemonByType(party: PlayerPokemon[], type: Type) {
|
||||||
* @param scene Battle scene
|
* @param scene Battle scene
|
||||||
* @param guidePokemon pokemon choosen as a guide
|
* @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 */
|
/** Base EXP value for guiding pokemon. Currently Lapras base-value */
|
||||||
const baseExpValue: number = 187;
|
const baseExpValue: number = 187;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue