pokerogue/src/phases/new-biome-encounter-phase.ts

39 lines
1.1 KiB
TypeScript
Raw Normal View History

import BattleScene from "#app/battle-scene";
import { applyAbAttrs, PostBiomeChangeAbAttr } from "#app/data/ability";
import { getRandomWeatherType } from "#app/data/weather";
2024-08-19 03:23:52 +01:00
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.getParty()) {
if (pokemon) {
pokemon.resetBattleData();
}
}
this.scene.arena.trySetWeather(getRandomWeatherType(this.scene.arena), false);
for (const pokemon of this.scene.getParty().filter(p => p.isOnField())) {
applyAbAttrs(PostBiomeChangeAbAttr, pokemon, null);
}
const enemyField = this.scene.getEnemyField();
this.scene.tweens.add({
targets: [this.scene.arenaEnemy, enemyField].flat(),
x: "+=300",
duration: 2000,
onComplete: () => {
if (!this.tryOverrideForBattleSpec()) {
this.doEncounterCommon();
}
}
});
}
}