Implements healer (#259)

* Implements healer

* adds an ally check to the condition

* done testing, changes chance back to 30%

* adds comment header for PostTurnResetStatusAbAttr

* adds override to resetStatus to not allow revive

* dont revive

* override revert
pull/666/head
alpaca 2024-05-08 21:21:55 -04:00 committed by GitHub
parent 71e9d0c385
commit 76ac86d2ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 6 deletions

View File

@ -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 {
applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
if (pokemon.status) {
private allyTarget: boolean;
private target: Pokemon;
pokemon.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectHealText(pokemon.status?.effect)));
pokemon.resetStatus();
pokemon.updateInfo();
constructor(allyTarget: boolean = false) {
super(true);
this.allyTarget = allyTarget;
}
applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
if (this.allyTarget) {
this.target = pokemon.getAlly();
} else {
this.target = pokemon;
}
if (this.target?.status) {
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(),

View File

@ -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);