mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-20 16:42:45 +02:00
* Add PostSummonHealAbAttr and give it to appropriate abilities * Add attr to insomnia * Remove attr from leaf guard (it does not activate on gain with sun up) * Add tests and remove attr from shields down * Add PostSummonRemoveBattlerTag and give it to oblivious and own tempo * Add tests for oblivious and own tempo * Fix oblivious test sometimes failing * Remove Comatose changes as it doesn't reapply * Remove unused tagRemoved field * Fix tests checking status instead of tag * Fix attr comments * Add PostSetStatusHealStatusAbAttr * Add ResetStatusPhase * Modify pokemon.resetStatus to use ResetStatusPhase * Move post status effects to ObtainStatusEffectPhase * Ensure status overriding (ie rest) works properly * Add PostApplyBattlerTagRemoveTagAbAttr for own tempo and oblivious * Guard removeTag call in PostApplyBattlerTagRemoveTagAbAttr * Commenting * Handle Mold Breaker case in MoveEndPhase * Remove PostSummonHealStatusAbAttr from purifying salt * Fix not passing overrideStatus to canSetStatus * Apply suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Add isNullOrUndefined import * Add canApply to new attrs * Add followup argument back * Remove guard around new MoveEndPhase --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import type Pokemon from "#app/field/pokemon";
|
|
import { BattlePhase } from "#app/phases/battle-phase";
|
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
|
import { StatusEffect } from "#enums/status-effect";
|
|
|
|
/**
|
|
* Phase which handles resetting a Pokemon's status to none
|
|
*
|
|
* This is necessary to perform in a phase primarly to ensure that the status icon disappears at the correct time in the battle
|
|
*/
|
|
export class ResetStatusPhase extends BattlePhase {
|
|
private readonly pokemon: Pokemon;
|
|
private readonly affectConfusion: boolean;
|
|
private readonly reloadAssets: boolean;
|
|
|
|
constructor(pokemon: Pokemon, affectConfusion: boolean, reloadAssets: boolean) {
|
|
super();
|
|
|
|
this.pokemon = pokemon;
|
|
this.affectConfusion = affectConfusion;
|
|
this.reloadAssets = reloadAssets;
|
|
}
|
|
|
|
public override start() {
|
|
const lastStatus = this.pokemon.status?.effect;
|
|
this.pokemon.status = null;
|
|
if (lastStatus === StatusEffect.SLEEP) {
|
|
this.pokemon.setFrameRate(10);
|
|
if (this.pokemon.getTag(BattlerTagType.NIGHTMARE)) {
|
|
this.pokemon.lapseTag(BattlerTagType.NIGHTMARE);
|
|
}
|
|
}
|
|
if (this.affectConfusion) {
|
|
if (this.pokemon.getTag(BattlerTagType.CONFUSED)) {
|
|
this.pokemon.lapseTag(BattlerTagType.CONFUSED);
|
|
}
|
|
}
|
|
if (this.reloadAssets) {
|
|
this.pokemon.loadAssets(false).then(() => this.pokemon.playAnim());
|
|
}
|
|
this.pokemon.updateInfo(true);
|
|
this.end();
|
|
}
|
|
}
|