diff --git a/test/battle/ai.c b/test/battle/ai.c index 28e541befd..819eb2edaa 100644 --- a/test/battle/ai.c +++ b/test/battle/ai.c @@ -955,3 +955,26 @@ AI_DOUBLE_BATTLE_TEST("AI will the see a corresponding absorbing ability on part TURN { EXPECT_MOVE(opponentLeft, MOVE_TACKLE); } } } + +AI_SINGLE_BATTLE_TEST("AI calculates guaranteed criticals and detects critical immunity") +{ + u32 ability; + PARAMETRIZE { ability = ABILITY_SWIFT_SWIM; } + PARAMETRIZE { ability = ABILITY_SHELL_ARMOR; } + + GIVEN { + ASSUME(gMovesInfo[MOVE_STORM_THROW].alwaysCriticalHit); + ASSUME(gMovesInfo[MOVE_STORM_THROW].power == 60); + ASSUME(gMovesInfo[MOVE_BRICK_BREAK].power == 75); + ASSUME(gMovesInfo[MOVE_STORM_THROW].type == gMovesInfo[MOVE_BRICK_BREAK].type); + ASSUME(gMovesInfo[MOVE_STORM_THROW].category == gMovesInfo[MOVE_BRICK_BREAK].category); + AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT | AI_FLAG_OMNISCIENT); + PLAYER(SPECIES_OMASTAR) { Ability(ability); } + OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_STORM_THROW, MOVE_BRICK_BREAK); } + } WHEN { + if (ability == ABILITY_SHELL_ARMOR) + TURN { EXPECT_MOVE(opponent, MOVE_BRICK_BREAK); } + else + TURN { EXPECT_MOVE(opponent, MOVE_STORM_THROW); } + } +}