pokerogue/src/phases/move-header-phase.ts
flx-sta 2bd07cb84e
fix and optimize imports (#4061)
- remove any `.js` extension imports
- remove unncessary dynamic imports of `modifier.ts` file. The file was being imported statically & dynamically. Made it pure static
- increase vite chunk-size warning limit

Co-authored-by: Mumble <171087428+frutescens@users.noreply.github.com>
2024-09-07 21:37:37 -07:00

31 lines
777 B
TypeScript

import BattleScene from "#app/battle-scene";
import { applyMoveAttrs, MoveHeaderAttr } from "#app/data/move";
import Pokemon, { PokemonMove } from "#app/field/pokemon";
import { BattlePhase } from "./battle-phase";
export class MoveHeaderPhase extends BattlePhase {
public pokemon: Pokemon;
public move: PokemonMove;
constructor(scene: BattleScene, pokemon: Pokemon, move: PokemonMove) {
super(scene);
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()).then(() => this.end());
} else {
this.end();
}
}
}