From 16d032e99d48ee58da7effba05d639f37e88acf8 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 02:01:34 -0300 Subject: [PATCH] Fix Unnerve not canceling out type resist berries. --- src/battle_util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index 20e5d91d1..197bd6a25 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8203,6 +8203,7 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move u32 abilityDef = GetBattlerAbility(battlerDef); u32 defSide = GET_BATTLER_SIDE(battlerDef); u16 finalModifier = UQ_4_12(1.0); + u16 itemDef = gBattleMons[battlerDef].item; // check multiple targets in double battle if (GetMoveTargetCount(move, battlerAtk, battlerDef) >= 2) @@ -8323,7 +8324,8 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move // berries reducing dmg case HOLD_EFFECT_RESIST_BERRY: if (moveType == GetBattlerHoldEffectParam(battlerDef) - && (moveType == TYPE_NORMAL || typeEffectivenessModifier >= UQ_4_12(2.0))) + && (moveType == TYPE_NORMAL || typeEffectivenessModifier >= UQ_4_12(2.0)) + && !UnnerveOn(battlerDef, itemDef)) { if (abilityDef == ABILITY_RIPEN) MulModifier(&finalModifier, UQ_4_12(0.25));