sovereignx/test/battle/move_effect_secondary/flinch.c
Eduardo Quezada 5ec08ee98c
Small Battle Test reorganization (#4504)
* Fixed test folders + Chud Chew test name fixes

* Adjusted file names + merged Burn Up and Double Shock files

* Added Spit Up/Swallow files that point to Stockpile's file

* Multiple changes (see description)

- Moved secondary effect files to their own folder.
- Split hit_set_entry_hazards.c to separate files for Spikes/Stealth Rock.
- Grouped Hex/Venoshock to the same file
2024-05-06 09:36:52 +02:00

71 lines
2.2 KiB
C

#include "global.h"
#include "test/battle.h"
ASSUMPTIONS
{
ASSUME(MoveHasAdditionalEffect(MOVE_HEADBUTT, MOVE_EFFECT_FLINCH) == TRUE);
}
SINGLE_BATTLE_TEST("Headbutt flinches the target if attacker is faster")
{
bool8 isFaster;
u16 spdPlayer, spdOpponent;
PARAMETRIZE { isFaster = TRUE; spdPlayer = 10; spdOpponent = 5; }
PARAMETRIZE { isFaster = FALSE; spdPlayer = 5; spdOpponent = 10; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Speed(spdPlayer); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(spdOpponent); }
} WHEN {
TURN { MOVE(player, MOVE_HEADBUTT); }
TURN { MOVE(player, MOVE_HEADBUTT); }
} SCENE {
// 1st turn
ANIMATION(ANIM_TYPE_MOVE, MOVE_HEADBUTT, player);
HP_BAR(opponent);
if (isFaster) {
MESSAGE("Foe Wobbuffet flinched!");
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
} else {
NOT MESSAGE("Foe Wobbuffet flinched!");
}
// 2nd turn
ANIMATION(ANIM_TYPE_MOVE, MOVE_HEADBUTT, player);
HP_BAR(opponent);
if (isFaster) {
MESSAGE("Foe Wobbuffet flinched!");
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
} else {
NOT MESSAGE("Foe Wobbuffet flinched!");
}
}
}
SINGLE_BATTLE_TEST("Protect always works when used after flinching")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Speed(5); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(100); }
} WHEN {
TURN { MOVE(player, MOVE_PROTECT); MOVE(opponent, MOVE_HEADBUTT); }
TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_HEADBUTT); }
TURN { MOVE(player, MOVE_PROTECT); MOVE(opponent, MOVE_HEADBUTT); }
} SCENE {
// 1st turn
ANIMATION(ANIM_TYPE_MOVE, MOVE_PROTECT, player);
MESSAGE("Wobbuffet protected itself!");
// 2nd turn
ANIMATION(ANIM_TYPE_MOVE, MOVE_HEADBUTT, opponent);
HP_BAR(player);
MESSAGE("Wobbuffet flinched!");
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player);
// 3rd turn
ANIMATION(ANIM_TYPE_MOVE, MOVE_PROTECT, player);
MESSAGE("Wobbuffet protected itself!");
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_HEADBUTT, opponent);
}
}