mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-11 20:35:18 +01:00
* Move phase types out of phase interceptor * Create isXPhase method and add properties to each phase * Replace instanceof phase with isXPhase * Fix missing union types for phaseName * Update doc comment in phase.ts * Fix incomplete comment in encounter-phase * Make phaseName as public and fix more uses * Move phaseName property declaration before constructor in move anim phase Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Rename isXPhase to is --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { applyAbAttrs, PostBiomeChangeAbAttr } from "#app/data/abilities/ability";
|
|
import { getRandomWeatherType } from "#app/data/weather";
|
|
import { NextEncounterPhase } from "./next-encounter-phase";
|
|
|
|
export class NewBiomeEncounterPhase extends NextEncounterPhase {
|
|
public readonly phaseName = "NewBiomeEncounterPhase";
|
|
doEncounter(): void {
|
|
globalScene.playBgm(undefined, true);
|
|
|
|
// Reset all battle and wave data, perform form changes, etc.
|
|
// We do this because new biomes are considered "arena transitions" akin to MEs and trainer battles
|
|
for (const pokemon of globalScene.getPlayerParty()) {
|
|
if (pokemon) {
|
|
pokemon.resetBattleAndWaveData();
|
|
if (pokemon.isOnField()) {
|
|
applyAbAttrs(PostBiomeChangeAbAttr, pokemon, null);
|
|
}
|
|
}
|
|
}
|
|
|
|
const enemyField = globalScene.getEnemyField();
|
|
const moveTargets: any[] = [globalScene.arenaEnemy, enemyField];
|
|
const mysteryEncounter = globalScene.currentBattle?.mysteryEncounter?.introVisuals;
|
|
if (mysteryEncounter) {
|
|
moveTargets.push(mysteryEncounter);
|
|
}
|
|
|
|
globalScene.tweens.add({
|
|
targets: moveTargets.flat(),
|
|
x: "+=300",
|
|
duration: 2000,
|
|
onComplete: () => {
|
|
if (!this.tryOverrideForBattleSpec()) {
|
|
this.doEncounterCommon();
|
|
}
|
|
},
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Set biome weather.
|
|
*/
|
|
trySetWeatherIfNewBiome(): void {
|
|
globalScene.arena.trySetWeather(getRandomWeatherType(globalScene.arena));
|
|
}
|
|
}
|