diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 6e00fa05ac9..c9dfae5d140 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2084,7 +2084,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { source.turnData.damageDealt += damage.value; source.turnData.currDamageDealt = damage.value; this.battleData.hitCount++; - const attackResult = { move: move.id, result: result as DamageResult, damage: damage.value, critical: isCritical, sourceId: source.id, attackingPosition: source.getBattlerIndex() }; + const attackResult = { move: move.id, result: result as DamageResult, damage: damage.value, critical: isCritical, sourceId: source.id, sourceBattlerIndex: source.getBattlerIndex() }; this.turnData.attacksReceived.unshift(attackResult); if (source.isPlayer() && !this.isPlayer()) { this.scene.applyModifiers(DamageMoneyRewardModifier, true, source, damage); @@ -4021,7 +4021,7 @@ export interface AttackMoveResult { damage: integer; critical: boolean; sourceId: integer; - attackingPosition: BattlerIndex; + sourceBattlerIndex: BattlerIndex; } export class PokemonSummonData { diff --git a/src/phases.ts b/src/phases.ts index fad95951c26..dc5dcd0d167 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2666,13 +2666,14 @@ export class MovePhase extends BattlePhase { if (this.targets.length === 1 && this.targets[0] === BattlerIndex.ATTACKER) { if (this.pokemon.turnData.attacksReceived.length) { const attack = this.pokemon.turnData.attacksReceived[0]; - this.targets[0] = attack.attackingPosition; + this.targets[0] = attack.sourceBattlerIndex; // 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.getEnemyField()[this.targets[0]]) { - this.targets[0] = this.scene.getEnemyField().find(p => p.isActive(true)).getBattlerIndex(); + if (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(); } } }