Test cleanup and improvements (#3449)

* Fixed duplicated test names

* Test improvements for Jaboca, Kee and Rowap Berries

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>

* Lansat Berry test improvements

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>

* Jaboca Berry/Bug Bite interaction test

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>

---------

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
Eduardo Quezada D'Ottone 2023-10-22 16:22:59 -03:00 committed by GitHub
parent 7fdc4aacda
commit 77e2b0dd2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 110 additions and 72 deletions

View File

@ -22,7 +22,6 @@ TO_DO_BATTLE_TEST("Prankster-affected moves called via After you affect Dark-typ
TO_DO_BATTLE_TEST("Prankster-affected moves that are bounced back by Magic Bounce/Coat can affect Dark-type Pokémon"); TO_DO_BATTLE_TEST("Prankster-affected moves that are bounced back by Magic Bounce/Coat can affect Dark-type Pokémon");
TO_DO_BATTLE_TEST("Prankster-affected moves that are bounced back by Magic Coat from a Pokémon with Prankster can't affect Dark-type Pokémon"); TO_DO_BATTLE_TEST("Prankster-affected moves that are bounced back by Magic Coat from a Pokémon with Prankster can't affect Dark-type Pokémon");
TO_DO_BATTLE_TEST("Prankster-affected moves that target all Pokémon are successful regardless of the presence of Dark-type Pokémon"); TO_DO_BATTLE_TEST("Prankster-affected moves that target all Pokémon are successful regardless of the presence of Dark-type Pokémon");
TO_DO_BATTLE_TEST("Prankster-affected moves that target all Pokémon are successful regardless of the presence of Dark-type Pokémon");
TO_DO_BATTLE_TEST("Prankster-affected move effects don't affect Dark-type Pokémon"); TO_DO_BATTLE_TEST("Prankster-affected move effects don't affect Dark-type Pokémon");
TO_DO_BATTLE_TEST("Prankster increases the priority of moves by 1"); TO_DO_BATTLE_TEST("Prankster increases the priority of moves by 1");
TO_DO_BATTLE_TEST("Prankster increases the priority of status Z-Moves by 1"); TO_DO_BATTLE_TEST("Prankster increases the priority of status Z-Moves by 1");

View File

@ -21,13 +21,11 @@ SINGLE_BATTLE_TEST("Lansat Berry raises the holder's critical-hit-ratio by two s
TURN { MOVE(opponent, move); } TURN { MOVE(opponent, move); }
} SCENE { } SCENE {
ANIMATION(ANIM_TYPE_MOVE, move, opponent); ANIMATION(ANIM_TYPE_MOVE, move, opponent);
if (move == MOVE_TACKLE) if (move == MOVE_TACKLE) {
{
NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);
NOT MESSAGE("Wobbuffet used Lansat Berry to get pumped!"); NOT MESSAGE("Wobbuffet used Lansat Berry to get pumped!");
} }
else else {
{
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);
MESSAGE("Wobbuffet used Lansat Berry to get pumped!"); MESSAGE("Wobbuffet used Lansat Berry to get pumped!");
} }
@ -48,11 +46,12 @@ SINGLE_BATTLE_TEST("Lansat Berry raises the holder's critical-hit-ratio by two s
} }
} }
SINGLE_BATTLE_TEST("Lansat Berry raises the holder's critical-hit-ratio by two stages when HP drops to 1/4 or below") SINGLE_BATTLE_TEST("Lansat Berry raises the holder's critical-hit-ratio by two stages")
{ {
PASSES_RANDOMLY(1, 2, RNG_CRITICAL_HIT); PASSES_RANDOMLY(1, 2, RNG_CRITICAL_HIT);
GIVEN { GIVEN {
ASSUME(gBattleMoves[MOVE_TACKLE].highCritRatio == FALSE); ASSUME(gBattleMoves[MOVE_TACKLE].highCritRatio == FALSE);
ASSUME(B_CRIT_CHANCE >= GEN_6);
PLAYER(SPECIES_WOBBUFFET) { MaxHP(160); HP(80); Item(ITEM_LANSAT_BERRY); } PLAYER(SPECIES_WOBBUFFET) { MaxHP(160); HP(80); Item(ITEM_LANSAT_BERRY); }
OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET);
} WHEN { } WHEN {

View File

@ -4,41 +4,57 @@
ASSUMPTIONS ASSUMPTIONS
{ {
ASSUME(gItems[ITEM_JABOCA_BERRY].holdEffect == HOLD_EFFECT_JABOCA_BERRY); ASSUME(gItems[ITEM_JABOCA_BERRY].holdEffect == HOLD_EFFECT_JABOCA_BERRY);
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
} }
SINGLE_BATTLE_TEST("Jaboca Berry causes the attacker to lose 1/8 of its max HP if a physical move was used") SINGLE_BATTLE_TEST("Jaboca Berry causes the attacker to lose 1/8 of its max HP if a physical move was used")
{ {
s16 damage; s16 damage;
u16 move;
GIVEN { PARAMETRIZE { move = MOVE_SWIFT; }
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL); PARAMETRIZE { move = MOVE_TACKLE; }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_JABOCA_BERRY); }
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player);
HP_BAR(opponent);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
HP_BAR(player, captureDamage: &damage);
MESSAGE("Wobbuffet was hurt by Foe Wobbuffet's Jaboca Berry!");
} THEN {
EXPECT_EQ(player->maxHP / 8, damage);
}
}
SINGLE_BATTLE_TEST("Jaboca Berry is not triggered by a special move")
{
GIVEN { GIVEN {
ASSUME(gBattleMoves[MOVE_SWIFT].split == SPLIT_SPECIAL); ASSUME(gBattleMoves[MOVE_SWIFT].split == SPLIT_SPECIAL);
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_JABOCA_BERRY); } OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_JABOCA_BERRY); }
} WHEN { } WHEN {
TURN { MOVE(player, MOVE_SWIFT); } TURN { MOVE(player, move); }
} SCENE { } SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SWIFT, player); ANIMATION(ANIM_TYPE_MOVE, move, player);
HP_BAR(opponent); HP_BAR(opponent);
NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent); if (move == MOVE_TACKLE) {
NOT MESSAGE("Wobbuffet was hurt by Foe Wobbuffet's Jaboca Berry!"); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
HP_BAR(player, captureDamage: &damage);
MESSAGE("Wobbuffet was hurt by Foe Wobbuffet's Jaboca Berry!");
} else {
NONE_OF {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
MESSAGE("Wobbuffet was hurt by Foe Wobbuffet's Jaboca Berry!");
}
}
} THEN {
if (move == MOVE_TACKLE)
EXPECT_EQ(player->maxHP / 8, damage);
}
}
SINGLE_BATTLE_TEST("Jaboca Berry tirggers before Bug Bite can steal it")
{
KNOWN_FAILING;
GIVEN {
ASSUME(gBattleMoves[MOVE_BUG_BITE].split == SPLIT_PHYSICAL);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_JABOCA_BERRY); }
} WHEN {
TURN { MOVE(player, MOVE_BUG_BITE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_BUG_BITE, player);
HP_BAR(opponent);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
HP_BAR(player);
MESSAGE("Wyanut was hurt by Foe Wobbuffet's Jaboca Berry!");
NOT MESSAGE("Wynaut stole and ate Foe Wobbuffet's Jaboca Berry!");
} }
} }

