mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-22 04:55:53 +02:00
* Replace various `scene` pass-arounds with global scene variable * Modify tests * Add scene back to `fade[in|out]()` calls Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Fix Bug Superfan ME test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Re-enable fixed test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Rename `gScene` to `globalScene` * Move `globalScene` to its own file to fix import/async issues * Fix `SelectModifierPhase` tests * Fix ME tests by removing `scene` from `expect()`s * Resolve merge issues * Remove tsdocs referencing `scene` params Remove missed instances of `.scene` * Remove unnecessary `globalScene` usage in `loading-scene.ts` * Fix merge conflicts * Attempt to fix circular import issue * Found the source of the import issue * Fix merge issues --------- Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com>
32 lines
877 B
TypeScript
32 lines
877 B
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { FieldPosition } from "#app/field/pokemon";
|
|
import { BattlePhase } from "./battle-phase";
|
|
|
|
export class ToggleDoublePositionPhase extends BattlePhase {
|
|
private double: boolean;
|
|
|
|
constructor(double: boolean) {
|
|
super();
|
|
|
|
this.double = double;
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
const playerPokemon = globalScene.getPlayerField().find(p => p.isActive(true));
|
|
if (playerPokemon) {
|
|
playerPokemon.setFieldPosition(this.double && globalScene.getPokemonAllowedInBattle().length > 1 ? FieldPosition.LEFT : FieldPosition.CENTER, 500).then(() => {
|
|
if (playerPokemon.getFieldIndex() === 1) {
|
|
const party = globalScene.getPlayerParty();
|
|
party[1] = party[0];
|
|
party[0] = playerPokemon;
|
|
}
|
|
this.end();
|
|
});
|
|
} else {
|
|
this.end();
|
|
}
|
|
}
|
|
}
|