mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-24 05:55:56 +02:00
30 lines
718 B
TypeScript
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();
|
|
}
|
|
}
|