Fix using defender instead of attacker when applying magic guard

This commit is contained in:
Dean 2025-03-18 12:41:33 -07:00
parent bcdeb8a36a
commit e7e7ec97bc

View File

@ -794,7 +794,7 @@ export class ReverseDrainAbAttr extends PostDefendAbAttr {
override applyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult | null, args: any[]): void { override applyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult | null, args: any[]): void {
const cancelled = new Utils.BooleanHolder(false); const cancelled = new Utils.BooleanHolder(false);
applyAbAttrs(BlockNonDirectDamageAbAttr, pokemon, cancelled); applyAbAttrs(BlockNonDirectDamageAbAttr, attacker, cancelled);
if (!cancelled.value) { if (!cancelled.value) {
const damageAmount = move.getAttrs<HitHealAttr>(HitHealAttr)[0].getHealAmount(attacker, pokemon); const damageAmount = move.getAttrs<HitHealAttr>(HitHealAttr)[0].getHealAmount(attacker, pokemon);
pokemon.turnData.damageTaken += damageAmount; pokemon.turnData.damageTaken += damageAmount;