Skip to content

Commit

Permalink
More weather and type-specific tests (#3260)
Browse files Browse the repository at this point in the history
Co-authored-by: Eduardo Quezada D'Ottone <[email protected]>
  • Loading branch information
kittenchilly and AsparagusEduardo committed Oct 15, 2023
1 parent 0f3971a commit 28c6a1a
Show file tree
Hide file tree
Showing 21 changed files with 757 additions and 136 deletions.
17 changes: 17 additions & 0 deletions test/battle/ability/harvest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "global.h"
#include "test/battle.h"

TO_DO_BATTLE_TEST("Harvest has a 50% chance to restore a Berry at the end of the turn");
TO_DO_BATTLE_TEST("Harvest always restores a Berry in Sunlight");
TO_DO_BATTLE_TEST("Harvest restores a Berry even after being switched out and back in");
TO_DO_BATTLE_TEST("Harvest restores a Berry consumed by Fling");
TO_DO_BATTLE_TEST("Harvest restores a Berry consumed by Natural Gift");
TO_DO_BATTLE_TEST("Harvest only works once per turn"); // Check for berries that are consumed immediately, like Pecha Berry
TO_DO_BATTLE_TEST("Harvest doesn't restore a Berry when destroyed by Incinerate");
TO_DO_BATTLE_TEST("Harvest doesn't restore a Berry when knocked off by Knock Off");
TO_DO_BATTLE_TEST("Harvest doesn't restore a Berry when eaten by Bug Bite/Pluck");
TO_DO_BATTLE_TEST("Harvest doesn't restore a Berry that's collected via Pickup");
TO_DO_BATTLE_TEST("Harvest order is affected by speed");
TO_DO_BATTLE_TEST("Harvest doesn't restore a Berry when transfered to another Pokémon");
TO_DO_BATTLE_TEST("Harvest can restore a Berry that was transferred from another Pokémon");
TO_DO_BATTLE_TEST("Harvest can only restore the newest berry consumed that was transferred from another Pokémon instead of its original Berry");
30 changes: 30 additions & 0 deletions test/battle/ability/prankster.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "global.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Prankster-affected moves don't affect Dark-type Pokémon")
{
GIVEN {
ASSUME(gSpeciesInfo[SPECIES_UMBREON].types[0] == TYPE_DARK);
PLAYER(SPECIES_UMBREON);
OPPONENT(SPECIES_MURKROW) { Ability(ABILITY_PRANKSTER); }
} WHEN {
TURN { MOVE(opponent, MOVE_CONFUSE_RAY); }
} SCENE {
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_CONFUSE_RAY, player);
MESSAGE("It doesn't affect Umbreon…");
}
}
TO_DO_BATTLE_TEST("Prankster-affected moves affect Ally Dark-type Pokémon")
TO_DO_BATTLE_TEST("Prankster-affected moves called via Assist don't affect Dark-type Pokémon");
TO_DO_BATTLE_TEST("Prankster-affected moves called via Nature Power don't affect Dark-type Pokémon");
TO_DO_BATTLE_TEST("Prankster-affected moves called via Instruct affect Dark-type Pokémon");
TO_DO_BATTLE_TEST("Prankster-affected moves called via After you 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 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 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 Extreme Evoboost by 1");
TO_DO_BATTLE_TEST("Prankster is blocked by Quick Guard in Gen5+");
27 changes: 24 additions & 3 deletions test/battle/hold_effect/safety_goggles.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ SINGLE_BATTLE_TEST("Safety Goggles block powder and spore moves")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_STUN_SPORE].powderMove);
ASSUME(gItems[ITEM_SAFETY_GOGGLES].holdEffect == HOLD_EFFECT_SAFETY_GOGGLES);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_ABRA) { Item(ITEM_SAFETY_GOGGLES); }
} WHEN {
Expand All @@ -21,6 +20,28 @@ SINGLE_BATTLE_TEST("Safety Goggles block powder and spore moves")
}
}

TO_DO_BATTLE_TEST("Safety Goggles blocks damage from hail");
TO_DO_BATTLE_TEST("Safety Goggles blocks damage from sandstorm");
SINGLE_BATTLE_TEST("Safety Goggles blocks damage from Hail")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); };
} WHEN {
TURN { MOVE(player, MOVE_HAIL); }
} SCENE {
NOT MESSAGE("Foe Wobbuffet is pelted by HAIL!");
}
}

SINGLE_BATTLE_TEST("Safety Goggles blocks damage from Sandstorm")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); };
} WHEN {
TURN { MOVE(player, MOVE_SANDSTORM); }
} SCENE {
NOT MESSAGE("Foe Wobbuffet is buffeted by the sandstorm!");
}
}

TO_DO_BATTLE_TEST("Safety Goggles blocks Effect Spore's effect");
33 changes: 33 additions & 0 deletions test/battle/move_effect/aurora_veil.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include "global.h"
#include "test/battle.h"

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_AURORA_VEIL].effect == EFFECT_AURORA_VEIL);
}

