diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index ea8a4bb91fb3..25700f670eb2 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -2952,7 +2952,7 @@ static s32 AI_DoubleBattle(u32 battlerAtk, u32 battlerDef, u32 move, s32 score) case EFFECT_ENTRAINMENT: if (partnerHasBadAbility && IsAbilityOfRating(aiData->abilities[battlerAtk], 0)) { - RETURN_SCORE_PLUS(WEAK_EFFECT); + RETURN_SCORE_PLUS(DECENT_EFFECT); } break; case EFFECT_SOAK: @@ -4061,9 +4061,13 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move) case EFFECT_ENTRAINMENT: if (GetActiveGimmick(battlerDef) == GIMMICK_DYNAMAX) break; - else if ((IsAbilityOfRating(aiData->abilities[battlerDef], 5) || gAbilitiesInfo[aiData->abilities[battlerAtk]].aiRating <= 0) - && (aiData->abilities[battlerDef] != aiData->abilities[battlerAtk] && !(gStatuses3[battlerDef] & STATUS3_GASTRO_ACID))) - ADJUST_SCORE(DECENT_EFFECT); + if (aiData->abilities[battlerDef] != aiData->abilities[battlerAtk] && !(gStatuses3[battlerDef] & STATUS3_GASTRO_ACID)) + { + if (gAbilitiesInfo[aiData->abilities[battlerAtk]].aiRating <= 0) + ADJUST_SCORE(DECENT_EFFECT); + else if (IsAbilityOfRating(aiData->abilities[battlerDef], 5) && gAbilitiesInfo[aiData->abilities[battlerAtk]].aiRating <= 3) + ADJUST_SCORE(WEAK_EFFECT); + } break; case EFFECT_IMPRISON: if (predictedMove != MOVE_NONE && HasMove(battlerAtk, predictedMove)) diff --git a/test/battle/move_effect/entrainment.c b/test/battle/move_effect/entrainment.c index b43f6dcbc159..cccae8675980 100644 --- a/test/battle/move_effect/entrainment.c +++ b/test/battle/move_effect/entrainment.c @@ -1,6 +1,19 @@ #include "global.h" #include "test/battle.h" +AI_DOUBLE_BATTLE_TEST("AI prefers Entrainment'ing good abilities onto partner with bad ability") +{ + GIVEN { + AI_FLAGS(AI_FLAG_SMART_TRAINER); + PLAYER(SPECIES_QUAXWELL) { Level(18); Ability(ABILITY_TORRENT); Moves(MOVE_WATER_GUN); }; + PLAYER(SPECIES_CORPHISH) { Level(18); Moves(MOVE_WATER_GUN); }; + OPPONENT(SPECIES_SMEARGLE) { Level(17); Ability(ABILITY_TECHNICIAN); Moves(MOVE_AERIAL_ACE, MOVE_ENTRAINMENT, MOVE_FLAME_WHEEL, MOVE_MAGICAL_LEAF); } + OPPONENT(SPECIES_ARCHEN) { Level(17); Ability(ABILITY_DEFEATIST); Moves(MOVE_DUAL_WINGBEAT, MOVE_ROCK_TOMB); } + } WHEN { + TURN { EXPECT_MOVE(opponentLeft, MOVE_ENTRAINMENT); EXPECT_MOVE(opponentRight, MOVE_DUAL_WINGBEAT); MOVE(playerLeft, MOVE_WATER_GUN); MOVE(playerRight, MOVE_WATER_GUN); } + } +} + TO_DO_BATTLE_TEST("Entrainment changes the target's Ability to match the user's"); TO_DO_BATTLE_TEST("Entrainment fails if the user's ability has cantBeCopied flag"); TO_DO_BATTLE_TEST("Entrainment fails if the targets's ability has cantBeOverwritten flag");