Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sneed69 committed Jun 9, 2024
1 parent 1ca4676 commit aa50bfe
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/battle/ai.c
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
}
}

0 comments on commit aa50bfe

Please sign in to comment.