Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure Revival Blessing only heals fainted Pokemon #2142

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading