ground x2 vs flying if inverse battle

This commit is contained in:
sneed 2022-06-10 22:31:53 +03:00
parent 15fe85902f
commit 407047ace7

View File

@ -7770,33 +7770,35 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move)
return FALSE;
}
bool32 IsBattlerGrounded(u8 battlerId)
// Only called directly when calculating damage type effectiveness
static bool32 IsBattlerGrounded2(u8 battlerId, bool32 considerInverse)
{
if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_IRON_BALL)
return TRUE;
else if (gFieldStatuses & STATUS_FIELD_GRAVITY)
if (gFieldStatuses & STATUS_FIELD_GRAVITY)
return TRUE;
#if B_ROOTED_GROUNDING >= GEN_4
else if (gStatuses3[battlerId] & STATUS3_ROOTED)
if (gStatuses3[battlerId] & STATUS3_ROOTED)
return TRUE;
#endif
else if (gStatuses3[battlerId] & STATUS3_SMACKED_DOWN)
if (gStatuses3[battlerId] & STATUS3_SMACKED_DOWN)
return TRUE;
if (gStatuses3[battlerId] & STATUS3_TELEKINESIS)
return FALSE;
if (gStatuses3[battlerId] & STATUS3_MAGNET_RISE)
return FALSE;
if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_AIR_BALLOON)
return FALSE;
if (GetBattlerAbility(battlerId) == ABILITY_LEVITATE)
return FALSE;
if (IS_BATTLER_OF_TYPE(battlerId, TYPE_FLYING) && (!considerInverse || !FlagGet(B_FLAG_INVERSE_BATTLE)))
return FALSE;
return TRUE;
}
else if (gStatuses3[battlerId] & STATUS3_TELEKINESIS)
return FALSE;
else if (gStatuses3[battlerId] & STATUS3_MAGNET_RISE)
return FALSE;
else if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_AIR_BALLOON)
return FALSE;
else if (GetBattlerAbility(battlerId) == ABILITY_LEVITATE)
return FALSE;
else if (IS_BATTLER_OF_TYPE(battlerId, TYPE_FLYING))
return FALSE;
else
return TRUE;
bool32 IsBattlerGrounded(u8 battlerId)
{
IsBattlerGrounded2(battlerId, FALSE);
}
bool32 IsBattlerAlive(u8 battlerId)
@ -9172,7 +9174,7 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat
&& gBattleMons[battlerDef].type3 != gBattleMons[battlerDef].type1)
MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type3, battlerAtk, recordAbilities);
if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef) && !(gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING))
if (moveType == TYPE_GROUND && !IsBattlerGrounded2(battlerDef, TRUE) && !(gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING))
{
modifier = UQ_4_12(0.0);
if (recordAbilities && defAbility == ABILITY_LEVITATE)