sovereignx/test/battle/status1/sleep.c
Alex 594633aa15
Remove Duplicate ai code from battle_ai_util.c (#4883)
* Remove Duplicate ai code from battle_ai_util.c

* Add GetBattlerAbility in toxic self check
2024-07-03 10:48:31 +02:00

41 lines
1.4 KiB
C

#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Sleep prevents the battler from using a move")
{
u32 turns, j;
PARAMETRIZE { turns = 1; }
PARAMETRIZE { turns = 2; }
PARAMETRIZE { turns = 3; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_SLEEP_TURN(turns)); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
for (j = 0; j < turns; j++)
TURN { MOVE(player, MOVE_CELEBRATE); }
} SCENE {
for (j = 0; j < turns - 1; j++)
MESSAGE("Wobbuffet is fast asleep.");
MESSAGE("Wobbuffet woke up!");
STATUS_ICON(player, none: TRUE);
MESSAGE("Wobbuffet used Celebrate!");
}
}
AI_SINGLE_BATTLE_TEST("AI avoids hypnosis when it can not put target to sleep")
{
u32 species, ability;
PARAMETRIZE { species = SPECIES_HOOTHOOT; ability = ABILITY_INSOMNIA; }
PARAMETRIZE { species = SPECIES_MANKEY; ability = ABILITY_VITAL_SPIRIT; }
PARAMETRIZE { species = SPECIES_KOMALA; ability = ABILITY_COMATOSE; }
PARAMETRIZE { species = SPECIES_NACLI; ability = ABILITY_PURIFYING_SALT; }
GIVEN {
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT | AI_FLAG_OMNISCIENT);
PLAYER(species) { Ability(ability); }
OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_CELEBRATE, MOVE_HYPNOSIS); }
} WHEN {
TURN { SCORE_EQ(opponent, MOVE_CELEBRATE, MOVE_HYPNOSIS); } // Both get -10
}
}