Skip to content

Commit

Permalink
Fix for [Bug] Metal Burst causes game to crash if intended target fai…
Browse files Browse the repository at this point in the history
…nts #4575
  • Loading branch information
seanrmon committed Oct 4, 2024
1 parent 75bd730 commit 909264b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/phases/move-phase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ export class MovePhase extends BattlePhase {
// account for metal burst and comeuppance hitting remaining targets in double battles
// counterattack will redirect to remaining ally if original attacker faints
if (this.scene.currentBattle.double && this.move.getMove().hasFlag(MoveFlags.REDIRECT_COUNTER)) {
if (this.scene.getField()[this.targets[0]].hp === 0) {
if (attacker?.isActive(true) && this.scene.getField()[this.targets[0]].hp === 0) {
const opposingField = this.pokemon.isPlayer() ? this.scene.getEnemyField() : this.scene.getPlayerField();
this.targets[0] = opposingField.find(p => p.hp > 0)?.getBattlerIndex() ?? BattlerIndex.ATTACKER;
}
Expand Down

0 comments on commit 909264b

Please sign in to comment.