From 4a5a3ea6af004cc3431073eccd1bcc9a10241a86 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 16 Jan 2021 11:47:29 -0700 Subject: [PATCH] add safeguard checks --- src/battle_util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/battle_util.c b/src/battle_util.c index 085d63ff9..ebaaf386d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -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