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 revertpull/666/head
parent
71e9d0c385
commit
76ac86d2ae
|
@ -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 {
|
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 {
|
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)));
|
this.target.scene.queueMessage(getPokemonMessage(this.target, getStatusEffectHealText(this.target.status?.effect)));
|
||||||
pokemon.resetStatus();
|
this.target.resetStatus(false);
|
||||||
pokemon.updateInfo();
|
this.target.updateInfo();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3109,7 +3126,7 @@ export function initAbilities() {
|
||||||
.attr(PostDefendMoveDisableAbAttr, 30)
|
.attr(PostDefendMoveDisableAbAttr, 30)
|
||||||
.bypassFaint(),
|
.bypassFaint(),
|
||||||
new Ability(Abilities.HEALER, 5)
|
new Ability(Abilities.HEALER, 5)
|
||||||
.unimplemented(),
|
.conditionalAttr(pokemon => pokemon.getAlly() && Utils.randSeedInt(10) < 3, PostTurnResetStatusAbAttr, true),
|
||||||
new Ability(Abilities.FRIEND_GUARD, 5)
|
new Ability(Abilities.FRIEND_GUARD, 5)
|
||||||
.ignorable()
|
.ignorable()
|
||||||
.unimplemented(),
|
.unimplemented(),
|
||||||
|
|
|
@ -1959,8 +1959,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
return true;
|
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;
|
const lastStatus = this.status?.effect;
|
||||||
|
if (!revive && lastStatus === StatusEffect.FAINT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.status = undefined;
|
this.status = undefined;
|
||||||
if (lastStatus === StatusEffect.SLEEP) {
|
if (lastStatus === StatusEffect.SLEEP) {
|
||||||
this.setFrameRate(12);
|
this.setFrameRate(12);
|
||||||
|
|
Loading…
Reference in New Issue