mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-06 08:07:42 +00:00
- 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>
30 lines
979 B
TypeScript
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?
|
|
}
|
|
}
|