View File

@ -4,23 +4,37 @@
ASSUMPTIONS ASSUMPTIONS
{ {
ASSUME(gItems[ITEM_KEE_BERRY].holdEffect == HOLD_EFFECT_KEE_BERRY); ASSUME(gItems[ITEM_KEE_BERRY].holdEffect == HOLD_EFFECT_KEE_BERRY);
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
} }
SINGLE_BATTLE_TEST("Kee Berry raises the holder's Defense by one stage when hit by a physical move") SINGLE_BATTLE_TEST("Kee Berry raises the holder's Defense by one stage when hit by a physical move")
{ {
u16 move;
PARAMETRIZE { move = MOVE_SWIFT; }
PARAMETRIZE { move = MOVE_TACKLE; }
GIVEN { GIVEN {
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL); ASSUME(gBattleMoves[MOVE_SWIFT].split == SPLIT_SPECIAL);
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_KEE_BERRY); } OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_KEE_BERRY); }
} WHEN { } WHEN {
TURN { MOVE(player, MOVE_TACKLE); } TURN { MOVE(player, move); }
} SCENE { } SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player); ANIMATION(ANIM_TYPE_MOVE, move, player);
HP_BAR(opponent); HP_BAR(opponent);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent); if (move == MOVE_TACKLE) {
MESSAGE("Using Kee Berry, the Defense of Foe Wobbuffet rose!"); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
MESSAGE("Using Kee Berry, the Defense of Foe Wobbuffet rose!");
} else {
NONE_OF {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
MESSAGE("Using Kee Berry, the Defense of Foe Wobbuffet rose!");
}
}
} THEN { } THEN {
EXPECT_EQ(opponent->statStages[STAT_DEF], DEFAULT_STAT_STAGE + 1); if (move == MOVE_TACKLE)
EXPECT_EQ(opponent->statStages[STAT_DEF], DEFAULT_STAT_STAGE + 1);
} }
} }
@ -28,7 +42,6 @@ SINGLE_BATTLE_TEST("Kee Berry raises the holder's Defense by two stages with Rip
{ {
GIVEN { GIVEN {
ASSUME(P_GEN_8_POKEMON == TRUE); ASSUME(P_GEN_8_POKEMON == TRUE);
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_APPLIN) { Item(ITEM_KEE_BERRY); Ability(ABILITY_RIPEN); } OPPONENT(SPECIES_APPLIN) { Item(ITEM_KEE_BERRY); Ability(ABILITY_RIPEN); }
} WHEN { } WHEN {

View File

@ -8,19 +8,32 @@ ASSUMPTIONS
SINGLE_BATTLE_TEST("Maranga Berry raises the holder's Sp. Def by one stage when hit by a special move") SINGLE_BATTLE_TEST("Maranga Berry raises the holder's Sp. Def by one stage when hit by a special move")
{ {
u16 move = MOVE_NONE;
PARAMETRIZE { move = MOVE_TACKLE; }
PARAMETRIZE { move = MOVE_SWIFT; }
GIVEN { GIVEN {
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
ASSUME(gBattleMoves[MOVE_SWIFT].split == SPLIT_SPECIAL); ASSUME(gBattleMoves[MOVE_SWIFT].split == SPLIT_SPECIAL);
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_MARANGA_BERRY); } OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_MARANGA_BERRY); }
} WHEN { } WHEN {
TURN { MOVE(player, MOVE_SWIFT); } TURN { MOVE(player, move); }
} SCENE { } SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SWIFT, player); ANIMATION(ANIM_TYPE_MOVE, move, player);
HP_BAR(opponent); HP_BAR(opponent);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent); if (move == MOVE_SWIFT) {
MESSAGE("Using Maranga Berry, the Sp. Def of Foe Wobbuffet rose!"); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
MESSAGE("Using Maranga Berry, the Sp. Def of Foe Wobbuffet rose!");
}
else {
NONE_OF {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
MESSAGE("Using Maranga Berry, the Sp. Def of Foe Wobbuffet rose!");
}
}
} THEN { } THEN {
EXPECT_EQ(opponent->statStages[STAT_SPDEF], DEFAULT_STAT_STAGE + 1); if (move == MOVE_SWIFT)
EXPECT_EQ(opponent->statStages[STAT_SPDEF], DEFAULT_STAT_STAGE + 1);
} }
} }
@ -42,19 +55,3 @@ SINGLE_BATTLE_TEST("Maranga Berry raises the holder's Sp. Def by two stages with
EXPECT_EQ(opponent->statStages[STAT_SPDEF], DEFAULT_STAT_STAGE + 2); EXPECT_EQ(opponent->statStages[STAT_SPDEF], DEFAULT_STAT_STAGE + 2);
} }
} }
SINGLE_BATTLE_TEST("Maranga Berry raises the holder's Sp. Def by one stage when hit by a special move")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_MARANGA_BERRY); }
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player);
HP_BAR(opponent);
NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
NOT MESSAGE("Using Maranga Berry, the Sp. Def of Foe Wobbuffet rose!");
}
}

