pokerogue/src/phases/move-header-phase.ts
2025-03-07 19:10:29 -06:00

30 lines
718 B
TypeScript

import { applyMoveAttrs, MoveHeaderAttr } from "#app/data/moves/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();
}
}