mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-20 15:22:19 +02:00
Add ResetStatusPhase
This commit is contained in:
parent
3c72c73f6e
commit
97e19f0407
39
src/phases/reset-status-phase.ts
Normal file
39
src/phases/reset-status-phase.ts
Normal file
@ -0,0 +1,39 @@
|
||||
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";
|
||||
|
||||
export class ResetStatusPhase extends BattlePhase {
|
||||
private pokemon: Pokemon;
|
||||
private affectConfusion: boolean;
|
||||
private 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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user