View File

@ -9,21 +9,34 @@ ASSUMPTIONS
SINGLE_BATTLE_TEST("Rowap Berry causes the attacker to lose 1/8 of its max HP if a special move was used") SINGLE_BATTLE_TEST("Rowap Berry causes the attacker to lose 1/8 of its max HP if a special move was used")
{ {
s16 damage; s16 damage;
u16 move;
PARAMETRIZE { move = MOVE_SWIFT; }
PARAMETRIZE { move = MOVE_TACKLE; }
GIVEN { GIVEN {
ASSUME(gBattleMoves[MOVE_SWIFT].split == SPLIT_SPECIAL); ASSUME(gBattleMoves[MOVE_SWIFT].split == SPLIT_SPECIAL);
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_ROWAP_BERRY); } OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_ROWAP_BERRY); }
} WHEN { } WHEN {
TURN { MOVE(player, MOVE_SWIFT); } TURN { MOVE(player, move); }
} SCENE { } SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SWIFT, player); ANIMATION(ANIM_TYPE_MOVE, move, player);
HP_BAR(opponent); HP_BAR(opponent);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent); if (move == MOVE_SWIFT) {
HP_BAR(player, captureDamage: &damage); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
MESSAGE("Wobbuffet was hurt by Foe Wobbuffet's Rowap Berry!"); HP_BAR(player, captureDamage: &damage);
MESSAGE("Wobbuffet was hurt by Foe Wobbuffet's Rowap Berry!");
} else {
NONE_OF {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
MESSAGE("Wobbuffet was hurt by Foe Wobbuffet's Rowap Berry!");
}
}
} THEN { } THEN {
EXPECT_EQ(player->maxHP / 8, damage); if (move == MOVE_SWIFT)
EXPECT_EQ(player->maxHP / 8, damage);
} }
} }

