mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-18 15:48:52 +01:00
* 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>
30 lines
712 B
TypeScript
30 lines
712 B
TypeScript
import { applyMoveAttrs, MoveHeaderAttr } from "#app/data/move";
|
|
import type { PokemonMove } from "#app/field/pokemon";
|
|
import type Pokemon from "#app/field/pokemon";
|
|
import { BattlePhase } from "./battle-phase";
|
|
|
|
export class MoveHeaderPhase extends BattlePhase {
|
|
public pokemon: Pokemon;
|
|
public move: PokemonMove;
|
|
|
|
constructor(pokemon: Pokemon, move: PokemonMove) {
|
|
super();
|
|
|
|
this.pokemon = pokemon;
|
|
this.move = move;
|
|
}
|
|
|
|
canMove(): boolean {
|
|
return this.pokemon.isActive(true) && this.move.isUsable(this.pokemon);
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
if (this.canMove()) {
|
|
applyMoveAttrs(MoveHeaderAttr, this.pokemon, null, this.move.getMove());
|
|
}
|
|
this.end();
|
|
}
|
|
}
|