mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 05:52:17 +02:00
* Add abilityAttr.is methods * [WIP] move modifier stuff around * Untangle circular deps from modifiers * Move unlockables to own file * Untangle all circular deps outside of MEs * Move constants in MEs to their own files * Re-add missing import to battle.ts * Add necessary overload for getTag * Add missing type import in weather.ts * Init modifier types and pools in loading-scene * Remove stray commented code * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --------- 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 } from "#app/data/abilities/apply-ab-attrs";
|
|
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));
|
|
}
|
|
}
|