Wonder Guard AI Fix (#5317)

* Fix Wonder Guard looping

* Review + Sheer Cold
This commit is contained in:
Pawkkie 2024-09-02 17:43:41 -04:00 committed by GitHub
parent a422db09c6
commit 9bd5601b5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -889,7 +889,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
break;
case ABILITY_WONDER_GUARD:
if (effectiveness < AI_EFFECTIVENESS_x2)
return 0;
RETURN_SCORE_MINUS(20);
break;
case ABILITY_JUSTIFIED:
if (moveType == TYPE_DARK && !IS_MOVE_STATUS(move))
@ -1498,7 +1498,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
break;
case EFFECT_OHKO:
if (B_SHEER_COLD_IMMUNITY >= GEN_7 && move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE))
return 0;
RETURN_SCORE_MINUS(20);
if (!ShouldTryOHKO(battlerAtk, battlerDef, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], move))
ADJUST_SCORE(-10);
else if (GetActiveGimmick(battlerDef) == GIMMICK_DYNAMAX)
@ -2478,7 +2478,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
if (IS_TARGETING_PARTNER(battlerAtk, battlerDef))
{
if (gStatuses3[battlerDef] & STATUS3_HEAL_BLOCK)
return 0;
return 0; // cannot even select
if (AtMaxHp(battlerDef))
ADJUST_SCORE(-10);
else if (gBattleMons[battlerDef].hp > gBattleMons[battlerDef].maxHP / 2)