From 5de0f3cb4adb2930dff5b887f45e43e659f5732e Mon Sep 17 00:00:00 2001 From: SarnPoke <77281351+SarnPoke@users.noreply.github.com> Date: Sun, 25 Aug 2024 23:38:40 +0200 Subject: [PATCH] Add Anger Point/Crit Moves Doubles AI Interaction (#5244) * Add Anger Point/Crit Moves AI Interaction Encourages the AI to use an "always crit" move on its partner, if that partner has the Anger Point ability. * Add OHKO check Makes sure that the crit move does not OHKO the partner with Anger Point. * Fix mistake Fixes small mistake * Add Speed Check Checks if mon is faster than its Anger Point partner when scoring. --- src/battle_ai_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 63bab46ec9..67e9b90a24 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -2868,6 +2868,15 @@ static s32 AI_DoubleBattle(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { switch (atkPartnerAbility) { + case ABILITY_ANGER_POINT: + if (gMovesInfo[move].alwaysCriticalHit == TRUE + && BattlerStatCanRise(battlerAtkPartner, atkPartnerAbility, STAT_ATK) + && AI_IsFaster(battlerAtk, battlerAtkPartner, move) + && !CanIndexMoveFaintTarget(battlerAtk, battlerAtkPartner, AI_THINKING_STRUCT->movesetIndex, 1)) + { + RETURN_SCORE_PLUS(GOOD_EFFECT); + } + break; case ABILITY_VOLT_ABSORB: if (!(AI_THINKING_STRUCT->aiFlags[battlerAtk] & AI_FLAG_HP_AWARE)) {