Fix Unnerve not canceling out type resist berries.

This commit is contained in:
Eduardo Quezada D'Ottone 2021-10-02 02:01:34 -03:00
parent b322a42fea
commit 16d032e99d

View File

@ -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));