pokerogue/src/phases/new-biome-encounter-phase.ts
geeilhan f3256ec5d4
[Move] Improve implementation of Rage Fist damage increase (#5129)
* implementation of rage fist

* Apply suggestions from code review

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Update src/test/moves/rage_fist.test.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* added removed TODO from some test cases

* Apply suggestions from code review

Added changes to documentation and cleaning up code

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* added protected to updateHitReceivedCount()

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: damocleas <damocleas25@gmail.com>
2025-01-19 11:52:50 -06:00

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), false);
}
}