From bb540b62368f3eec54c9bf4bcc3cafc2c10769ac Mon Sep 17 00:00:00 2001 From: Evan Date: Sun, 10 Jan 2021 08:58:41 -0700 Subject: [PATCH] fix AI_WeatherHasEffect to handle unknown abilities --- src/battle_ai_util.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 5e7cbadf7..b43599f7b 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -1128,10 +1128,18 @@ bool32 DoesBattlerIgnoreAbilityChecks(u16 atkAbility, u16 move) bool32 AI_WeatherHasEffect(void) { + u32 i; if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_NEGATE_UNAWARE) - return FALSE; // AI doesn't understand ability suppression concept + return FALSE; // AI doesn't understand weather supression (handicap) - return WEATHER_HAS_EFFECT; + // need to manually check since we don't necessarily know opponent ability + for (i = 0; i < gBattlersCount; i++) + { + if (IsBattlerAlive(i) + && (AI_GetAbility(i) == ABILITY_AIR_LOCK || AI_GetAbility(i) == ABILITY_CLOUD_NINE) + return TRUE; + } + return FALSE; } bool32 IsAromaVeilProtectedMove(u16 move)