pokeemerald/test/ability_sturdy.c
Martin Griffin f1b9872bf0 Test moves, items, and abilities in battle
Thank you to SBird for providing mgba-rom-test binaries and Spikes/Toxic
Spikes tests!

Co-authored-by: sbird <sbird@no.tld>
2023-02-01 13:53:57 +00:00

48 lines
1.4 KiB
C

#include "global.h"
#include "test_battle.h"
SINGLE_BATTLE_TEST("Sturdy prevents OHKO moves")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_FISSURE].effect == EFFECT_OHKO);
PLAYER(SPECIES_GEODUDE) { Ability(ABILITY_STURDY); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_FISSURE); }
} SCENE {
MESSAGE("Foe Wobbuffet used Fissure!");
ABILITY_POPUP(player, ABILITY_STURDY);
MESSAGE("Geodude was protected by Sturdy!");
} THEN {
EXPECT_EQ(player->hp, player->maxHP);
}
}
SINGLE_BATTLE_TEST("Sturdy prevents OHKOs")
{
GIVEN {
PLAYER(SPECIES_GEODUDE) { Ability(ABILITY_STURDY); MaxHP(100); HP(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SEISMIC_TOSS); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SEISMIC_TOSS, opponent);
HP_BAR(player, hp: 1);
ABILITY_POPUP(player, ABILITY_STURDY);
MESSAGE("Geodude endured the hit using Sturdy!");
}
}
SINGLE_BATTLE_TEST("Sturdy does not prevent non-OHKOs")
{
GIVEN {
PLAYER(SPECIES_GEODUDE) { Ability(ABILITY_STURDY); MaxHP(100); HP(99); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SEISMIC_TOSS); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SEISMIC_TOSS, opponent);
HP_BAR(player, hp: 0);
}
}