pokerogue/src/phases/pokemon-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

30 lines
979 B
TypeScript

import BattleScene from "#app/battle-scene";
import { BattlerIndex } from "#app/battle";
import Pokemon from "#app/field/pokemon";
import { FieldPhase } from "./field-phase";
export abstract class PokemonPhase extends FieldPhase {
protected battlerIndex: BattlerIndex | integer;
public player: boolean;
public fieldIndex: integer;
constructor(scene: BattleScene, battlerIndex?: BattlerIndex | integer) {
super(scene);
if (battlerIndex === undefined) {
battlerIndex = scene.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 this.scene.getPokemonById(this.battlerIndex)!; //TODO: is this bang correct?
}
return this.scene.getField()[this.battlerIndex]!; //TODO: is this bang correct?
}
}