Merge pull request #2169 from Sneed69/inverse-flying

Make ungrounded flying mons weak to ground in inverse battles
This commit is contained in:
ghoulslash 2022-07-01 11:57:43 -04:00 committed by GitHub
commit 1ddf3ca7e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7771,33 +7771,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)
@ -9173,7 +9175,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)