SINGLE_BATTLE_TEST("Aurora Veil can only be used in Hail and Snow")
{
u32 move;
PARAMETRIZE { move = MOVE_CELEBRATE; }
PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, move); MOVE(player, MOVE_AURORA_VEIL); }
} SCENE {
if (move == MOVE_CELEBRATE)
MESSAGE("But it failed!");
else
NOT MESSAGE("But it failed!");
}
}

TO_DO_BATTLE_TEST("Aurora Veil reduces damage done to the user by half in singles")
TO_DO_BATTLE_TEST("Aurora Veil reduces damage done to the user by roughly a third in doubles")
TO_DO_BATTLE_TEST("Aurora Veil's damage reduction is ignored by Critical Hits")
TO_DO_BATTLE_TEST("Aurora Veil's damage reduction doesn't stack with Reflect or Light Screen")
TO_DO_BATTLE_TEST("Aurora Veil doesn't reduce confusion damage")
TO_DO_BATTLE_TEST("Aurora Veil doesn't reduce damage done by moves that do direct damage") // Bide, Counter, Endeavor, Final Gambit, Metal Burst, Mirror Coat, Psywave, Seismic Toss, Sonic Boom, Super Fang
2 changes: 1 addition & 1 deletion test/battle/move_effect/burn_hit.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SINGLE_BATTLE_TEST("Ember inflicts burn")
}
}

SINGLE_BATTLE_TEST("Ember cannot burn a Fire-type")
SINGLE_BATTLE_TEST("Ember cannot burn a Fire-type Pokémon")
{
GIVEN {
ASSUME(gSpeciesInfo[SPECIES_CHARMANDER].types[0] == TYPE_FIRE);
Expand Down
30 changes: 29 additions & 1 deletion test/battle/move_effect/freeze_hit.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_POWDER_SNOW].effect == EFFECT_FREEZE_HIT);
ASSUME(gBattleMoves[MOVE_BLIZZARD].accuracy == 70);
}

SINGLE_BATTLE_TEST("Powder Snow inflicts freeze")
Expand All @@ -21,7 +22,7 @@ SINGLE_BATTLE_TEST("Powder Snow inflicts freeze")
}
}

SINGLE_BATTLE_TEST("Powder Snow cannot freeze an Ice-type")
SINGLE_BATTLE_TEST("Powder Snow cannot freeze an Ice-type Pokémon")
{
GIVEN {
ASSUME(gSpeciesInfo[SPECIES_SNORUNT].types[0] == TYPE_ICE);
Expand All @@ -36,3 +37,30 @@ SINGLE_BATTLE_TEST("Powder Snow cannot freeze an Ice-type")
NOT STATUS_ICON(opponent, freeze: TRUE);
}
}

SINGLE_BATTLE_TEST("Freeze cannot be inflicted in Sunlight")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_ICE_BEAM); }
} SCENE {
NOT MESSAGE("Wobbuffet was frozen solid!");
}
}

SINGLE_BATTLE_TEST("Blizzard bypasses accuracy checks in Hail and Snow")
{
u32 move;
PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, move); MOVE(player, MOVE_BLIZZARD); }
} SCENE {
NONE_OF { MESSAGE("Wobbuffet's attack missed!"); }
}
}
35 changes: 35 additions & 0 deletions test/battle/move_effect/hurricane.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "global.h"
#include "test/battle.h"

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_HURRICANE].effect == EFFECT_HURRICANE);
ASSUME(gBattleMoves[MOVE_HURRICANE].accuracy == 70);
}

SINGLE_BATTLE_TEST("Hurricane's accuracy is lowered to 50% in Sunlight")
{
PASSES_RANDOMLY(50, 100, RNG_ACCURACY);
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_SUNNY_DAY); MOVE(opponent, MOVE_HURRICANE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_HURRICANE, opponent);
}
}

SINGLE_BATTLE_TEST("Hurricane bypasses accuracy checks in Rain")
{
PASSES_RANDOMLY(100, 100, RNG_ACCURACY);
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_RAIN_DANCE); MOVE(player, MOVE_HURRICANE); }
} SCENE {
NONE_OF { MESSAGE("Wobbuffet's attack missed!"); }
}
}
TO_DO_BATTLE_TEST("Hurricane Veil can hit airborne targets") // Fly, Bounce, Sky Drop
26 changes: 26 additions & 0 deletions test/battle/move_effect/leech_seed.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "global.h"
#include "test/battle.h"

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_LEECH_SEED].effect == EFFECT_LEECH_SEED);
}

SINGLE_BATTLE_TEST("Leech Seed doesn't affect Grass-type Pokémon")
{
PASSES_RANDOMLY(90, 100, RNG_ACCURACY);
GIVEN {
ASSUME(gSpeciesInfo[SPECIES_ODDISH].types[0] == TYPE_GRASS);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_ODDISH);
} WHEN {
TURN { MOVE(player, MOVE_LEECH_SEED); }
} SCENE {
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_LEECH_SEED, player);
MESSAGE("It doesn't affect Foe Oddish…");
}
}
TO_DO_BATTLE_TEST("Leech Seed doesn't affect already seeded targets")
TO_DO_BATTLE_TEST("Leech Seeded targets lose 1/8 of its max HP every turn and give it to the user")
TO_DO_BATTLE_TEST("Leech Seed's effect is paused until a new battler replaces the original user's position") // Faint, can't be replaced, then revived.
TO_DO_BATTLE_TEST("Leech Seed's effect pause still prevents it from being seeded again")
48 changes: 48 additions & 0 deletions test/battle/move_effect/moonlight.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "global.h"
#include "test/battle.h"

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_MOONLIGHT].effect == EFFECT_MOONLIGHT);
}

