diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 95a7f0f9ced..010b787e098 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -1851,21 +1851,18 @@ export class CounterRedirectAttr extends MoveAttr { // check if the target is still alive if ( globalScene.currentBattle.double && - !globalScene.getField()[desiredTarget]?.isActive + !globalScene.getField()[desiredTarget]?.isActive(true) ) { const targetField = desiredTarget >= BattlerIndex.ENEMY ? globalScene.getEnemyField() : globalScene.getPlayerField(); args[0].value = targetField.find(p => p.hp > 0)?.getBattlerIndex() ?? BattlerIndex.ATTACKER; } else { args[0].value = desiredTarget; } + console.log(`CounterRedirectAttr: Redirecting move to battler index ${BattlerIndex[args[0].value]}`); return true; } return false; } - - override canApply(user: Pokemon, target: Pokemon, move: Move, args: [NumberHolder, ...any[]]): boolean { - return args[0].value === BattlerIndex.ATTACKER; - } } export class LevelDamageAttr extends FixedDamageAttr { @@ -9387,6 +9384,7 @@ export function initMoves() { .bitingMove(), new AttackMove(MoveId.MIRROR_COAT, PokemonType.PSYCHIC, MoveCategory.SPECIAL, -1, 100, 20, -1, -5, 2) .attr(CounterDamageAttr, 2, MoveCategory.SPECIAL) + .attr(CounterRedirectAttr, MoveCategory.SPECIAL) .condition(counterAttackCondition_Special, 3) .target(MoveTarget.ATTACKER), new StatusMove(MoveId.PSYCH_UP, PokemonType.NORMAL, -1, 10, -1, 0, 2) @@ -9805,6 +9803,7 @@ export function initMoves() { .target(MoveTarget.USER_OR_NEAR_ALLY), new AttackMove(MoveId.METAL_BURST, PokemonType.STEEL, MoveCategory.PHYSICAL, -1, 100, 10, -1, 0, 4) .attr(CounterDamageAttr, 1.5) + .attr(CounterRedirectAttr) .condition(counterAttackCondition_Both, 3) .makesContact(false) .target(MoveTarget.ATTACKER), @@ -11622,6 +11621,7 @@ export function initMoves() { .restriction(ConsecutiveUseRestriction), new AttackMove(MoveId.COMEUPPANCE, PokemonType.DARK, MoveCategory.PHYSICAL, -1, 100, 10, -1, 0, 9) .attr(CounterDamageAttr, 1.5) + .attr(CounterRedirectAttr) .condition(counterAttackCondition_Both, 3) .target(MoveTarget.ATTACKER), new AttackMove(MoveId.AQUA_CUTTER, PokemonType.WATER, MoveCategory.PHYSICAL, 70, 100, 20, -1, 0, 9) diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index 787d2819f28..91e0fdb0ee6 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -912,6 +912,7 @@ export class MovePhase extends BattlePhase { */ protected resolveCounterAttackTarget(): void { if (this.targets.length !== 1 || this.targets[0] !== BattlerIndex.ATTACKER) { + console.log("%cSkipping counter attack target resolution", "color: blue"); return; } @@ -920,6 +921,7 @@ export class MovePhase extends BattlePhase { applyMoveAttrs("CounterRedirectAttr", this.pokemon, null, this.move.getMove(), targetHolder); this.targets[0] = targetHolder.value; if (targetHolder.value === BattlerIndex.ATTACKER) { + console.log("%cSkipping counter attack target resolution", "color: red"); this.fail(); } }