mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-22 04:55:53 +02:00
* Remove Promises from moves and abilities * Fix `PostSummonPhase` * Apply suggestions from Kev's review * More suggestions Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Cleaning up some updated functions * Remove Promise from `addEnemyModifier` + fixes to some extraneous `await`s * Test fixes * Fix missing import in revival blessing test Co-authored-by: innerthunder <brandonerickson98@gmail.com> * Add back applyPreLeaveFieldAttrs Attribute was removed due to absence in a cherry-pick * Make applyPostApplyEffects work * Fix move-effect-phase.ts applications Some applyX methods were missed in the cherry pick commit and were still returning functions instead of running the function themselves * Mock `BattleScene.addPokemonIcon` in tests * Revival Blessing condition and tests * Incorporate Despair-Games/poketernity/pull/48 * Break up imports * Remove enemy modifier chance dead code * Remove async from applyAbAttrsInternal Stray async leftover from merge * Remove docs and comments referencing promises * Add `user.setTempAbility` to transform phase --------- Co-authored-by: innerthunder <brandonerickson98@gmail.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: PigeonBar <56974298+PigeonBar@users.noreply.github.com>
37 lines
1.4 KiB
TypeScript
37 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);
|
|
const field = pokemon.isPlayer() ? globalScene.getPlayerField() : globalScene.getEnemyField();
|
|
field.forEach((p) => applyAbAttrs(CommanderAbAttr, p, null, false));
|
|
|
|
this.end();
|
|
}
|
|
}
|