Add Pokemon heal function

pull/2/head
Flashfyre 2023-10-21 20:52:19 -04:00
parent 7dbf3f62da
commit 96a154f5e0
2 changed files with 8 additions and 1 deletions

View File

@ -2485,7 +2485,7 @@ export class PokemonHealPhase extends CommonAnimPhase {
const hpRestoreMultiplier = new Utils.IntegerHolder(1);
if (!this.revive)
this.scene.applyModifiers(HealingBoosterModifier, this.player, hpRestoreMultiplier);
pokemon.hp = Math.min(pokemon.hp + this.hpHealed * hpRestoreMultiplier.value, pokemon.getMaxHp());
pokemon.heal(this.hpHealed * hpRestoreMultiplier.value);
pokemon.updateInfo().then(() => super.end());
} else if (this.showFullHpMessage)
this.message = getPokemonMessage(pokemon, `'s\nHP is full!`);

View File

@ -759,6 +759,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
}
heal(amount: integer): void {
if (this.isFainted())
return;
this.hp = Math.min(this.hp + amount, this.getMaxHp());
}
addTag(tagType: BattlerTagType, turnCount?: integer, sourceMove?: Moves, sourceId?: integer): boolean {
const existingTag = this.getTag(tagType);
if (existingTag) {