mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-16 06:45:24 +01:00
* [Dev] Enable Biome import sorting Additional changes: - Implement import aliases - Convert default exports to named exports - Remove relative imports * Apply changes * Misc fixes * Merge cleanup
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { applyAbAttrs } from "#abilities/apply-ab-attrs";
|
|
import { globalScene } from "#app/global-scene";
|
|
import type { BattlerIndex } from "#enums/battler-index";
|
|
import { BattlerTagLapseType } from "#enums/battler-tag-lapse-type";
|
|
import type { Pokemon } from "#field/pokemon";
|
|
import { PokemonPhase } from "#phases/pokemon-phase";
|
|
|
|
export class MoveEndPhase extends PokemonPhase {
|
|
public readonly phaseName = "MoveEndPhase";
|
|
private wasFollowUp: boolean;
|
|
|
|
/** Targets from the preceding MovePhase */
|
|
private targets: Pokemon[];
|
|
constructor(battlerIndex: BattlerIndex, targets: Pokemon[], wasFollowUp = false) {
|
|
super(battlerIndex);
|
|
|
|
this.targets = targets;
|
|
this.wasFollowUp = wasFollowUp;
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
const pokemon = this.getPokemon();
|
|
if (!this.wasFollowUp && pokemon?.isActive(true)) {
|
|
pokemon.lapseTags(BattlerTagLapseType.AFTER_MOVE);
|
|
}
|
|
|
|
// Remove effects which were set on a Pokemon which removes them on summon (i.e. via Mold Breaker)
|
|
globalScene.arena.setIgnoreAbilities(false);
|
|
for (const target of this.targets) {
|
|
if (target) {
|
|
applyAbAttrs("PostSummonRemoveEffectAbAttr", { pokemon: target });
|
|
}
|
|
}
|
|
|
|
this.end();
|
|
}
|
|
}
|