SINGLE_BATTLE_TEST("Moonlight recovers 1/2 of the user's max HP")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(200); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_MOONLIGHT); }
} SCENE {
HP_BAR(player, damage: -(200 / 2));
}
}

SINGLE_BATTLE_TEST("Moonlight recovers 2/3 of the user's max HP in Sunlight")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(300); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_MOONLIGHT); }
} SCENE {
HP_BAR(player, damage: -(300 / 1.5));
}
}

SINGLE_BATTLE_TEST("Moonlight recovers 1/4 of the user's max HP in Rain, Sandstorm, Hail, and Snow")
{
u32 move;
PARAMETRIZE { move = MOVE_RAIN_DANCE; }
PARAMETRIZE { move = MOVE_SANDSTORM; }
PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, move); MOVE(player, MOVE_MOONLIGHT); }
} SCENE {
HP_BAR(player, damage: -(400 / 4));
}
}
48 changes: 48 additions & 0 deletions test/battle/move_effect/morning_sun.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "global.h"
#include "test/battle.h"

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN);
}

SINGLE_BATTLE_TEST("Morning Sun recovers 1/2 of the user's max HP")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(200); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_MORNING_SUN); }
} SCENE {
HP_BAR(player, damage: -(200 / 2));
}
}

SINGLE_BATTLE_TEST("Morning Sun recovers 2/3 of the user's max HP in Sunlight")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(300); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_MORNING_SUN); }
} SCENE {
HP_BAR(player, damage: -(300 / 1.5));
}
}

SINGLE_BATTLE_TEST("Morning Sun recovers 1/4 of the user's max HP in Rain, Sandstorm, Hail, and Snow")
{
u32 move;
PARAMETRIZE { move = MOVE_RAIN_DANCE; }
PARAMETRIZE { move = MOVE_SANDSTORM; }
PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, move); MOVE(player, MOVE_MORNING_SUN); }
} SCENE {
HP_BAR(player, damage: -(400 / 4));
}
}
26 changes: 26 additions & 0 deletions test/battle/move_effect/ohko.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "global.h"
#include "test/battle.h"

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_SHEER_COLD].effect == EFFECT_OHKO);
}

SINGLE_BATTLE_TEST("Sheer Cold doesn't affect Ice-type Pokémon")
{
GIVEN {
ASSUME(B_SHEER_COLD_IMMUNITY >= GEN_7);
ASSUME(gSpeciesInfo[SPECIES_GLALIE].types[0] == TYPE_ICE);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_GLALIE);
} WHEN {
TURN { MOVE(player, MOVE_SHEER_COLD); }
} SCENE {
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_SHEER_COLD, player);
MESSAGE("It doesn't affect Foe Glalie…");
}
}
TO_DO_BATTLE_TEST("Fissure faints the target, skipping regular damage calculations")
TO_DO_BATTLE_TEST("Fissure always fails if the target has a higher level than the user")
TO_DO_BATTLE_TEST("Fissure's accuracy increases by 1% for every level the user has over the target")
TO_DO_BATTLE_TEST("Fissure's ignores non-stage accuracy modifiers") // Gravity, Wide Lens, Compound Eyes
13 changes: 9 additions & 4 deletions test/battle/move_effect/poison_hit.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_POISON_STING].effect == EFFECT_POISON_HIT);
ASSUME(gBattleMoves[MOVE_TWINEEDLE].effect == EFFECT_POISON_HIT);
}

SINGLE_BATTLE_TEST("Poison Sting inflicts poison")
Expand All @@ -22,16 +23,20 @@ SINGLE_BATTLE_TEST("Poison Sting inflicts poison")
}
}

SINGLE_BATTLE_TEST("Poison Sting cannot poison Poison-type")
SINGLE_BATTLE_TEST("Poison cannot be inflicted on Poison and Steel-type Pokémon")
{
u32 mon;
PARAMETRIZE { mon = SPECIES_NIDORAN_M; }
PARAMETRIZE { mon = SPECIES_REGISTEEL; }
GIVEN {
ASSUME(gSpeciesInfo[SPECIES_NIDORAN_M].types[0] == TYPE_POISON);
ASSUME(gSpeciesInfo[SPECIES_REGISTEEL].types[0] == TYPE_STEEL);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_NIDORAN_M);
OPPONENT(mon);
} WHEN {
TURN { MOVE(player, MOVE_POISON_STING); }
TURN { MOVE(player, MOVE_TWINEEDLE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_POISON_STING, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TWINEEDLE, player);
HP_BAR(opponent);
NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent);
NOT STATUS_ICON(opponent, poison: TRUE);
Expand Down
Loading

0 comments on commit 28c6a1a

Please sign in to comment.