Prevent AI Recursion (#7279)
Co-authored-by: ghoulslash <pokevoyager0@gmail.com>
This commit is contained in:
parent
476e32cad9
commit
31fc32ada8
@ -2047,7 +2047,11 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||
break;
|
||||
case EFFECT_COPYCAT:
|
||||
case EFFECT_MIRROR_MOVE:
|
||||
return AI_CheckBadMove(battlerAtk, battlerDef, predictedMove, score);
|
||||
if (predictedMove && GetMoveEffect(predictedMove) != GetMoveEffect(move))
|
||||
return AI_CheckBadMove(battlerAtk, battlerDef, predictedMove, score);
|
||||
else
|
||||
ADJUST_SCORE(-10);
|
||||
break;
|
||||
case EFFECT_FLOWER_SHIELD:
|
||||
if (!IS_BATTLER_OF_TYPE(battlerAtk, TYPE_GRASS)
|
||||
&& !(isDoubleBattle && IS_BATTLER_OF_TYPE(BATTLE_PARTNER(battlerAtk), TYPE_GRASS)))
|
||||
@ -2312,7 +2316,10 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||
ADJUST_SCORE(-10);
|
||||
break;
|
||||
case EFFECT_NATURE_POWER:
|
||||
return AI_CheckBadMove(battlerAtk, battlerDef, GetNaturePowerMove(battlerAtk), score);
|
||||
predictedMove = GetNaturePowerMove(battlerAtk);
|
||||
if (GetMoveEffect(predictedMove) != GetMoveEffect(move))
|
||||
return AI_CheckBadMove(battlerAtk, battlerDef, GetNaturePowerMove(battlerAtk), score);
|
||||
break;
|
||||
case EFFECT_TAUNT:
|
||||
if (gDisableStructs[battlerDef].tauntTimer > 0
|
||||
|| DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove))
|
||||
@ -2492,7 +2499,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||
{
|
||||
if (AI_IsSlower(battlerAtk, battlerDef, move))
|
||||
ADJUST_SCORE(-10); // Target is predicted to go first, Me First will fail
|
||||
else
|
||||
else if (GetMoveEffect(predictedMove) != GetMoveEffect(move))
|
||||
return AI_CheckBadMove(battlerAtk, battlerDef, predictedMove, score);
|
||||
}
|
||||
else
|
||||
@ -3852,7 +3859,7 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case EFFECT_MIRROR_MOVE:
|
||||
if (predictedMove != MOVE_NONE)
|
||||
if (predictedMove && GetMoveEffect(predictedMove) != GetMoveEffect(move))
|
||||
return AI_CheckViability(battlerAtk, battlerDef, predictedMove, score);
|
||||
break;
|
||||
case EFFECT_ATTACK_UP:
|
||||
@ -4116,7 +4123,8 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
||||
case EFFECT_MIMIC:
|
||||
if (AI_IsFaster(battlerAtk, battlerDef, move))
|
||||
{
|
||||
if (gLastMoves[battlerDef] != MOVE_NONE && gLastMoves[battlerDef] != 0xFFFF)
|
||||
if (gLastMoves[battlerDef] != MOVE_NONE && gLastMoves[battlerDef] != 0xFFFF
|
||||
&& (GetMoveEffect(gLastMoves[battlerDef]) != GetMoveEffect(move)))
|
||||
return AI_CheckViability(battlerAtk, battlerDef, gLastMoves[battlerDef], score);
|
||||
}
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user