add safeguard checks

This commit is contained in:
Evan 2021-01-16 11:47:29 -07:00
parent 9e29d303ec
commit 4a5a3ea6af

View File

@ -5065,6 +5065,7 @@ bool32 CanSleep(u8 battlerId)
if (ability == ABILITY_INSOMNIA
|| ability == ABILITY_VITAL_SPIRIT
|| ability == ABILITY_COMATOSE
|| gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD
|| gBattleMons[battlerId].status1 & STATUS1_ANY
|| IsAbilityOnSide(battlerId, ABILITY_SWEET_VEIL)
|| IsAbilityStatusProtected(battlerId)
@ -5078,6 +5079,7 @@ bool32 CanBePoisoned(u8 battlerId)
u16 ability = GetBattlerAbility(battlerId);
if (IS_BATTLER_OF_TYPE(battlerId, TYPE_POISON)
|| IS_BATTLER_OF_TYPE(battlerId, TYPE_STEEL)
|| gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD
|| gBattleMons[battlerId].status1 & STATUS1_ANY
|| ability == ABILITY_IMMUNITY
|| ability == ABILITY_COMATOSE
@ -5092,6 +5094,7 @@ bool32 CanBeBurned(u8 battlerId)
{
u16 ability = GetBattlerAbility(battlerId);
if (IS_BATTLER_OF_TYPE(battlerId, TYPE_FIRE)
|| gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD
|| gBattleMons[battlerId].status1 & STATUS1_ANY
|| ability == ABILITY_WATER_VEIL
|| ability == ABILITY_COMATOSE
@ -5105,6 +5108,7 @@ bool32 CanBeParalyzed(u8 battlerId)
{
u16 ability = GetBattlerAbility(battlerId);
if ((B_PARALYZE_ELECTRIC >= GEN_6 && IS_BATTLER_OF_TYPE(battlerId, TYPE_ELECTRIC))
|| gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD
|| ability == ABILITY_LIMBER
|| ability == ABILITY_COMATOSE
|| gBattleMons[battlerId].status1 & STATUS1_ANY
@ -5119,6 +5123,7 @@ bool32 CanBeFrozen(u8 battlerId)
u16 ability = GetBattlerAbility(battlerId);
if (IS_BATTLER_OF_TYPE(battlerId, TYPE_ICE)
|| (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SUN_ANY)
|| gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD
|| ability == ABILITY_MAGMA_ARMOR
|| ability == ABILITY_COMATOSE
|| gBattleMons[battlerId].status1 & STATUS1_ANY