From 0b97967a93bc576de5abdab0ff11ccd0af4dc537 Mon Sep 17 00:00:00 2001 From: Alexander B <4866817+MathyFurret@users.noreply.github.com> Date: Fri, 1 Sep 2023 11:35:50 -0500 Subject: [PATCH] Ensure Revival Blessing only heals fainted Pokemon (#2142) --- src/battle.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/battle.ts b/src/battle.ts index a43ec41503f..35c2c02d00b 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -1733,7 +1733,7 @@ export class Battle { break; } case '-heal': { - let poke = this.getPokemon(args[1])!; + let poke = this.getPokemon(args[1], Dex.getEffect(kwArgs.from).id === 'revivalblessing')!; let damage = poke.healthParse(args[2], true, true); if (damage === null) break; let range = poke.getDamageRange(damage); @@ -3279,7 +3279,7 @@ export class Battle { } return null; } - getPokemon(pokemonid: string | undefined) { + getPokemon(pokemonid: string | undefined, faintedOnly = false) { if (!pokemonid || pokemonid === '??' || pokemonid === 'null' || pokemonid === 'false') { return null; } @@ -3295,6 +3295,7 @@ export class Battle { for (const pokemon of side.pokemon) { if (isInactive && side.active.includes(pokemon)) continue; + if (faintedOnly && pokemon.hp) continue; if (pokemon.ident === pokemonid) { // name matched, good enough if (slot >= 0) pokemon.slot = slot; return pokemon;