pokerogue/src/phases/pokemon-phase.ts
Wlowscha 8d043a9f55
[Refactor] Replace all instances of integer with number (#5250)
* Replaced instances of "integer" with "number"
2025-02-04 17:56:13 -07:00

29 lines
968 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?
}
}