From ff48be1f76b5836edf9ddd8a658ccdce758db1e5 Mon Sep 17 00:00:00 2001 From: SarnPoke <77281351+SarnPoke@users.noreply.github.com> Date: Fri, 23 Aug 2024 20:50:03 +0200 Subject: [PATCH 1/4] 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. --- src/battle_ai_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 63bab46ec92d..3681b57d102f 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -2868,6 +2868,13 @@ 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)) + { + RETURN_SCORE_PLUS(GOOD_EFFECT); + } + break; case ABILITY_VOLT_ABSORB: if (!(AI_THINKING_STRUCT->aiFlags[battlerAtk] & AI_FLAG_HP_AWARE)) { From a4b86ccc5c9f407e08381082ff7e4b9b0bd267c1 Mon Sep 17 00:00:00 2001 From: SarnPoke <77281351+SarnPoke@users.noreply.github.com> Date: Fri, 23 Aug 2024 21:07:36 +0200 Subject: [PATCH 2/4] Add OHKO check Makes sure that the crit move does not OHKO the partner with Anger Point. --- src/battle_ai_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 3681b57d102f..aba0264c7d49 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -2870,7 +2870,8 @@ static s32 AI_DoubleBattle(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { case ABILITY_ANGER_POINT: if (gMovesInfo[move].alwaysCriticalHit == TRUE - && BattlerStatCanRise(battlerAtkPartner, atkPartnerAbility, STAT_ATK)) + && BattlerStatCanRise(battlerAtkPartner, atkPartnerAbility, STAT_ATK + && !CanIndexMoveFaintTarget(battlerAtk, battlerAtkPartner, AI_THINKING_STRUCT->movesetIndex, 1))) { RETURN_SCORE_PLUS(GOOD_EFFECT); } From d534efc0dab67732aa9bd1d9989cdd1ba875071a Mon Sep 17 00:00:00 2001 From: SarnPoke <77281351+SarnPoke@users.noreply.github.com> Date: Fri, 23 Aug 2024 22:42:12 +0200 Subject: [PATCH 3/4] Fix mistake Fixes small mistake --- src/battle_ai_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index aba0264c7d49..088da991bbe8 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -2870,8 +2870,8 @@ static s32 AI_DoubleBattle(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) { case ABILITY_ANGER_POINT: if (gMovesInfo[move].alwaysCriticalHit == TRUE - && BattlerStatCanRise(battlerAtkPartner, atkPartnerAbility, STAT_ATK - && !CanIndexMoveFaintTarget(battlerAtk, battlerAtkPartner, AI_THINKING_STRUCT->movesetIndex, 1))) + && BattlerStatCanRise(battlerAtkPartner, atkPartnerAbility, STAT_ATK) + && !CanIndexMoveFaintTarget(battlerAtk, battlerAtkPartner, AI_THINKING_STRUCT->movesetIndex, 1)) { RETURN_SCORE_PLUS(GOOD_EFFECT); } From df7ebcb41f46bc9b7d2752d45b08868ed3855322 Mon Sep 17 00:00:00 2001 From: SarnPoke <77281351+SarnPoke@users.noreply.github.com> Date: Fri, 23 Aug 2024 23:15:45 +0200 Subject: [PATCH 4/4] Add Speed Check Checks if mon is faster than its Anger Point partner when scoring. --- src/battle_ai_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 088da991bbe8..67e9b90a2433 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -2871,6 +2871,7 @@ static s32 AI_DoubleBattle(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) 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);