From b8ea412e61e23e67aeeda206e0e6509f4748ad0d Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Wed, 20 Jul 2022 14:44:57 -0400 Subject: [PATCH] AI logic for Charge --- src/battle_ai_main.c | 5 ++++- src/battle_ai_util.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index f924728d2..794065bec 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -985,8 +985,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 20; else if (!HasMoveWithType(battlerAtk, TYPE_ELECTRIC)) score -= 10; + #if B_CHARGE_SPDEF_RAISE >= GEN_5 else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPDEF)) score -= 5; + #endif break; case EFFECT_QUIVER_DANCE: case EFFECT_GEOMANCY: @@ -4051,8 +4053,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_CHARGE: if (HasDamagingMoveOfType(battlerAtk, TYPE_ELECTRIC)) score += 2; - + #if B_CHARGE_SPDEF_RAISE >= GEN_5 IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPDEF, &score); + #endif break; case EFFECT_TAUNT: if (IS_MOVE_STATUS(predictedMove)) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index b8c42ed0c..de22866ad 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -2063,7 +2063,9 @@ bool32 IsStatRaisingEffect(u16 effect) case EFFECT_EVASION_UP_2: case EFFECT_MINIMIZE: case EFFECT_DEFENSE_CURL: + #if B_CHARGE_SPDEF_RAISE >= GEN_5 case EFFECT_CHARGE: + #endif case EFFECT_CALM_MIND: case EFFECT_COSMIC_POWER: case EFFECT_DRAGON_DANCE: