pokerogue/src/phases/load-move-anim-phase.ts
Sirz Benjie e4ce822ce6
[Refactor] Remove Promises from moves and abilities (#5283)
* Remove Promises from moves and abilities

* Fix `PostSummonPhase`

* Apply suggestions from Kev's review

* More suggestions

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

* Cleaning up some updated functions

* Remove Promise from `addEnemyModifier`

+ fixes to some extraneous `await`s

* Test fixes

* Fix missing import in revival blessing test

Co-authored-by: innerthunder <brandonerickson98@gmail.com>

* Add back applyPreLeaveFieldAttrs

Attribute was removed due to absence in a cherry-pick

* Make applyPostApplyEffects work

* Fix move-effect-phase.ts applications

Some applyX methods were missed in the cherry pick commit and were still returning functions instead of running the function themselves

* Mock `BattleScene.addPokemonIcon` in tests

* Revival Blessing condition and tests

* Incorporate Despair-Games/poketernity/pull/48

* Break up imports

* Remove enemy modifier chance dead code

* Remove async from applyAbAttrsInternal

Stray async leftover from merge

* Remove docs and comments referencing promises

* Add `user.setTempAbility` to transform phase

---------

Co-authored-by: innerthunder <brandonerickson98@gmail.com>
Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: PigeonBar <56974298+PigeonBar@users.noreply.github.com>
2025-02-21 09:34:39 +01:00

21 lines
581 B
TypeScript

import { initMoveAnim, loadMoveAnimAssets } from "#app/data/battle-anims";
import type { Moves } from "#enums/moves";
import { Phase } from "#app/phase";
/**
* Phase for synchronous move animation loading.
* Should be used when a move invokes another move that
* isn't already loaded (e.g. for Metronome)
*/
export class LoadMoveAnimPhase extends Phase {
constructor(protected moveId: Moves) {
super();
}
public override start(): void {
initMoveAnim(this.moveId)
.then(() => loadMoveAnimAssets([ this.moveId ], true))
.then(() => this.end());
}
}