mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-20 20:15:50 +02: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>
32 lines
907 B
TypeScript
32 lines
907 B
TypeScript
import BattleScene from "#app/battle-scene";
|
|
import { FieldPosition } from "#app/field/pokemon";
|
|
import { BattlePhase } from "./battle-phase";
|
|
|
|
export class ToggleDoublePositionPhase extends BattlePhase {
|
|
private double: boolean;
|
|
|
|
constructor(scene: BattleScene, double: boolean) {
|
|
super(scene);
|
|
|
|
this.double = double;
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
const playerPokemon = this.scene.getPlayerField().find(p => p.isActive(true));
|
|
if (playerPokemon) {
|
|
playerPokemon.setFieldPosition(this.double && this.scene.getParty().filter(p => p.isAllowedInBattle()).length > 1 ? FieldPosition.LEFT : FieldPosition.CENTER, 500).then(() => {
|
|
if (playerPokemon.getFieldIndex() === 1) {
|
|
const party = this.scene.getParty();
|
|
party[1] = party[0];
|
|
party[0] = playerPokemon;
|
|
}
|
|
this.end();
|
|
});
|
|
} else {
|
|
this.end();
|
|
}
|
|
}
|
|
}
|