mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-11 10:45:34 +00: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>
77 lines
2.3 KiB
TypeScript
77 lines
2.3 KiB
TypeScript
import BattleScene from "#app/battle-scene";
|
|
import { EncounterPhase } from "./encounter-phase";
|
|
|
|
export class NextEncounterPhase extends EncounterPhase {
|
|
constructor(scene: BattleScene) {
|
|
super(scene);
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
}
|
|
|
|
doEncounter(): void {
|
|
this.scene.playBgm(undefined, true);
|
|
|
|
for (const pokemon of this.scene.getPlayerParty()) {
|
|
if (pokemon) {
|
|
pokemon.resetBattleData();
|
|
}
|
|
}
|
|
|
|
this.scene.arenaNextEnemy.setBiome(this.scene.arena.biomeType);
|
|
this.scene.arenaNextEnemy.setVisible(true);
|
|
|
|
const enemyField = this.scene.getEnemyField();
|
|
const moveTargets: any[] = [ this.scene.arenaEnemy, this.scene.arenaNextEnemy, this.scene.currentBattle.trainer, enemyField, this.scene.lastEnemyTrainer ];
|
|
const lastEncounterVisuals = this.scene.lastMysteryEncounter?.introVisuals;
|
|
if (lastEncounterVisuals) {
|
|
moveTargets.push(lastEncounterVisuals);
|
|
}
|
|
const nextEncounterVisuals = this.scene.currentBattle.mysteryEncounter?.introVisuals;
|
|
if (nextEncounterVisuals) {
|
|
const enterFromRight = nextEncounterVisuals.enterFromRight;
|
|
if (enterFromRight) {
|
|
nextEncounterVisuals.x += 500;
|
|
this.scene.tweens.add({
|
|
targets: nextEncounterVisuals,
|
|
x: "-=200",
|
|
duration: 2000
|
|
});
|
|
} else {
|
|
moveTargets.push(nextEncounterVisuals);
|
|
}
|
|
}
|
|
|
|
this.scene.tweens.add({
|
|
targets: moveTargets.flat(),
|
|
x: "+=300",
|
|
duration: 2000,
|
|
onComplete: () => {
|
|
this.scene.arenaEnemy.setBiome(this.scene.arena.biomeType);
|
|
this.scene.arenaEnemy.setX(this.scene.arenaNextEnemy.x);
|
|
this.scene.arenaEnemy.setAlpha(1);
|
|
this.scene.arenaNextEnemy.setX(this.scene.arenaNextEnemy.x - 300);
|
|
this.scene.arenaNextEnemy.setVisible(false);
|
|
if (this.scene.lastEnemyTrainer) {
|
|
this.scene.lastEnemyTrainer.destroy();
|
|
}
|
|
if (lastEncounterVisuals) {
|
|
this.scene.field.remove(lastEncounterVisuals, true);
|
|
this.scene.lastMysteryEncounter!.introVisuals = undefined;
|
|
}
|
|
|
|
if (!this.tryOverrideForBattleSpec()) {
|
|
this.doEncounterCommon();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Do nothing (since this is simply the next wave in the same biome).
|
|
*/
|
|
trySetWeatherIfNewBiome(): void {
|
|
}
|
|
}
|