Add Pokemon heal function
parent
7dbf3f62da
commit
96a154f5e0
|
@ -2485,7 +2485,7 @@ export class PokemonHealPhase extends CommonAnimPhase {
|
||||||
const hpRestoreMultiplier = new Utils.IntegerHolder(1);
|
const hpRestoreMultiplier = new Utils.IntegerHolder(1);
|
||||||
if (!this.revive)
|
if (!this.revive)
|
||||||
this.scene.applyModifiers(HealingBoosterModifier, this.player, hpRestoreMultiplier);
|
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());
|
pokemon.updateInfo().then(() => super.end());
|
||||||
} else if (this.showFullHpMessage)
|
} else if (this.showFullHpMessage)
|
||||||
this.message = getPokemonMessage(pokemon, `'s\nHP is full!`);
|
this.message = getPokemonMessage(pokemon, `'s\nHP is full!`);
|
||||||
|
|
|
@ -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 {
|
addTag(tagType: BattlerTagType, turnCount?: integer, sourceMove?: Moves, sourceId?: integer): boolean {
|
||||||
const existingTag = this.getTag(tagType);
|
const existingTag = this.getTag(tagType);
|
||||||
if (existingTag) {
|
if (existingTag) {
|
||||||
|
|
Loading…
Reference in New Issue