mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-23 05:25:58 +02:00
* Replace various `scene` pass-arounds with global scene variable * Modify tests * Add scene back to `fade[in|out]()` calls Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Fix Bug Superfan ME test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Re-enable fixed test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Rename `gScene` to `globalScene` * Move `globalScene` to its own file to fix import/async issues * Fix `SelectModifierPhase` tests * Fix ME tests by removing `scene` from `expect()`s * Resolve merge issues * Remove tsdocs referencing `scene` params Remove missed instances of `.scene` * Remove unnecessary `globalScene` usage in `loading-scene.ts` * Fix merge conflicts * Attempt to fix circular import issue * Found the source of the import issue * Fix merge issues --------- Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com>
31 lines
750 B
TypeScript
31 lines
750 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()).then(() => this.end());
|
|
} else {
|
|
this.end();
|
|
}
|
|
}
|
|
}
|