sovereignx/test/battle/ability/berserk.c
Bassoonian 5cc0b35d81
Replace power checks with IS_MOVE_STATUS (#5820)
Co-authored-by: Eduardo Quezada <eduardo602002@gmail.com>
2024-12-20 08:20:46 -03:00

75 lines
2.5 KiB
C

#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Berserk activates only if the target had more than 50% of its hp")
{
bool32 activates = FALSE;
u16 maxHp = 500, hp = 0;
PARAMETRIZE { hp = 250; activates = FALSE; }
PARAMETRIZE { hp = 249; activates = FALSE; }
PARAMETRIZE { hp = 100; activates = FALSE; }
PARAMETRIZE { hp = 50; activates = FALSE; }
PARAMETRIZE { hp = 251; activates = TRUE; }
PARAMETRIZE { hp = 254; activates = TRUE; }
GIVEN {
ASSUME(!IS_MOVE_STATUS(MOVE_TACKLE));
PLAYER(SPECIES_DRAMPA) { Ability(ABILITY_BERSERK); MaxHP(maxHp); HP(hp); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_TACKLE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
if (activates) {
ABILITY_POPUP(player, ABILITY_BERSERK);
} else {
NOT ABILITY_POPUP(player, ABILITY_BERSERK);
}
} THEN {
if (activates) {
EXPECT_EQ(player->statStages[STAT_SPATK], DEFAULT_STAT_STAGE + 1);
}
}
}
SINGLE_BATTLE_TEST("Berserk raises Sp.Atk by 1")
{
u16 maxHp = 500;
GIVEN {
ASSUME(!IS_MOVE_STATUS(MOVE_TACKLE));
PLAYER(SPECIES_DRAMPA) { Ability(ABILITY_BERSERK); MaxHP(maxHp); HP(maxHp / 2 + 1); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_TACKLE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
ABILITY_POPUP(player, ABILITY_BERSERK);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Drampa's Sp. Atk rose!");
} THEN {
EXPECT_EQ(player->statStages[STAT_SPATK], DEFAULT_STAT_STAGE + 1);
}
}
SINGLE_BATTLE_TEST("Berserk activates after all hits from a multi-hit move")
{
u32 j;
u16 maxHp = 500;
GIVEN {
ASSUME(gMovesInfo[MOVE_DOUBLE_SLAP].effect == EFFECT_MULTI_HIT);
PLAYER(SPECIES_DRAMPA) { Ability(ABILITY_BERSERK); MaxHP(maxHp); HP(maxHp / 2 + 1); }
OPPONENT(SPECIES_SHELLDER) { Ability(ABILITY_SKILL_LINK); } // Always hits 5 times.
} WHEN {
TURN { MOVE(opponent, MOVE_DOUBLE_SLAP); }
} SCENE {
for (j = 0; j < 4; j++) {
ANIMATION(ANIM_TYPE_MOVE, MOVE_DOUBLE_SLAP, opponent);
NOT ABILITY_POPUP(player, ABILITY_BERSERK);
}
ANIMATION(ANIM_TYPE_MOVE, MOVE_DOUBLE_SLAP, opponent);
ABILITY_POPUP(player, ABILITY_BERSERK);
} THEN {
EXPECT_EQ(player->statStages[STAT_SPATK], DEFAULT_STAT_STAGE + 1);
}
}