Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Defiant tests #4331

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions test/battle/ability/defiant.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,104 @@ DOUBLE_BATTLE_TEST("Defiant is activated by Cotton Down for non-ally pokemon")
EXPECT_EQ(playerRight->statStages[STAT_ATK], DEFAULT_STAT_STAGE + 2);
}
}

SINGLE_BATTLE_TEST("Defiant activates before White Herb")
{
u32 move;

PARAMETRIZE { move = MOVE_LEER; }
PARAMETRIZE { move = MOVE_GROWL; }

GIVEN {
PLAYER(SPECIES_MANKEY) { Ability(ABILITY_DEFIANT); Item(ITEM_WHITE_HERB); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, move); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, move, opponent);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);

ABILITY_POPUP(player, ABILITY_DEFIANT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Mankey's Attack sharply rose!");

if (move == MOVE_LEER) {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);
MESSAGE("Mankey's White Herb restored its status!");
} else {
NONE_OF {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);
MESSAGE("Mankey's White Herb restored its status!");
}
}
} THEN {
if (move == MOVE_LEER) {
EXPECT_EQ(player->statStages[STAT_DEF], DEFAULT_STAT_STAGE);
EXPECT_EQ(player->statStages[STAT_ATK], DEFAULT_STAT_STAGE + 2);
} else {
EXPECT_EQ(player->statStages[STAT_ATK], DEFAULT_STAT_STAGE + 1);
}
}
}

SINGLE_BATTLE_TEST("Defiant activates for each stat that is lowered")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_TICKLE].effect == EFFECT_TICKLE);
PLAYER(SPECIES_MANKEY) { Ability(ABILITY_DEFIANT); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_TICKLE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TICKLE, opponent);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);

MESSAGE("Mankey's Attack fell!");
ABILITY_POPUP(player, ABILITY_DEFIANT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Mankey's Attack sharply rose!");

MESSAGE("Mankey's Defense fell!");
ABILITY_POPUP(player, ABILITY_DEFIANT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Mankey's Attack sharply rose!");

} THEN {
EXPECT_EQ(player->statStages[STAT_ATK], DEFAULT_STAT_STAGE + 3);
}
}

SINGLE_BATTLE_TEST("Defiant doesn't activate if the pokemon lowers it's own stats")
{
u32 move;

PARAMETRIZE { move = MOVE_SUPERPOWER; }
PARAMETRIZE { move = MOVE_CLOSE_COMBAT; }
PARAMETRIZE { move = MOVE_MAKE_IT_RAIN; }
PARAMETRIZE { move = MOVE_SPIN_OUT; }

GIVEN {
ASSUME(MoveHasAdditionalEffectSelf(MOVE_SUPERPOWER, MOVE_EFFECT_ATK_DEF_DOWN));
ASSUME(MoveHasAdditionalEffectSelf(MOVE_CLOSE_COMBAT, MOVE_EFFECT_DEF_SPDEF_DOWN));
ASSUME(MoveHasAdditionalEffectSelf(MOVE_MAKE_IT_RAIN, MOVE_EFFECT_SP_ATK_MINUS_1));
ASSUME(MoveHasAdditionalEffectSelf(MOVE_SPIN_OUT, MOVE_EFFECT_SPD_MINUS_2));
PLAYER(SPECIES_MANKEY) { Ability(ABILITY_DEFIANT); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, move); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, move, player);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);

NONE_OF {
ABILITY_POPUP(player, ABILITY_DEFIANT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Mankey's Attack sharply rose!");
}
} THEN {
if (move == MOVE_SUPERPOWER)
EXPECT_EQ(player->statStages[STAT_ATK], DEFAULT_STAT_STAGE - 1);
else
EXPECT_EQ(player->statStages[STAT_ATK], DEFAULT_STAT_STAGE);
}
}
Loading