Implement StatusEffect[] change suggested by @happinyz

pull/727/head
kd8lvt 2024-05-10 21:07:26 -04:00
parent 66fcc00e1f
commit 77dd1262d9
1 changed files with 5 additions and 7 deletions

View File

@ -2400,17 +2400,15 @@ export class ReduceStatusEffectDurationAbAttr extends AbAttr {
export class HealFromStatusAbAttr extends AbAttr {
private healRatio: integer
private statusEffect: StatusEffect;
private statusEffect2: StatusEffect;
constructor(healRatio: integer,statusEffect: StatusEffect,statusEffect2: StatusEffect) {
private statusEffects: StatusEffect[];
constructor(healRatio: integer,statusEffects: StatusEffect[]) {
super();
this.healRatio = healRatio;
this.statusEffect = statusEffect;
this.statusEffect2 = statusEffect2;
this.statusEffects = statusEffects;
}
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean | Promise<boolean> {
if (pokemon.status.effect === this.statusEffect || pokemon.status.effect === this.statusEffect2) {
if (this.statusEffects.includes(pokemon.status.effect)) {
let healAmount: integer = Math.floor(pokemon.getMaxHp()*(this.healRatio/8));
pokemon.heal(healAmount);
pokemon.status.incrementTurn();
@ -3037,7 +3035,7 @@ export function initAbilities() {
new Ability(Abilities.IRON_FIST, 4)
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.PUNCHING_MOVE), 1.2),
new Ability(Abilities.POISON_HEAL, 4)
.attr(HealFromStatusAbAttr,1,StatusEffect.POISON,StatusEffect.TOXIC),
.attr(HealFromStatusAbAttr,1,[StatusEffect.POISON,StatusEffect.TOXIC]),
new Ability(Abilities.ADAPTABILITY, 4)
.attr(StabBoostAbAttr),
new Ability(Abilities.SKILL_LINK, 4)