polish lost at sea encounter

- fix guide pokemon not receiving exp
This commit is contained in:
Felix Staud 2024-07-14 21:32:22 -07:00
parent 9208fd226b
commit e2c431b913
4 changed files with 9 additions and 13 deletions

View File

@ -1,6 +1,5 @@
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 { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import BattleScene from "../../../battle-scene"; import BattleScene from "../../../battle-scene";
import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter";
@ -18,9 +17,6 @@ const DAMAGE_PERCENTAGE: number = 30; // 0 - 100
/** The i18n namespace for the encounter */ /** The i18n namespace for the encounter */
const namepsace = "mysteryEncounter:lostAtSea"; const namepsace = "mysteryEncounter:lostAtSea";
let surfablePkm: PlayerPokemon;
let flyingPkm: PlayerPokemon;
/** /**
* Lost at sea encounter. * Lost at sea encounter.
* @see {@link https://github.com/AsdarDevelops/PokeRogue-Events/issues/9 | GitHub Issue #9} * @see {@link https://github.com/AsdarDevelops/PokeRogue-Events/issues/9 | GitHub Issue #9}
@ -73,7 +69,7 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with
}, },
], ],
}) })
.withOptionPhase(async (scene: BattleScene) => handlePokemongGuidingYouPhase(scene, surfablePkm)) .withOptionPhase(async (scene: BattleScene) => handlePokemongGuidingYouPhase(scene))
.build() .build()
) )
.withOption( .withOption(
@ -95,7 +91,7 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with
}, },
], ],
}) })
.withOptionPhase(async (scene: BattleScene) => handlePokemongGuidingYouPhase(scene, flyingPkm)) .withOptionPhase(async (scene: BattleScene) => handlePokemongGuidingYouPhase(scene))
.build() .build()
) )
.withSimpleOption( .withSimpleOption(
@ -132,15 +128,17 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with
* @param scene Battle scene * @param scene Battle scene
* @param guidePokemon pokemon choosen as a guide * @param guidePokemon pokemon choosen as a guide
*/ */
function handlePokemongGuidingYouPhase(scene: BattleScene, guidePokemon: PlayerPokemon) { function handlePokemongGuidingYouPhase(scene: BattleScene) {
/** 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;
const { mysteryEncounter } = scene.currentBattle;
if (guidePokemon) { if (mysteryEncounter.selectedOption) {
setEncounterExp(scene, guidePokemon.id, baseExpValue, true); setEncounterExp(scene, mysteryEncounter.selectedOption.primaryPokemon.id, baseExpValue, true);
} else { } else {
console.warn("Lost at sea: No guide pokemon found but pokemon guides player. huh!?"); console.warn("Lost at sea: No guide pokemon found but pokemon guides player. huh!?");
} }
leaveEncounterWithoutBattle(scene); leaveEncounterWithoutBattle(scene);
return true;
} }

View File

@ -68,7 +68,6 @@ export default class MysteryEncounterOption implements MysteryEncounterOption {
} }
let qualified: PlayerPokemon[] = scene.getParty(); let qualified: PlayerPokemon[] = scene.getParty();
for (const req of this.primaryPokemonRequirements) { for (const req of this.primaryPokemonRequirements) {
console.log(req);
if (req.meetsRequirement(scene)) { if (req.meetsRequirement(scene)) {
if (req instanceof EncounterPokemonRequirement) { if (req instanceof EncounterPokemonRequirement) {
qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn)); qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn));

View File

@ -188,7 +188,6 @@ export default class IMysteryEncounter implements IMysteryEncounter {
} }
let qualified: PlayerPokemon[] = scene.getParty(); let qualified: PlayerPokemon[] = scene.getParty();
for (const req of this.primaryPokemonRequirements) { for (const req of this.primaryPokemonRequirements) {
console.log(req);
if (req.meetsRequirement(scene)) { if (req.meetsRequirement(scene)) {
if (req instanceof EncounterPokemonRequirement) { if (req instanceof EncounterPokemonRequirement) {
qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn)); qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn));

View File

@ -9,14 +9,14 @@ export const lostAtSea = {
label: "Use {{option1PrimaryName}}", label: "Use {{option1PrimaryName}}",
label_disabled: "Can't {{option1RequiredMove}}", label_disabled: "Can't {{option1RequiredMove}}",
tooltip: "Use {{option1PrimaryName}} to guide you back. {{option1PrimaryName}} earns EXP as if having defeated a Lapras.", tooltip: "Use {{option1PrimaryName}} to guide you back. {{option1PrimaryName}} earns EXP as if having defeated a Lapras.",
tooltip_disabled: "You have no Pokémon that could learn {{option1RequiredMove}}", tooltip_disabled: "You have no Pokémon to {{option1RequiredMove}} on",
selected: "{{option1PrimaryName}} guides you back and earns EXP.", selected: "{{option1PrimaryName}} guides you back and earns EXP.",
}, },
2: { 2: {
label: "Use {{option2PrimaryName}}", label: "Use {{option2PrimaryName}}",
label_disabled: "Can't {{option2RequiredMove}}", label_disabled: "Can't {{option2RequiredMove}}",
tooltip: "Use {{option2PrimaryName}} to guide you back. {{option2PrimaryName}} earns EXP as if having defeated a Lapras.", tooltip: "Use {{option2PrimaryName}} to guide you back. {{option2PrimaryName}} earns EXP as if having defeated a Lapras.",
tooltip_disabled: "You have no Pokémon that could learn {{option2RequiredMove}}", tooltip_disabled: "You have no Pokémon to {{option2RequiredMove}} with",
selected: "{{option2PrimaryName}} guides you back and earns EXP.", selected: "{{option2PrimaryName}} guides you back and earns EXP.",
}, },
3: { 3: {