mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-24 05:55:56 +02:00
* Update `battle-scene.ts` and `data/field/pokemon.ts` `battle-scene.ts` changes: - `getParty()` renamed to `getPlayerParty()` for clarity - `getNonSwitchedXPokemon()` consolidated into `getXPokemon()` - Some tsdocs were added/updated for `getXParty()`, `getXField()` and `getXPokemon()`; and those functions were explicitly marked as `public` - Helper function `getPokemonAllowedInBattle()` added `pokemon.ts` changes: - `isAllowed()` renamed to `isAllowedInChallenge()` for clarity - A redundant check for an active scene is removed in `isActive()` - Some tsdocs were added/updated for `isFainted()`, `isAllowedInChallenge()`, `isAllowedInBattle()` and `isActive()`; and those functions were explicitly marked as `public` - `isFainted()` now checks for `hp <= 0` instead of `!hp` Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Backport eslint change to reduce merge conflicts * Fix merge issues --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Tempoanon <163687446+Tempo-anon@users.noreply.github.com>
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import BattleScene from "#app/battle-scene";
|
|
import { applyAbAttrs, PostBiomeChangeAbAttr } from "#app/data/ability";
|
|
import { getRandomWeatherType } from "#app/data/weather";
|
|
import { NextEncounterPhase } from "./next-encounter-phase";
|
|
|
|
export class NewBiomeEncounterPhase extends NextEncounterPhase {
|
|
constructor(scene: BattleScene) {
|
|
super(scene);
|
|
}
|
|
|
|
doEncounter(): void {
|
|
this.scene.playBgm(undefined, true);
|
|
|
|
for (const pokemon of this.scene.getPlayerParty()) {
|
|
if (pokemon) {
|
|
pokemon.resetBattleData();
|
|
}
|
|
}
|
|
|
|
for (const pokemon of this.scene.getPlayerParty().filter(p => p.isOnField())) {
|
|
applyAbAttrs(PostBiomeChangeAbAttr, pokemon, null);
|
|
}
|
|
|
|
const enemyField = this.scene.getEnemyField();
|
|
const moveTargets: any[] = [ this.scene.arenaEnemy, enemyField ];
|
|
const mysteryEncounter = this.scene.currentBattle?.mysteryEncounter?.introVisuals;
|
|
if (mysteryEncounter) {
|
|
moveTargets.push(mysteryEncounter);
|
|
}
|
|
|
|
this.scene.tweens.add({
|
|
targets: moveTargets.flat(),
|
|
x: "+=300",
|
|
duration: 2000,
|
|
onComplete: () => {
|
|
if (!this.tryOverrideForBattleSpec()) {
|
|
this.doEncounterCommon();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Set biome weather.
|
|
*/
|
|
trySetWeatherIfNewBiome(): void {
|
|
this.scene.arena.trySetWeather(getRandomWeatherType(this.scene.arena), false);
|
|
}
|
|
}
|