Prevent Coaching score inflation in certain circumstances. (#9154)
Some checks failed
CI / build (push) Has been cancelled
CI / docs_validate (push) Has been cancelled
CI / allcontributors (push) Has been cancelled

This commit is contained in:
surskitty 2026-02-07 18:13:38 -05:00 committed by GitHub
parent 1c5ea66878
commit 318baaa5aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3318,10 +3318,35 @@ static s32 AI_DoubleBattle(enum BattlerId battlerAtk, enum BattlerId battlerDef,
}
else
{
ADJUST_SCORE(IncreaseStatUpScore(battlerAtkPartner, BATTLE_OPPOSITE(battlerAtk), STAT_CHANGE_ATK));
ADJUST_SCORE(IncreaseStatUpScore(battlerAtkPartner, BATTLE_OPPOSITE(battlerAtk), STAT_CHANGE_DEF));
ADJUST_SCORE(IncreaseStatUpScore(battlerAtkPartner, BATTLE_OPPOSITE(battlerAtkPartner), STAT_CHANGE_ATK));
ADJUST_SCORE(IncreaseStatUpScore(battlerAtkPartner, BATTLE_OPPOSITE(battlerAtkPartner), STAT_CHANGE_DEF));
s32 statUpScore = 0;
s32 tempScore = 0;
enum BattlerId foe = LEFT_FOE(battlerAtk);
if (IsBattlerAlive(foe))
{
tempScore += IncreaseStatUpScore(battlerAtkPartner, foe, STAT_CHANGE_ATK);
tempScore += IncreaseStatUpScore(battlerAtkPartner, foe, STAT_CHANGE_DEF);
if (tempScore == 0)
break;
statUpScore += tempScore;
}
tempScore = 0;
foe = RIGHT_FOE(battlerAtk);
if (IsBattlerAlive(foe))
{
tempScore += IncreaseStatUpScore(battlerAtkPartner, foe, STAT_CHANGE_ATK);
tempScore += IncreaseStatUpScore(battlerAtkPartner, foe, STAT_CHANGE_DEF);
if (tempScore == 0)
break;
statUpScore += tempScore;
}
if (statUpScore > BEST_EFFECT)
ADJUST_SCORE(BEST_EFFECT);
else
ADJUST_SCORE(statUpScore);
}
break;
default: