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.
This commit is contained in:
SarnPoke 2024-08-25 23:38:40 +02:00 committed by GitHub
parent afd18f06b4
commit 5de0f3cb4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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))
{