diff --git a/src/data/ability.ts b/src/data/ability.ts index 715c3f7d4..04cd18ada 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2055,13 +2055,30 @@ export class PostTurnAbAttr extends AbAttr { } } +/** + * After the turn ends, resets the status of either the ability holder or their ally + * @param {boolean} allyTarget Whether to target ally, defaults to false (self-target) + */ export class PostTurnResetStatusAbAttr extends PostTurnAbAttr { + private allyTarget: boolean; + private target: Pokemon; + + constructor(allyTarget: boolean = false) { + super(true); + this.allyTarget = allyTarget; + } + applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean { - if (pokemon.status) { + if (this.allyTarget) { + this.target = pokemon.getAlly(); + } else { + this.target = pokemon; + } + if (this.target?.status) { - pokemon.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectHealText(pokemon.status?.effect))); - pokemon.resetStatus(); - pokemon.updateInfo(); + this.target.scene.queueMessage(getPokemonMessage(this.target, getStatusEffectHealText(this.target.status?.effect))); + this.target.resetStatus(false); + this.target.updateInfo(); return true; } @@ -3109,7 +3126,7 @@ export function initAbilities() { .attr(PostDefendMoveDisableAbAttr, 30) .bypassFaint(), new Ability(Abilities.HEALER, 5) - .unimplemented(), + .conditionalAttr(pokemon => pokemon.getAlly() && Utils.randSeedInt(10) < 3, PostTurnResetStatusAbAttr, true), new Ability(Abilities.FRIEND_GUARD, 5) .ignorable() .unimplemented(), diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index f12fc14b1..1ba88e05a 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1959,8 +1959,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return true; } - resetStatus(): void { + /** + * Resets the status of a pokemon + * @param revive whether revive should be cured, defaults to true + */ + resetStatus(revive: boolean = true): void { const lastStatus = this.status?.effect; + if (!revive && lastStatus === StatusEffect.FAINT) { + return; + } this.status = undefined; if (lastStatus === StatusEffect.SLEEP) { this.setFrameRate(12);