mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-30 21:42:20 +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>
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import type { BattlerIndex } from "#app/battle";
|
|
import { applyAbAttrs, applyPostSummonAbAttrs, CommanderAbAttr, PostSummonAbAttr } from "#app/data/ability";
|
|
import { ArenaTrapTag } from "#app/data/arena-tag";
|
|
import { StatusEffect } from "#app/enums/status-effect";
|
|
import { PokemonPhase } from "./pokemon-phase";
|
|
import { MysteryEncounterPostSummonTag } from "#app/data/battler-tags";
|
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
|
|
|
export class PostSummonPhase extends PokemonPhase {
|
|
constructor(battlerIndex: BattlerIndex) {
|
|
super(battlerIndex);
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
const pokemon = this.getPokemon();
|
|
|
|
if (pokemon.status?.effect === StatusEffect.TOXIC) {
|
|
pokemon.status.toxicTurnCount = 0;
|
|
}
|
|
globalScene.arena.applyTags(ArenaTrapTag, false, pokemon);
|
|
|
|
// If this is mystery encounter and has post summon phase tag, apply post summon effects
|
|
if (globalScene.currentBattle.isBattleMysteryEncounter() && pokemon.findTags(t => t instanceof MysteryEncounterPostSummonTag).length > 0) {
|
|
pokemon.lapseTag(BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON);
|
|
}
|
|
|
|
applyPostSummonAbAttrs(PostSummonAbAttr, pokemon)
|
|
.then(() => {
|
|
const field = pokemon.isPlayer() ? globalScene.getPlayerField() : globalScene.getEnemyField();
|
|
field.forEach((p) => applyAbAttrs(CommanderAbAttr, p, null, false));
|
|
|
|
this.end();
|
|
});
|
|
}
|
|
}
|