View File

@ -114,18 +114,15 @@ SINGLE_BATTLE_TEST("Bug Bite eats the target's berry and immediately gains its e
} }
} }
// To verify in the actual games.
// Bulbapedia - The effect of a Jaboca Berry will activate before the Berry can be stolen.
// Showdown - Jaboca Berry is stolen and eaten and nothing happens. This is how it currently works on expansion.
TO_DO_BATTLE_TEST("Bug Bite interaction with Jaboca Berry.");
SINGLE_BATTLE_TEST("Tanga Berry activates before Bug Bite") SINGLE_BATTLE_TEST("Tanga Berry activates before Bug Bite")
{ {
GIVEN { GIVEN {
ASSUME(gItems[ITEM_TANGA_BERRY].holdEffect == HOLD_EFFECT_RESIST_BERRY);
ASSUME(gItems[ITEM_TANGA_BERRY].holdEffectParam == TYPE_BUG);
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) {Item(ITEM_TANGA_BERRY); } OPPONENT(SPECIES_WOBBUFFET) {Item(ITEM_TANGA_BERRY); }
} WHEN { } WHEN {
TURN { MOVE(player, MOVE_BUG_BITE); } TURN { MOVE(player, MOVE_BUG_BITE); }
} SCENE { } SCENE {
MESSAGE("Wobbuffet used Bug Bite!"); MESSAGE("Wobbuffet used Bug Bite!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent); ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);

View File

@ -25,11 +25,12 @@ SINGLE_BATTLE_TEST("Multi hit Moves hit the maximum amount with Skill Link")
} }
} }
SINGLE_BATTLE_TEST("Multi hit Moves hit twice 35 Percent of the time") SINGLE_BATTLE_TEST("Multi hit Moves hit twice 35% of the time")
{ {
PASSES_RANDOMLY(35, 100, RNG_HITS); PASSES_RANDOMLY(35, 100, RNG_HITS);
GIVEN { GIVEN {
ASSUME(B_MULTI_HIT_CHANCE >= GEN_5);
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET);
} WHEN { } WHEN {
@ -41,11 +42,12 @@ SINGLE_BATTLE_TEST("Multi hit Moves hit twice 35 Percent of the time")
} }
} }
SINGLE_BATTLE_TEST("Multi hit Moves hit thrice 35 Percent of the time") SINGLE_BATTLE_TEST("Multi hit Moves hit thrice 35% of the time")
{ {
PASSES_RANDOMLY(35, 100, RNG_HITS); PASSES_RANDOMLY(35, 100, RNG_HITS);
GIVEN { GIVEN {
ASSUME(B_MULTI_HIT_CHANCE >= GEN_5);
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET);
} WHEN { } WHEN {
@ -58,11 +60,12 @@ SINGLE_BATTLE_TEST("Multi hit Moves hit thrice 35 Percent of the time")
} }
} }
SINGLE_BATTLE_TEST("Multi hit Moves hit four times 35 Percent of the time") SINGLE_BATTLE_TEST("Multi hit Moves hit four times 15% of the time")
{ {
PASSES_RANDOMLY(15, 100, RNG_HITS); PASSES_RANDOMLY(15, 100, RNG_HITS);
GIVEN { GIVEN {
ASSUME(B_MULTI_HIT_CHANCE >= GEN_5);
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET);
} WHEN { } WHEN {
@ -76,11 +79,12 @@ SINGLE_BATTLE_TEST("Multi hit Moves hit four times 35 Percent of the time")
} }
} }
SINGLE_BATTLE_TEST("Multi hit Moves hit four times 35 Percent of the time") SINGLE_BATTLE_TEST("Multi hit Moves hit five times 15% of the time")
{ {
PASSES_RANDOMLY(15, 100, RNG_HITS); PASSES_RANDOMLY(15, 100, RNG_HITS);
GIVEN { GIVEN {
ASSUME(B_MULTI_HIT_CHANCE >= GEN_5);
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET);
} WHEN { } WHEN {