mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-30 10:46:05 +00:00
lost-at-sea enc.: add fainted
msg display
This commit is contained in:
parent
274ff21943
commit
6451eb8049
@ -1,8 +1,10 @@
|
|||||||
import { Moves } from "#app/enums/moves";
|
import { Moves } from "#app/enums/moves";
|
||||||
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
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";
|
||||||
import { EncounterOptionMode, MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
|
import { EncounterOptionMode, MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
|
||||||
|
import { showEncounterText } from "../utils/encounter-dialogue-utils";
|
||||||
import { applyDamageToPokemon, leaveEncounterWithoutBattle, setEncounterExp } from "../utils/encounter-phase-utils";
|
import { applyDamageToPokemon, leaveEncounterWithoutBattle, setEncounterExp } from "../utils/encounter-phase-utils";
|
||||||
|
|
||||||
const OPTION_1_REQUIRED_MOVE = Moves.SURF;
|
const OPTION_1_REQUIRED_MOVE = Moves.SURF;
|
||||||
@ -96,18 +98,20 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
async (scene: BattleScene) => {
|
async (scene: BattleScene) => {
|
||||||
|
const { mysteryEncounter } = scene.currentBattle;
|
||||||
const allowedPokemon = scene.getParty().filter((p) => p.isAllowedInBattle());
|
const allowedPokemon = scene.getParty().filter((p) => p.isAllowedInBattle());
|
||||||
|
|
||||||
allowedPokemon.forEach((pkm) => {
|
for (const pkm of allowedPokemon) {
|
||||||
const percentage = DAMAGE_PERCENTAGE / 100;
|
const percentage = DAMAGE_PERCENTAGE / 100;
|
||||||
const damage = Math.floor(pkm.getMaxHp() * percentage);
|
const damage = Math.floor(pkm.getMaxHp() * percentage);
|
||||||
applyDamageToPokemon(pkm, damage);
|
applyDamageToPokemon(pkm, damage);
|
||||||
|
|
||||||
if (pkm.isFainted()) {
|
if (pkm.isFainted()) {
|
||||||
scene.currentBattle.mysteryEncounter.dialogue.outro.push({
|
mysteryEncounter.setDialogueToken("pokemonNameWithAffix", getPokemonNameWithAffix(pkm));
|
||||||
text: `${pkm.name} fainted!`,
|
await showEncounterText(scene, "battle:fainted");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
leaveEncounterWithoutBattle(scene);
|
leaveEncounterWithoutBattle(scene);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user