Small Code clean up in GetBattlerAbility (removes duplication) (#6362)
This commit is contained in:
parent
7a3acdf7fe
commit
8041f6978b
@ -6664,8 +6664,11 @@ bool32 IsMoldBreakerTypeAbility(u32 battler, u32 ability)
|
||||
|| (ability == ABILITY_MYCELIUM_MIGHT && IsBattleMoveStatus(gCurrentMove)));
|
||||
}
|
||||
|
||||
static inline bool32 CanBreakThroughAbility(u32 battlerAtk, u32 battlerDef, u32 ability)
|
||||
static inline bool32 CanBreakThroughAbility(u32 battlerAtk, u32 battlerDef, u32 ability, u32 hasAbilityShield)
|
||||
{
|
||||
if (hasAbilityShield || gBattleStruct->bypassMoldBreakerChecks)
|
||||
return FALSE;
|
||||
|
||||
return ((IsMoldBreakerTypeAbility(battlerAtk, ability) || MoveIgnoresTargetAbility(gCurrentMove))
|
||||
&& battlerDef != battlerAtk
|
||||
&& gAbilitiesInfo[gBattleMons[battlerDef].ability].breakable
|
||||
@ -6676,7 +6679,7 @@ static inline bool32 CanBreakThroughAbility(u32 battlerAtk, u32 battlerDef, u32
|
||||
|
||||
u32 GetBattlerAbility(u32 battler)
|
||||
{
|
||||
bool32 noAbilityShield = GetBattlerHoldEffectIgnoreAbility(battler, TRUE) != HOLD_EFFECT_ABILITY_SHIELD;
|
||||
bool32 hasAbilityShield = GetBattlerHoldEffectIgnoreAbility(battler, TRUE) == HOLD_EFFECT_ABILITY_SHIELD;
|
||||
bool32 abilityCantBeSuppressed = gAbilitiesInfo[gBattleMons[battler].ability].cantBeSuppressed;
|
||||
|
||||
if (abilityCantBeSuppressed)
|
||||
@ -6687,9 +6690,7 @@ u32 GetBattlerAbility(u32 battler)
|
||||
&& gBattleMons[battler].ability == ABILITY_COMATOSE)
|
||||
return ABILITY_NONE;
|
||||
|
||||
if (!gBattleStruct->bypassMoldBreakerChecks
|
||||
&& noAbilityShield
|
||||
&& CanBreakThroughAbility(gBattlerAttacker, battler, gBattleMons[gBattlerAttacker].ability))
|
||||
if (CanBreakThroughAbility(gBattlerAttacker, battler, gBattleMons[gBattlerAttacker].ability, hasAbilityShield))
|
||||
return ABILITY_NONE;
|
||||
|
||||
return gBattleMons[battler].ability;
|
||||
@ -6698,14 +6699,12 @@ u32 GetBattlerAbility(u32 battler)
|
||||
if (gStatuses3[battler] & STATUS3_GASTRO_ACID)
|
||||
return ABILITY_NONE;
|
||||
|
||||
if (IsNeutralizingGasOnField()
|
||||
&& gBattleMons[battler].ability != ABILITY_NEUTRALIZING_GAS
|
||||
&& noAbilityShield)
|
||||
if (!hasAbilityShield
|
||||
&& IsNeutralizingGasOnField()
|
||||
&& gBattleMons[battler].ability != ABILITY_NEUTRALIZING_GAS)
|
||||
return ABILITY_NONE;
|
||||
|
||||
if (!gBattleStruct->bypassMoldBreakerChecks
|
||||
&& noAbilityShield
|
||||
&& CanBreakThroughAbility(gBattlerAttacker, battler, gBattleMons[gBattlerAttacker].ability))
|
||||
if (CanBreakThroughAbility(gBattlerAttacker, battler, gBattleMons[gBattlerAttacker].ability, hasAbilityShield))
|
||||
return ABILITY_NONE;
|
||||
|
||||
return gBattleMons[battler].ability;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user