pokerogue/src/phases/pokemon-phase.ts
Sirz Benjie 408b66f913
[Misc][Refactor][GitHub] Ditch eslint for biome, and add a formatter (#5495)
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-03-09 14:13:25 -07:00

33 lines
995 B
TypeScript

import { globalScene } from "#app/global-scene";
import { BattlerIndex } from "#app/battle";
import type Pokemon from "#app/field/pokemon";
import { FieldPhase } from "./field-phase";
export abstract class PokemonPhase extends FieldPhase {
protected battlerIndex: BattlerIndex | number;
public player: boolean;
public fieldIndex: number;
constructor(battlerIndex?: BattlerIndex | number) {
super();
if (battlerIndex === undefined) {
battlerIndex = globalScene
.getField()
.find(p => p?.isActive())!
.getBattlerIndex(); // TODO: is the bang correct here?
}
this.battlerIndex = battlerIndex;
this.player = battlerIndex < 2;
this.fieldIndex = battlerIndex % 2;
}
getPokemon(): Pokemon {
if (this.battlerIndex > BattlerIndex.ENEMY_2) {
return globalScene.getPokemonById(this.battlerIndex)!; //TODO: is this bang correct?
}
return globalScene.getField()[this.battlerIndex]!; //TODO: is this bang correct?
}
}