Skip to content

Commit

Permalink
Ensure Revival Blessing only heals fainted Pokemon (smogon#2142)
Browse files Browse the repository at this point in the history
  • Loading branch information
MathyFurret committed Mar 25, 2024
1 parent 415e6d3 commit 0b97967
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down

0 comments on commit 0b97967

Please sign in to comment.