apply surf & fly condition (not water & flying)

This commit is contained in:
Felix Staud 2024-07-12 14:55:52 -07:00
parent 0cb4e53861
commit 7b55811b84
2 changed files with 24 additions and 17 deletions

View File

@ -1,4 +1,3 @@
import { Type } from "#app/data/type.js";
import { Moves } from "#app/enums/moves.js"; import { Moves } from "#app/enums/moves.js";
import { Species } from "#app/enums/species.js"; import { Species } from "#app/enums/species.js";
import { PlayerPokemon } from "#app/field/pokemon.js"; import { PlayerPokemon } from "#app/field/pokemon.js";
@ -8,6 +7,8 @@ import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from
import { EncounterOptionMode, MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; import { EncounterOptionMode, MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
import { applyDamageToPokemon, leaveEncounterWithoutBattle, setEncounterExp } from "../mystery-encounter-utils"; import { applyDamageToPokemon, leaveEncounterWithoutBattle, setEncounterExp } from "../mystery-encounter-utils";
const OPTION_1_REQUIRED_MOVE = Moves.SURF;
const OPTION_2_REQUIRED_MOVE = Moves.FLY;
/** /**
* Damage percentage taken when wandering aimlessly. * Damage percentage taken when wandering aimlessly.
* Can be a number between `0` - `100`. * Can be a number between `0` - `100`.
@ -46,6 +47,8 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with
const { mysteryEncounter } = scene.currentBattle; const { mysteryEncounter } = scene.currentBattle;
mysteryEncounter.setDialogueToken("damagePercentage", String(DAMAGE_PERCENTAGE)); mysteryEncounter.setDialogueToken("damagePercentage", String(DAMAGE_PERCENTAGE));
mysteryEncounter.setDialogueToken("option1RequiredMove", Moves[OPTION_1_REQUIRED_MOVE]);
mysteryEncounter.setDialogueToken("option2RequiredMove", Moves[OPTION_2_REQUIRED_MOVE]);
// check for water pokemon // check for water pokemon
// surfablePkm = findPokemonThatCanLearnMove(allowedPokemon, Type.WATER); // surfablePkm = findPokemonThatCanLearnMove(allowedPokemon, Type.WATER);
@ -62,15 +65,17 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with
.withQuery(`${namepsace}:query`) .withQuery(`${namepsace}:query`)
.withOption( .withOption(
/** /**
* Option 1: Use a (non fainted) water pokemon to guide you back. * Option 1: Use a (non fainted) pokemon that can learn Surf to guide you back.
* Receives EXP similar to defeating a Lapras * Receives EXP similar to defeating a Lapras
*/ */
new MysteryEncounterOptionBuilder() new MysteryEncounterOptionBuilder()
.withPokemonCanLearnMoveRequirement(Moves.SURF) .withPokemonCanLearnMoveRequirement(OPTION_1_REQUIRED_MOVE)
.withOptionMode(EncounterOptionMode.DISABLED_OR_DEFAULT) .withOptionMode(EncounterOptionMode.DISABLED_OR_DEFAULT)
.withDialogue({ .withDialogue({
buttonLabel: `${namepsace}:option:1:label`, buttonLabel: `${namepsace}:option:1:label`,
disabledButtonLabel: `${namepsace}:option:1:label_disabled`,
buttonTooltip: `${namepsace}:option:1:tooltip`, buttonTooltip: `${namepsace}:option:1:tooltip`,
disabledButtonTooltip: `${namepsace}:option:1:tooltip_disabled`,
selected: [ selected: [
{ {
text: `${namepsace}:option:1:selected`, text: `${namepsace}:option:1:selected`,
@ -82,15 +87,17 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with
) )
.withOption( .withOption(
/** /**
* Option 2: Use a (non fainted) flying pokemon to guide you back. * Option 2: Use a (non fainted) pokemon that can learn fly to guide you back.
* Receives EXP similar to defeating a Lapras * Receives EXP similar to defeating a Lapras
*/ */
new MysteryEncounterOptionBuilder() new MysteryEncounterOptionBuilder()
.withPokemonTypeRequirement(Type.FLYING, true, 1) .withPokemonCanLearnMoveRequirement(OPTION_2_REQUIRED_MOVE)
.withOptionMode(EncounterOptionMode.DISABLED_OR_DEFAULT) .withOptionMode(EncounterOptionMode.DISABLED_OR_DEFAULT)
.withDialogue({ .withDialogue({
buttonLabel: `${namepsace}:option:2:label`, buttonLabel: `${namepsace}:option:2:label`,
disabledButtonLabel: `${namepsace}:option:2:label_disabled`,
buttonTooltip: `${namepsace}:option:2:tooltip`, buttonTooltip: `${namepsace}:option:2:tooltip`,
disabledButtonTooltip: `${namepsace}:option:2:tooltip_disabled`,
selected: [ selected: [
{ {
text: `${namepsace}:option:2:selected`, text: `${namepsace}:option:2:selected`,

View File

@ -6,23 +6,23 @@ export const lostAtSea = {
query: "What will you do?", query: "What will you do?",
option: { option: {
1: { 1: {
label: "Use {{pokemonCanLearnMove}}", // pkm has to be of type water label: "Use {{option1PrimaryName}}",
tooltip: label_disabled: "Can't {{option1RequiredMove}}",
"Use {{pokemonCanLearnMove}} to guide you back. {{pokemonCanLearnMove}} earns EXP as if having defeated a Lapras.", tooltip: "Use {{option1PrimaryName}} to guide you back. {{option1PrimaryName}} earns EXP as if having defeated a Lapras.",
selected: "{{pokemonCanLearnMove}} guides you back and earns EXP.", tooltip_disabled: "You have no Pokémon that could learn {{option1RequiredMove}}",
selected: "{{option1PrimaryName}} guides you back and earns EXP.",
}, },
2: { 2: {
label: "Use {{flyingPkm}}", // pkm has to be of type flying label: "Use {{option2PrimaryName}}",
tooltip: label_disabled: "Can't {{option2RequiredMove}}",
"Use {{flyingPkm}} to guide you back. {{flyingPkm}} earns EXP as if having defeated a Lapras.", tooltip: "Use {{option2PrimaryName}} to guide you back. {{option2PrimaryName}} earns EXP as if having defeated a Lapras.",
selected: "{{flyingPkm}} guides you back and earns EXP.", tooltip_disabled: "You have no Pokémon that could learn {{option2RequiredMove}}",
selected: "{{option2PrimaryName}} guides you back and earns EXP.",
}, },
3: { 3: {
label: "Wander aimlessly", label: "Wander aimlessly",
tooltip: tooltip: "Wander aimlessly until you're back. All your Pokémon lose {{damagePercentage}}% of their HP. Any below that are KO'd.",
"Wander aimlessly until you're back. All your Pokémon lose {{damagePercentage}}% of their HP. Any below that are KO'd.", selected: "You wander aimlessly around. After hours of wandering, you find your way back. You and your team take the toll.",
selected:
"You wander aimlessly around. After hours of wandering, you find your way back. You and your team take the toll.",
}, },
}, },
}; };