mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-25 14:35:51 +02:00
* [Item] Add Weather and Terrain Extender Item * Add Documentation * Clean Up Unit Tests * Add Weight Function * Include Suggestions
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import { globalScene } from "#app/global-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() {
|
|
super();
|
|
}
|
|
|
|
doEncounter(): void {
|
|
globalScene.playBgm(undefined, true);
|
|
|
|
for (const pokemon of globalScene.getPlayerParty()) {
|
|
if (pokemon) {
|
|
pokemon.resetBattleData();
|
|
pokemon.customPokemonData.resetHitReceivedCount();
|
|
}
|
|
}
|
|
|
|
for (const pokemon of globalScene.getPlayerParty().filter(p => p.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));
|
|
}
|
|
}
|