mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-29 13:02:46 +02:00
* Add abilityAttr.is methods * [WIP] move modifier stuff around * Untangle circular deps from modifiers * Move unlockables to own file * Untangle all circular deps outside of MEs * Move constants in MEs to their own files * Re-add missing import to battle.ts * Add necessary overload for getTag * Add missing type import in weather.ts * Init modifier types and pools in loading-scene * Remove stray commented code * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { BattlerTagLapseType } from "#enums/battler-tag-lapse-type";
|
|
import { PokemonPhase } from "./pokemon-phase";
|
|
import type { BattlerIndex } from "#enums/battler-index";
|
|
import { applyPostSummonAbAttrs } from "#app/data/abilities/apply-ab-attrs";
|
|
import type Pokemon from "#app/field/pokemon";
|
|
|
|
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);
|
|
}
|
|
globalScene.arena.setIgnoreAbilities(false);
|
|
|
|
// Remove effects which were set on a Pokemon which removes them on summon (i.e. via Mold Breaker)
|
|
for (const target of this.targets) {
|
|
if (target) {
|
|
applyPostSummonAbAttrs("PostSummonRemoveEffectAbAttr", target);
|
|
}
|
|
}
|
|
|
|
this.end();
|
|
}
|
|
}
|