From e2fa4b83578285add5613a98ceb887cdc2098ae2 Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Sun, 27 Aug 2023 23:00:02 -0500 Subject: [PATCH 01/14] Weather and type specific tests --- test/battle/move_effect/burn_hit.c | 18 +--- test/battle/move_effect/freeze_hit.c | 18 +--- test/battle/move_effect/paralyze_hit.c | 19 +--- test/battle/move_effect/poison_hit.c | 18 +--- test/battle/move_effect/toxic_spikes.c | 60 +---------- test/battle/type/dark.c | 16 +++ test/battle/type/electric.c | 19 ++++ test/battle/type/fire.c | 18 ++++ test/battle/type/ghost.c | 18 ++++ test/battle/type/grass.c | 15 +++ test/battle/type/ground.c | 15 +++ test/battle/type/ice.c | 46 ++++++++ test/battle/type/poison.c | 77 ++++++++++++++ test/battle/type/rock.c | 15 +++ test/battle/type/steel.c | 31 ++++++ test/battle/weather/hail.c | 140 +++++++++++++++++++++++++ test/battle/weather/rain.c | 126 +++++++++++++++++++++- test/battle/weather/sandstorm.c | 132 +++++++++++++++++++++++ test/battle/weather/snow.c | 25 +++-- test/battle/weather/sunlight.c | 128 +++++++++++++++++++++- 20 files changed, 811 insertions(+), 143 deletions(-) create mode 100644 test/battle/type/dark.c create mode 100644 test/battle/type/electric.c create mode 100644 test/battle/type/fire.c create mode 100644 test/battle/type/ghost.c create mode 100644 test/battle/type/ground.c create mode 100644 test/battle/type/ice.c create mode 100644 test/battle/type/poison.c create mode 100644 test/battle/type/rock.c create mode 100644 test/battle/type/steel.c create mode 100644 test/battle/weather/hail.c create mode 100644 test/battle/weather/sandstorm.c diff --git a/test/battle/move_effect/burn_hit.c b/test/battle/move_effect/burn_hit.c index 3f257dfcb32c..c9919583ad8f 100644 --- a/test/battle/move_effect/burn_hit.c +++ b/test/battle/move_effect/burn_hit.c @@ -19,20 +19,4 @@ SINGLE_BATTLE_TEST("Ember inflicts burn") ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponent); STATUS_ICON(opponent, burn: TRUE); } -} - -SINGLE_BATTLE_TEST("Ember cannot burn a Fire-type") -{ - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_CHARMANDER].types[0] == TYPE_FIRE); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_CHARMANDER); - } WHEN { - TURN { MOVE(player, MOVE_EMBER); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_EMBER, player); - HP_BAR(opponent); - NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponent); - NOT STATUS_ICON(opponent, burn: TRUE); - } -} +} \ No newline at end of file diff --git a/test/battle/move_effect/freeze_hit.c b/test/battle/move_effect/freeze_hit.c index 5d99311cee27..d706f844f5e8 100644 --- a/test/battle/move_effect/freeze_hit.c +++ b/test/battle/move_effect/freeze_hit.c @@ -19,20 +19,4 @@ SINGLE_BATTLE_TEST("Powder Snow inflicts freeze") ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_FRZ, opponent); STATUS_ICON(opponent, freeze: TRUE); } -} - -SINGLE_BATTLE_TEST("Powder Snow cannot freeze an Ice-type") -{ - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_SNORUNT].types[0] == TYPE_ICE); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_SNORUNT); - } WHEN { - TURN { MOVE(player, MOVE_POWDER_SNOW); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_POWDER_SNOW, player); - HP_BAR(opponent); - NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_FRZ, opponent); - NOT STATUS_ICON(opponent, freeze: TRUE); - } -} +} \ No newline at end of file diff --git a/test/battle/move_effect/paralyze_hit.c b/test/battle/move_effect/paralyze_hit.c index 4efe6746ceb6..04a2ef0e9d98 100644 --- a/test/battle/move_effect/paralyze_hit.c +++ b/test/battle/move_effect/paralyze_hit.c @@ -19,21 +19,4 @@ SINGLE_BATTLE_TEST("Thunder Shock inflicts paralysis") ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PRZ, opponent); STATUS_ICON(opponent, paralysis: TRUE); } -} - -SINGLE_BATTLE_TEST("Thunder Shock cannot paralyze an Electric-type") -{ - GIVEN { - ASSUME(B_PARALYZE_ELECTRIC >= GEN_6); - ASSUME(gSpeciesInfo[SPECIES_PIKACHU].types[0] == TYPE_ELECTRIC); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_PIKACHU); - } WHEN { - TURN { MOVE(player, MOVE_THUNDER_SHOCK); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_THUNDER_SHOCK, player); - HP_BAR(opponent); - NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PRZ, opponent); - NOT STATUS_ICON(opponent, paralysis: TRUE); - } -} +} \ No newline at end of file diff --git a/test/battle/move_effect/poison_hit.c b/test/battle/move_effect/poison_hit.c index 91d7004669a8..b7f498a46ec7 100644 --- a/test/battle/move_effect/poison_hit.c +++ b/test/battle/move_effect/poison_hit.c @@ -20,20 +20,4 @@ SINGLE_BATTLE_TEST("Poison Sting inflicts poison") ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); STATUS_ICON(opponent, poison: TRUE); } -} - -SINGLE_BATTLE_TEST("Poison Sting cannot poison Poison-type") -{ - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_NIDORAN_M].types[0] == TYPE_POISON); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_NIDORAN_M); - } WHEN { - TURN { MOVE(player, MOVE_POISON_STING); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_POISON_STING, player); - HP_BAR(opponent); - NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); - NOT STATUS_ICON(opponent, poison: TRUE); - } -} +} \ No newline at end of file diff --git a/test/battle/move_effect/toxic_spikes.c b/test/battle/move_effect/toxic_spikes.c index 3be2d1627f11..c7f11797660b 100644 --- a/test/battle/move_effect/toxic_spikes.c +++ b/test/battle/move_effect/toxic_spikes.c @@ -149,62 +149,4 @@ SINGLE_BATTLE_TEST("Toxic Spikes do not affect Steel-types") } SCENE { NOT STATUS_ICON(opponent, poison: TRUE); } -} - -SINGLE_BATTLE_TEST("Toxic Spikes are removed by grounded Poison-types") -{ - u32 species; - u32 item = ITEM_NONE; - u32 move = MOVE_CELEBRATE; - bool32 grounded; - PARAMETRIZE { species = SPECIES_EKANS; grounded = TRUE; } - PARAMETRIZE { species = SPECIES_ZUBAT; grounded = FALSE; } - PARAMETRIZE { species = SPECIES_ZUBAT; item = ITEM_IRON_BALL; grounded = TRUE; } - PARAMETRIZE { species = SPECIES_ZUBAT; move = MOVE_GRAVITY; grounded = TRUE; } - PARAMETRIZE { species = SPECIES_ZUBAT; move = MOVE_INGRAIN; grounded = TRUE; } - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_EKANS].types[0] == TYPE_POISON); - ASSUME(gSpeciesInfo[SPECIES_ZUBAT].types[0] == TYPE_POISON); - ASSUME(gSpeciesInfo[SPECIES_ZUBAT].types[1] == TYPE_FLYING); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - OPPONENT(species) { Item(item); } - } WHEN { - TURN { MOVE(player, MOVE_TOXIC_SPIKES); MOVE(opponent, move); } - TURN { MOVE(opponent, MOVE_BATON_PASS); SEND_OUT(opponent, 1); } - TURN { SWITCH(opponent, 0); } - } SCENE { - if (grounded) { - NOT STATUS_ICON(opponent, poison: TRUE); - MESSAGE("The poison spikes disappeared from around the opposing team's feet!"); - NOT STATUS_ICON(opponent, poison: TRUE); - } else { - NOT STATUS_ICON(opponent, poison: TRUE); - ANIMATION(ANIM_TYPE_MOVE, MOVE_BATON_PASS, opponent); - STATUS_ICON(opponent, poison: TRUE); - } - } -} - -// This would test for what I believe to be a bug in the mainline games. -// A Pokémon that gets passed magnet rise should still remove the Toxic -// Spikes even though it is airborne. -// The test currently fails, because we don't incorporate this bug. -SINGLE_BATTLE_TEST("Toxic Spikes are removed by Poison-types affected by Magnet Rise") -{ - KNOWN_FAILING; - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_EKANS].types[0] == TYPE_POISON); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_EKANS); - } WHEN { - TURN { MOVE(opponent, MOVE_MAGNET_RISE); } - TURN { MOVE(player, MOVE_TOXIC_SPIKES); MOVE(opponent, MOVE_BATON_PASS); SEND_OUT(opponent, 1); } - TURN { SWITCH(opponent, 0); } - } SCENE { - NOT STATUS_ICON(opponent, poison: TRUE); - MESSAGE("The poison spikes disappeared from around the opposing team's feet!"); - NOT STATUS_ICON(opponent, poison: TRUE); - } -} +} \ No newline at end of file diff --git a/test/battle/type/dark.c b/test/battle/type/dark.c new file mode 100644 index 000000000000..a990bab0fa8e --- /dev/null +++ b/test/battle/type/dark.c @@ -0,0 +1,16 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Dark-type Pokémon are immune to moves that gain priority due to Prankster") +{ + 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…"); + } +} \ No newline at end of file diff --git a/test/battle/type/electric.c b/test/battle/type/electric.c new file mode 100644 index 000000000000..5443808d8133 --- /dev/null +++ b/test/battle/type/electric.c @@ -0,0 +1,19 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Electric-type Pokémon cannot be paralyzed") +{ + GIVEN { + ASSUME(B_PARALYZE_ELECTRIC >= GEN_6); + ASSUME(gSpeciesInfo[SPECIES_PIKACHU].types[0] == TYPE_ELECTRIC); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_PIKACHU); + } WHEN { + TURN { MOVE(player, MOVE_THUNDER_SHOCK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_THUNDER_SHOCK, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PRZ, opponent); + NOT STATUS_ICON(opponent, paralysis: TRUE); + } +} diff --git a/test/battle/type/fire.c b/test/battle/type/fire.c new file mode 100644 index 000000000000..483999c8d94a --- /dev/null +++ b/test/battle/type/fire.c @@ -0,0 +1,18 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Fire-type Pokémon cannot be burned") +{ + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_CHARMANDER].types[0] == TYPE_FIRE); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_CHARMANDER); + } WHEN { + TURN { MOVE(player, MOVE_EMBER); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_EMBER, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponent); + NOT STATUS_ICON(opponent, burn: TRUE); + } +} diff --git a/test/battle/type/ghost.c b/test/battle/type/ghost.c new file mode 100644 index 000000000000..600a71205b24 --- /dev/null +++ b/test/battle/type/ghost.c @@ -0,0 +1,18 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Ghost-type Pokémon can bypass effects that prevent recall or escape") +{ + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_GENGAR].types[0] == TYPE_GHOST); + PLAYER(SPECIES_GENGAR); + PLAYER(SPECIES_WYNAUT); + OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_SHADOW_TAG); } + } WHEN { + TURN { SWITCH(player, 1); } + } SCENE { + NOT MESSAGE("Foe Wobbuffet prevents escape with Shadow Tag!"); + } +} + +TO_DO_BATTLE_TEST("Ghost-type Pokémon are guaranteed to flee from any wild battle regardless of Speed") \ No newline at end of file diff --git a/test/battle/type/grass.c b/test/battle/type/grass.c index b36813ac7415..32c1c78b3611 100644 --- a/test/battle/type/grass.c +++ b/test/battle/type/grass.c @@ -15,3 +15,18 @@ SINGLE_BATTLE_TEST("Grass-type Pokémon block powder and spore moves") MESSAGE("It doesn't affect Foe Oddish…"); } } + +SINGLE_BATTLE_TEST("Grass-type Pokémon are immune to Leech Seed") +{ + 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…"); + } +} \ No newline at end of file diff --git a/test/battle/type/ground.c b/test/battle/type/ground.c new file mode 100644 index 000000000000..2d697c80ffcc --- /dev/null +++ b/test/battle/type/ground.c @@ -0,0 +1,15 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Ground-type Pokémon are immune to Sandstorm damage") +{ + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_SANDSLASH].types[0] == TYPE_GROUND); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_SANDSLASH); + } WHEN { + TURN {MOVE(player, MOVE_SANDSTORM);} + } SCENE { + NOT MESSAGE("Foe Sandslash is buffeted by the sandstorm!"); + } +} \ No newline at end of file diff --git a/test/battle/type/ice.c b/test/battle/type/ice.c new file mode 100644 index 000000000000..fdcc1c892291 --- /dev/null +++ b/test/battle/type/ice.c @@ -0,0 +1,46 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Ice-type Pokémon are immune to Hail damage") +{ + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_GLALIE].types[0] == TYPE_ICE); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_GLALIE); + } WHEN { + TURN {MOVE(player, MOVE_HAIL);} + } SCENE { + NOT MESSAGE("Foe Glalie is pelted by HAIL!"); + } +} + +SINGLE_BATTLE_TEST("Ice-type Pokémon cannot be frozen") +{ + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_GLALIE].types[0] == TYPE_ICE); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_GLALIE); + } WHEN { + TURN { MOVE(player, MOVE_POWDER_SNOW); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_POWDER_SNOW, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_FRZ, opponent); + NOT STATUS_ICON(opponent, freeze: TRUE); + } +} + +SINGLE_BATTLE_TEST("Ice-type Pokémon are immune to Sheer Cold") +{ + 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…"); + } +} diff --git a/test/battle/type/poison.c b/test/battle/type/poison.c new file mode 100644 index 000000000000..0d4ec9515f9d --- /dev/null +++ b/test/battle/type/poison.c @@ -0,0 +1,77 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Poison-type Pokémon cannot be poisoned") +{ + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_NIDORAN_M].types[0] == TYPE_POISON); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_NIDORAN_M); + } WHEN { + TURN { MOVE(player, MOVE_POISON_STING); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_POISON_STING, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); + NOT STATUS_ICON(opponent, poison: TRUE); + } +} + + +SINGLE_BATTLE_TEST("Poison-type Pokémon remove Toxic Spikes on switch in if grounded") +{ + u32 species; + u32 item = ITEM_NONE; + u32 move = MOVE_CELEBRATE; + bool32 grounded; + PARAMETRIZE { species = SPECIES_EKANS; grounded = TRUE; } + PARAMETRIZE { species = SPECIES_ZUBAT; grounded = FALSE; } + PARAMETRIZE { species = SPECIES_ZUBAT; item = ITEM_IRON_BALL; grounded = TRUE; } + PARAMETRIZE { species = SPECIES_ZUBAT; move = MOVE_GRAVITY; grounded = TRUE; } + PARAMETRIZE { species = SPECIES_ZUBAT; move = MOVE_INGRAIN; grounded = TRUE; } + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_EKANS].types[0] == TYPE_POISON); + ASSUME(gSpeciesInfo[SPECIES_ZUBAT].types[0] == TYPE_POISON); + ASSUME(gSpeciesInfo[SPECIES_ZUBAT].types[1] == TYPE_FLYING); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(species) { Item(item); } + } WHEN { + TURN { MOVE(player, MOVE_TOXIC_SPIKES); MOVE(opponent, move); } + TURN { MOVE(opponent, MOVE_BATON_PASS); SEND_OUT(opponent, 1); } + TURN { SWITCH(opponent, 0); } + } SCENE { + if (grounded) { + NOT STATUS_ICON(opponent, poison: TRUE); + MESSAGE("The poison spikes disappeared from around the opposing team's feet!"); + NOT STATUS_ICON(opponent, poison: TRUE); + } else { + NOT STATUS_ICON(opponent, poison: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BATON_PASS, opponent); + STATUS_ICON(opponent, poison: TRUE); + } + } +} + +// This would test for what I believe to be a bug in the mainline games. +// A Pokémon that gets passed magnet rise should still remove the Toxic +// Spikes even though it is airborne. +// The test currently fails, because we don't incorporate this bug. +SINGLE_BATTLE_TEST("Poison-type Pokémon remove Toxic Spikes on switch in if affected by Magnet Rise") +{ + KNOWN_FAILING; + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_EKANS].types[0] == TYPE_POISON); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_EKANS); + } WHEN { + TURN { MOVE(opponent, MOVE_MAGNET_RISE); } + TURN { MOVE(player, MOVE_TOXIC_SPIKES); MOVE(opponent, MOVE_BATON_PASS); SEND_OUT(opponent, 1); } + TURN { SWITCH(opponent, 0); } + } SCENE { + NOT STATUS_ICON(opponent, poison: TRUE); + MESSAGE("The poison spikes disappeared from around the opposing team's feet!"); + NOT STATUS_ICON(opponent, poison: TRUE); + } +} diff --git a/test/battle/type/rock.c b/test/battle/type/rock.c new file mode 100644 index 000000000000..ac73b3fe962b --- /dev/null +++ b/test/battle/type/rock.c @@ -0,0 +1,15 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Rock-type Pokémon are immune to Sandstorm damage") +{ + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_NOSEPASS].types[0] == TYPE_ROCK); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_NOSEPASS); + } WHEN { + TURN {MOVE(player, MOVE_SANDSTORM);} + } SCENE { + NOT MESSAGE("Foe Nosepass is buffeted by the sandstorm!"); + } +} \ No newline at end of file diff --git a/test/battle/type/steel.c b/test/battle/type/steel.c new file mode 100644 index 000000000000..f86f0198ec61 --- /dev/null +++ b/test/battle/type/steel.c @@ -0,0 +1,31 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Steel-type Pokémon cannot be poisoned") +{ + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_REGISTEEL].types[0] == TYPE_STEEL); + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_POISON_BARB); }; + OPPONENT(SPECIES_REGISTEEL); + } WHEN { + TURN { MOVE(player, MOVE_FLING); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_FLING, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); + NOT STATUS_ICON(opponent, poison: TRUE); + } +} + +SINGLE_BATTLE_TEST("Steel-type Pokémon are immune to Sandstorm damage") +{ + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_REGISTEEL].types[0] == TYPE_STEEL); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_REGISTEEL); + } WHEN { + TURN {MOVE(player, MOVE_SANDSTORM);} + } SCENE { + NOT MESSAGE("Foe Registeel is buffeted by the sandstorm!"); + } +} \ No newline at end of file diff --git a/test/battle/weather/hail.c b/test/battle/weather/hail.c new file mode 100644 index 000000000000..a6f584c4ae70 --- /dev/null +++ b/test/battle/weather/hail.c @@ -0,0 +1,140 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Hail deals 1/16 damage per turn") +{ + s16 hailDamage; + + GIVEN { + PLAYER(SPECIES_GLALIE); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN {MOVE(player, MOVE_HAIL);} + } SCENE { + MESSAGE("Foe Wobbuffet is pelted by HAIL!"); + HP_BAR(opponent, captureDamage: &hailDamage); + } THEN { EXPECT_EQ(hailDamage, opponent->maxHP / 16); } +} + +SINGLE_BATTLE_TEST("Hail turns Weather Ball to an Ice-type move and doubles its power", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_HAIL; } + GIVEN { + ASSUME(gBattleMoves[MOVE_WEATHER_BALL].effect == EFFECT_WEATHER_BALL); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_DRAGONAIR) { Item(ITEM_SAFETY_GOGGLES); }; + } WHEN { + TURN { MOVE(player, move); } + TURN { MOVE(player, MOVE_WEATHER_BALL); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(4.0), results[1].damage); // double base power + type effectiveness. + } +} + +SINGLE_BATTLE_TEST("Hail allows Blizzard to bypass accuracy checks") +{ + PASSES_RANDOMLY(100, 100, RNG_ACCURACY); + GIVEN { + ASSUME(gBattleMoves[MOVE_BLIZZARD].accuracy == 70); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_BLIZZARD); } + } SCENE { + NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } + } +} + +SINGLE_BATTLE_TEST("Hail halves the power of Solar Beam", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_HAIL; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BEAM); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Hail halves the power of Solar Blade", s16 damage) +{ + u16 move; + KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_HAIL; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BLADE); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Hail causes Moonlight to recover 1/4 of the user's max HP") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_MOONLIGHT].effect == EFFECT_MOONLIGHT); + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_MOONLIGHT); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Hail causes Synthesis to recover 1/4 of the user's max HP") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_SYNTHESIS].effect == EFFECT_SYNTHESIS); + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_SYNTHESIS); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Hail causes Morning Sun to recover 1/4 of the user's max HP") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN); + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_MORNING_SUN); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Hail allows Aurora Veil to be used") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_AURORA_VEIL); } + } SCENE { + NOT MESSAGE("But it failed!"); + } +} \ No newline at end of file diff --git a/test/battle/weather/rain.c b/test/battle/weather/rain.c index 00ac263044af..0da324b1b481 100644 --- a/test/battle/weather/rain.c +++ b/test/battle/weather/rain.c @@ -1,7 +1,6 @@ #include "global.h" #include "test/battle.h" -// Please add Rain interactions with move, item and ability effects on their respective files. ASSUMPTIONS { ASSUME(gBattleMoves[MOVE_EMBER].type == TYPE_FIRE); @@ -45,3 +44,128 @@ SINGLE_BATTLE_TEST("Rain multiplies the power of Water-type moves by 1.5x", s16 EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); } } + +SINGLE_BATTLE_TEST("Rain turns Weather Ball to a Water-type move and doubles its power", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_RAIN_DANCE; } + GIVEN { + ASSUME(gBattleMoves[MOVE_WEATHER_BALL].effect == EFFECT_WEATHER_BALL); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_ARCANINE); + } WHEN { + TURN { MOVE(player, move); } + TURN { MOVE(player, MOVE_WEATHER_BALL); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(6.0), results[1].damage); // double base power + type effectiveness + rain 50% boost + } +} + +SINGLE_BATTLE_TEST("Rain allows Thunder to bypass accuracy checks") +{ + PASSES_RANDOMLY(100, 100, RNG_ACCURACY); + GIVEN { + ASSUME(gBattleMoves[MOVE_THUNDER].accuracy == 70); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_RAIN_DANCE); MOVE(player, MOVE_THUNDER); } + } SCENE { + NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } + } +} + +SINGLE_BATTLE_TEST("Rain allows Hurricane to bypass accuracy checks") +{ + PASSES_RANDOMLY(100, 100, RNG_ACCURACY); + GIVEN { + ASSUME(gBattleMoves[MOVE_HURRICANE].accuracy == 70); + 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!"); } + } +} + +SINGLE_BATTLE_TEST("Rain halves the power of Solar Beam", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_RAIN_DANCE; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BEAM); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Rain halves the power of Solar Blade", s16 damage) +{ + u16 move; + KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_RAIN_DANCE; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BLADE); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Rain causes Moonlight to recover 1/4 of the user's max HP") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_MOONLIGHT].effect == EFFECT_MOONLIGHT); + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_RAIN_DANCE); MOVE(player, MOVE_MOONLIGHT); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Rain causes Synthesis to recover 1/4 of the user's max HP") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_SYNTHESIS].effect == EFFECT_SYNTHESIS); + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_RAIN_DANCE); MOVE(player, MOVE_SYNTHESIS); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Rain causes Morning Sun to recover 1/4 of the user's max HP") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN); + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_RAIN_DANCE); MOVE(player, MOVE_MORNING_SUN); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} \ No newline at end of file diff --git a/test/battle/weather/sandstorm.c b/test/battle/weather/sandstorm.c new file mode 100644 index 000000000000..1e7bb263d774 --- /dev/null +++ b/test/battle/weather/sandstorm.c @@ -0,0 +1,132 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Sandstorm deals 1/16 damage per turn") +{ + s16 sandstormDamage; + + GIVEN { + PLAYER(SPECIES_SANDSLASH); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN {MOVE(player, MOVE_SANDSTORM);} + } SCENE { + MESSAGE("Foe Wobbuffet is buffeted by the sandstorm!"); + HP_BAR(opponent, captureDamage: &sandstormDamage); + } THEN { EXPECT_EQ(sandstormDamage, opponent->maxHP / 16); } +} + +SINGLE_BATTLE_TEST("Sandstorm multiplies the special defense of Rock-types by 1.5x", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_SANDSTORM; } + PARAMETRIZE{ move = MOVE_CELEBRATE; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET) ; + OPPONENT(SPECIES_NOSEPASS); + } WHEN { + TURN { MOVE(opponent, move); } + TURN { MOVE(player, MOVE_SWIFT); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Sandstorm turns Weather Ball to a Rock-type move and doubles its power", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_SANDSTORM; } + GIVEN { + ASSUME(gBattleMoves[MOVE_WEATHER_BALL].effect == EFFECT_WEATHER_BALL); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_MAGMAR) { Item(ITEM_SAFETY_GOGGLES); }; //sandstorm damage throws the calculation off so i have to give safety goggles + } WHEN { + TURN { MOVE(player, move); } + TURN { MOVE(player, MOVE_WEATHER_BALL); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(4.0), results[1].damage); // double base power + type effectiveness. + } +} + +SINGLE_BATTLE_TEST("Sandstorm halves the power of Solar Beam", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_SANDSTORM; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BEAM); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Sandstorm halves the power of Solar Blade", s16 damage) +{ + u16 move; + KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_SANDSTORM; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BLADE); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Sandstorm causes Moonlight to recover 1/4 of the user's max HP") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_MOONLIGHT].effect == EFFECT_MOONLIGHT); + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SANDSTORM); MOVE(player, MOVE_MOONLIGHT); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Sandstorm causes Synthesis to recover 1/4 of the user's max HP") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_SYNTHESIS].effect == EFFECT_SYNTHESIS); + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SANDSTORM); MOVE(player, MOVE_SYNTHESIS); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Sandstorm causes Morning Sun to recover 1/4 of the user's max HP") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN); + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SANDSTORM); MOVE(player, MOVE_MORNING_SUN); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} diff --git a/test/battle/weather/snow.c b/test/battle/weather/snow.c index 1e8cb62cb37e..6facfce7cf31 100644 --- a/test/battle/weather/snow.c +++ b/test/battle/weather/snow.c @@ -8,7 +8,7 @@ ASSUMPTIONS ASSUME(gSpeciesInfo[SPECIES_GLALIE].types[0] == TYPE_ICE || gSpeciesInfo[SPECIES_GLALIE].types[1] == TYPE_ICE); } -SINGLE_BATTLE_TEST("Snow increases the defense of Ice types by 50 %", s16 damage) +SINGLE_BATTLE_TEST("Snow multiplies the defense of Ice-types by 1.5x", s16 damage) { u16 move; PARAMETRIZE{ move = MOVE_SNOWSCAPE; } @@ -111,41 +111,40 @@ SINGLE_BATTLE_TEST("Snow causes Moonlight to recover 1/4 of the user's max HP") } } -SINGLE_BATTLE_TEST("Snow causes Moonlight to recover 1/4 of the user's max HP") +SINGLE_BATTLE_TEST("Snow causes Synthesis to recover 1/4 of the user's max HP") { GIVEN { - ASSUME(gBattleMoves[MOVE_MOONLIGHT].effect == EFFECT_MOONLIGHT); + ASSUME(gBattleMoves[MOVE_SYNTHESIS].effect == EFFECT_SYNTHESIS); PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } OPPONENT(SPECIES_WOBBUFFET); } WHEN { - TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_MOONLIGHT); } + TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_SYNTHESIS); } } SCENE { HP_BAR(player, damage: -(400 / 4)); } } -SINGLE_BATTLE_TEST("Snow causes Synthesis to recover 1/4 of the user's max HP") +SINGLE_BATTLE_TEST("Snow causes Morning Sun to recover 1/4 of the user's max HP") { GIVEN { - ASSUME(gBattleMoves[MOVE_SYNTHESIS].effect == EFFECT_SYNTHESIS); + ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN); PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } OPPONENT(SPECIES_WOBBUFFET); } WHEN { - TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_SYNTHESIS); } + TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_MORNING_SUN); } } SCENE { HP_BAR(player, damage: -(400 / 4)); } } -SINGLE_BATTLE_TEST("Snow causes Morning Sun to recover 1/4 of the user's max HP") +SINGLE_BATTLE_TEST("Snow allows Aurora Veil to be used") { GIVEN { - ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { - TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_MORNING_SUN); } + TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_AURORA_VEIL); } } SCENE { - HP_BAR(player, damage: -(400 / 4)); + NOT MESSAGE("But it failed!"); } -} +} \ No newline at end of file diff --git a/test/battle/weather/sunlight.c b/test/battle/weather/sunlight.c index 9d471332ad69..63309e04195d 100644 --- a/test/battle/weather/sunlight.c +++ b/test/battle/weather/sunlight.c @@ -1,7 +1,6 @@ #include "global.h" #include "test/battle.h" -// Please add Sunlight interactions with move, item and ability effects on their respective files. ASSUMPTIONS { ASSUME(gBattleMoves[MOVE_EMBER].type == TYPE_FIRE); @@ -45,3 +44,130 @@ SINGLE_BATTLE_TEST("Sunlight multiplies the power of Water-type moves by 0.5x", EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); } } + +SINGLE_BATTLE_TEST("Sunlight turns Weather Ball to a Fire-type move and doubles its power", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_SUNNY_DAY; } + GIVEN { + ASSUME(gBattleMoves[MOVE_WEATHER_BALL].effect == EFFECT_WEATHER_BALL); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_MEGANIUM); + } WHEN { + TURN { MOVE(player, move); } + TURN { MOVE(player, MOVE_WEATHER_BALL); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(6.0), results[1].damage); // double base power + type effectiveness + sun 50% boost + } +} + +SINGLE_BATTLE_TEST("Sunlight allows Solar Beam to be used instantly") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_SOLAR_BEAM); } + } SCENE { + NOT MESSAGE("Wobbuffet took in sunlight!"); + } +} + +SINGLE_BATTLE_TEST("Sunlight allows Solar Blade to be used instantly") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_SOLAR_BLADE); } + } SCENE { + NOT MESSAGE("Wobbuffet took in sunlight!"); + } +} + +SINGLE_BATTLE_TEST("Sunlight prevents being frozen") +{ + PASSES_RANDOMLY(100, 100, RNG_ACCURACY); //should freeze 10 times if no sun, but never under sun + 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("Sunlight causes Moonlight to recover 2/3 of the user's max HP") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_MOONLIGHT].effect == EFFECT_MOONLIGHT); + 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: -200); + } +} + +SINGLE_BATTLE_TEST("Sunlight causes Synthesis to recover 2/3 of the user's max HP") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_SYNTHESIS].effect == EFFECT_SYNTHESIS); + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(300); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_SYNTHESIS); } + } SCENE { + HP_BAR(player, damage: -200); + } +} + +SINGLE_BATTLE_TEST("Sunlight causes Morning Sun to recover 2/3 of the user's max HP") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN); + 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: -200); + } +} + +SINGLE_BATTLE_TEST("Sunlight lowers accuracy of Thunder to 50%") +{ + PASSES_RANDOMLY(50, 100, RNG_ACCURACY); + GIVEN { + ASSUME(gBattleMoves[MOVE_THUNDER].accuracy == 70); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_SUNNY_DAY); MOVE(opponent, MOVE_THUNDER); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_THUNDER, opponent); + } +} + +SINGLE_BATTLE_TEST("Sunlight lowers accuracy of Hurricane to 50%") +{ + PASSES_RANDOMLY(50, 100, RNG_ACCURACY); + GIVEN { + ASSUME(gBattleMoves[MOVE_HURRICANE].accuracy == 70); + 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); + } +} + +TO_DO_BATTLE_TEST("Sunlight guarantees Harvest will restore a held berry"); \ No newline at end of file From 8403b16052b42f18e45b45e418801c4e4504f227 Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Mon, 28 Aug 2023 16:27:04 -0500 Subject: [PATCH 02/14] Restructure some things --- .../{type/dark.c => ability/prankster.c} | 2 +- test/battle/move_effect/burn_hit.c | 18 ++- test/battle/move_effect/freeze_hit.c | 53 ++++++++ test/battle/move_effect/leech_seed.c | 22 +++ test/battle/move_effect/ohko.c | 22 +++ test/battle/move_effect/paralyze_hit.c | 19 ++- test/battle/move_effect/poison_hit.c | 32 +++++ test/battle/move_effect/toxic_spikes.c | 60 ++++++++- test/battle/move_effect/weather_ball.c | 97 +++++++++++++ test/battle/move_flags/powder.c | 17 +++ test/battle/type/electric.c | 19 --- test/battle/type/fire.c | 18 --- test/battle/type/ghost.c | 18 --- test/battle/type/grass.c | 32 ----- test/battle/type/ground.c | 15 --- test/battle/type/ice.c | 46 ------- test/battle/type/poison.c | 77 ----------- test/battle/type/rock.c | 15 --- test/battle/type/steel.c | 31 ----- test/battle/weather/hail.c | 120 +---------------- test/battle/weather/rain.c | 125 ----------------- test/battle/weather/sandstorm.c | 90 +++---------- test/battle/weather/snow.c | 123 ----------------- test/battle/weather/sunlight.c | 127 +----------------- 24 files changed, 360 insertions(+), 838 deletions(-) rename test/battle/{type/dark.c => ability/prankster.c} (81%) create mode 100644 test/battle/move_effect/leech_seed.c create mode 100644 test/battle/move_effect/ohko.c create mode 100644 test/battle/move_effect/weather_ball.c create mode 100644 test/battle/move_flags/powder.c delete mode 100644 test/battle/type/electric.c delete mode 100644 test/battle/type/fire.c delete mode 100644 test/battle/type/ghost.c delete mode 100644 test/battle/type/grass.c delete mode 100644 test/battle/type/ground.c delete mode 100644 test/battle/type/ice.c delete mode 100644 test/battle/type/poison.c delete mode 100644 test/battle/type/rock.c delete mode 100644 test/battle/type/steel.c diff --git a/test/battle/type/dark.c b/test/battle/ability/prankster.c similarity index 81% rename from test/battle/type/dark.c rename to test/battle/ability/prankster.c index a990bab0fa8e..31eefeff826b 100644 --- a/test/battle/type/dark.c +++ b/test/battle/ability/prankster.c @@ -1,7 +1,7 @@ #include "global.h" #include "test/battle.h" -SINGLE_BATTLE_TEST("Dark-type Pokémon are immune to moves that gain priority due to Prankster") +SINGLE_BATTLE_TEST("Prankster priority moves don't affect Dark-type Pokémon") { GIVEN { ASSUME(gSpeciesInfo[SPECIES_UMBREON].types[0] == TYPE_DARK); diff --git a/test/battle/move_effect/burn_hit.c b/test/battle/move_effect/burn_hit.c index c9919583ad8f..9bcb36bb8702 100644 --- a/test/battle/move_effect/burn_hit.c +++ b/test/battle/move_effect/burn_hit.c @@ -19,4 +19,20 @@ SINGLE_BATTLE_TEST("Ember inflicts burn") ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponent); STATUS_ICON(opponent, burn: TRUE); } -} \ No newline at end of file +} + +SINGLE_BATTLE_TEST("Burn cannot be inflicted on Fire-type Pokémon") +{ + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_CHARMANDER].types[0] == TYPE_FIRE); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_CHARMANDER); + } WHEN { + TURN { MOVE(player, MOVE_EMBER); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_EMBER, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponent); + NOT STATUS_ICON(opponent, burn: TRUE); + } +} diff --git a/test/battle/move_effect/freeze_hit.c b/test/battle/move_effect/freeze_hit.c index d706f844f5e8..cff1d8d615f4 100644 --- a/test/battle/move_effect/freeze_hit.c +++ b/test/battle/move_effect/freeze_hit.c @@ -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") @@ -19,4 +20,56 @@ SINGLE_BATTLE_TEST("Powder Snow inflicts freeze") ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_FRZ, opponent); STATUS_ICON(opponent, freeze: TRUE); } +} + +SINGLE_BATTLE_TEST("Freeze cannot be inflicted on Ice-type Pokémon") +{ + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_GLALIE].types[0] == TYPE_ICE); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_GLALIE); + } WHEN { + TURN { MOVE(player, MOVE_POWDER_SNOW); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_POWDER_SNOW, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_FRZ, opponent); + 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") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_BLIZZARD); } + } SCENE { + NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } + } +} + +SINGLE_BATTLE_TEST("Blizzard bypasses accuracy checks in Snow") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_BLIZZARD); } + } SCENE { + NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } + } } \ No newline at end of file diff --git a/test/battle/move_effect/leech_seed.c b/test/battle/move_effect/leech_seed.c new file mode 100644 index 000000000000..c3744f115cf9 --- /dev/null +++ b/test/battle/move_effect/leech_seed.c @@ -0,0 +1,22 @@ +#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…"); + } +} \ No newline at end of file diff --git a/test/battle/move_effect/ohko.c b/test/battle/move_effect/ohko.c new file mode 100644 index 000000000000..9d5457d622fb --- /dev/null +++ b/test/battle/move_effect/ohko.c @@ -0,0 +1,22 @@ +#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…"); + } +} diff --git a/test/battle/move_effect/paralyze_hit.c b/test/battle/move_effect/paralyze_hit.c index 04a2ef0e9d98..ec103c4ba4c8 100644 --- a/test/battle/move_effect/paralyze_hit.c +++ b/test/battle/move_effect/paralyze_hit.c @@ -19,4 +19,21 @@ SINGLE_BATTLE_TEST("Thunder Shock inflicts paralysis") ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PRZ, opponent); STATUS_ICON(opponent, paralysis: TRUE); } -} \ No newline at end of file +} + +SINGLE_BATTLE_TEST("Paralysis cannot be inflicted on Electric-type Pokémon") +{ + GIVEN { + ASSUME(B_PARALYZE_ELECTRIC >= GEN_6); + ASSUME(gSpeciesInfo[SPECIES_PIKACHU].types[0] == TYPE_ELECTRIC); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_PIKACHU); + } WHEN { + TURN { MOVE(player, MOVE_THUNDER_SHOCK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_THUNDER_SHOCK, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PRZ, opponent); + NOT STATUS_ICON(opponent, paralysis: TRUE); + } +} diff --git a/test/battle/move_effect/poison_hit.c b/test/battle/move_effect/poison_hit.c index b7f498a46ec7..afc6ef40ccb2 100644 --- a/test/battle/move_effect/poison_hit.c +++ b/test/battle/move_effect/poison_hit.c @@ -20,4 +20,36 @@ SINGLE_BATTLE_TEST("Poison Sting inflicts poison") ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); STATUS_ICON(opponent, poison: TRUE); } +} + +SINGLE_BATTLE_TEST("Poison cannot be inflicted on Poison-type Pokémon") +{ + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_NIDORAN_M].types[0] == TYPE_POISON); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_NIDORAN_M); + } WHEN { + TURN { MOVE(player, MOVE_POISON_STING); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_POISON_STING, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); + NOT STATUS_ICON(opponent, poison: TRUE); + } +} + +SINGLE_BATTLE_TEST("Poison cannot be inflicted on Steel-type Pokémon") +{ + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_REGISTEEL].types[0] == TYPE_STEEL); + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_POISON_BARB); }; + OPPONENT(SPECIES_REGISTEEL); + } WHEN { + TURN { MOVE(player, MOVE_FLING); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_FLING, player); + HP_BAR(opponent); + NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); + NOT STATUS_ICON(opponent, poison: TRUE); + } } \ No newline at end of file diff --git a/test/battle/move_effect/toxic_spikes.c b/test/battle/move_effect/toxic_spikes.c index c7f11797660b..a2342a542231 100644 --- a/test/battle/move_effect/toxic_spikes.c +++ b/test/battle/move_effect/toxic_spikes.c @@ -149,4 +149,62 @@ SINGLE_BATTLE_TEST("Toxic Spikes do not affect Steel-types") } SCENE { NOT STATUS_ICON(opponent, poison: TRUE); } -} \ No newline at end of file +} + +SINGLE_BATTLE_TEST("Toxic Spikes are removed by grounded Poison-type Pokémon on switch in") +{ + u32 species; + u32 item = ITEM_NONE; + u32 move = MOVE_CELEBRATE; + bool32 grounded; + PARAMETRIZE { species = SPECIES_EKANS; grounded = TRUE; } + PARAMETRIZE { species = SPECIES_ZUBAT; grounded = FALSE; } + PARAMETRIZE { species = SPECIES_ZUBAT; item = ITEM_IRON_BALL; grounded = TRUE; } + PARAMETRIZE { species = SPECIES_ZUBAT; move = MOVE_GRAVITY; grounded = TRUE; } + PARAMETRIZE { species = SPECIES_ZUBAT; move = MOVE_INGRAIN; grounded = TRUE; } + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_EKANS].types[0] == TYPE_POISON); + ASSUME(gSpeciesInfo[SPECIES_ZUBAT].types[0] == TYPE_POISON); + ASSUME(gSpeciesInfo[SPECIES_ZUBAT].types[1] == TYPE_FLYING); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(species) { Item(item); } + } WHEN { + TURN { MOVE(player, MOVE_TOXIC_SPIKES); MOVE(opponent, move); } + TURN { MOVE(opponent, MOVE_BATON_PASS); SEND_OUT(opponent, 1); } + TURN { SWITCH(opponent, 0); } + } SCENE { + if (grounded) { + NOT STATUS_ICON(opponent, poison: TRUE); + MESSAGE("The poison spikes disappeared from around the opposing team's feet!"); + NOT STATUS_ICON(opponent, poison: TRUE); + } else { + NOT STATUS_ICON(opponent, poison: TRUE); + ANIMATION(ANIM_TYPE_MOVE, MOVE_BATON_PASS, opponent); + STATUS_ICON(opponent, poison: TRUE); + } + } +} + +// This would test for what I believe to be a bug in the mainline games. +// A Pokémon that gets passed magnet rise should still remove the Toxic +// Spikes even though it is airborne. +// The test currently fails, because we don't incorporate this bug. +SINGLE_BATTLE_TEST("Toxic Spikes are removed by Poison-type Pokémon affected by Magnet Rise on switch in") +{ + KNOWN_FAILING; + GIVEN { + ASSUME(gSpeciesInfo[SPECIES_EKANS].types[0] == TYPE_POISON); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_EKANS); + } WHEN { + TURN { MOVE(opponent, MOVE_MAGNET_RISE); } + TURN { MOVE(player, MOVE_TOXIC_SPIKES); MOVE(opponent, MOVE_BATON_PASS); SEND_OUT(opponent, 1); } + TURN { SWITCH(opponent, 0); } + } SCENE { + NOT STATUS_ICON(opponent, poison: TRUE); + MESSAGE("The poison spikes disappeared from around the opposing team's feet!"); + NOT STATUS_ICON(opponent, poison: TRUE); + } +} diff --git a/test/battle/move_effect/weather_ball.c b/test/battle/move_effect/weather_ball.c new file mode 100644 index 000000000000..8495bc978deb --- /dev/null +++ b/test/battle/move_effect/weather_ball.c @@ -0,0 +1,97 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_WEATHER_BALL].effect == EFFECT_WEATHER_BALL); +} + +SINGLE_BATTLE_TEST("Weather Ball doubles its power and turns to a Fire-type move in Sunlight", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_SUNNY_DAY; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_MEGANIUM); + } WHEN { + TURN { MOVE(player, move); } + TURN { MOVE(player, MOVE_WEATHER_BALL); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(6.0), results[1].damage); // double base power + type effectiveness + sun 50% boost + } +} + +SINGLE_BATTLE_TEST("Weather Ball doubles its power and turns to a Water-type move in Rain", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_RAIN_DANCE; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_ARCANINE); + } WHEN { + TURN { MOVE(player, move); } + TURN { MOVE(player, MOVE_WEATHER_BALL); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(6.0), results[1].damage); // double base power + type effectiveness + rain 50% boost + } +} + +SINGLE_BATTLE_TEST("Weather Ball doubles its power and turns to a Rock-type move in a Sandstorm", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_SANDSTORM; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_MAGMAR) { Item(ITEM_SAFETY_GOGGLES); }; + } WHEN { + TURN { MOVE(player, move); } + TURN { MOVE(player, MOVE_WEATHER_BALL); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(4.0), results[1].damage); // double base power + type effectiveness. + } +} + +SINGLE_BATTLE_TEST("Weather Ball doubles its power and turns to an Ice-type move in Hail", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_HAIL; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_DRAGONAIR) { Item(ITEM_SAFETY_GOGGLES); }; + } WHEN { + TURN { MOVE(player, move); } + TURN { MOVE(player, MOVE_WEATHER_BALL); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(4.0), results[1].damage); // double base power + type effectiveness. + } +} + +SINGLE_BATTLE_TEST("Weather Ball doubles its power and turns to an Ice-type move in Snow", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_SNOWSCAPE; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_DRAGONAIR); + } WHEN { + TURN { MOVE(player, move); } + TURN { MOVE(player, MOVE_WEATHER_BALL); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(4.0), results[1].damage); // double base power + type effectiveness. + } +} \ No newline at end of file diff --git a/test/battle/move_flags/powder.c b/test/battle/move_flags/powder.c new file mode 100644 index 000000000000..1cb41371f6ad --- /dev/null +++ b/test/battle/move_flags/powder.c @@ -0,0 +1,17 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Powder moves are blocked by Grass-type Pokémon") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER); + ASSUME(gSpeciesInfo[SPECIES_ODDISH].types[0] == TYPE_GRASS); + PLAYER(SPECIES_WYNAUT); + OPPONENT(SPECIES_ODDISH); + } WHEN { + TURN { MOVE(player, MOVE_STUN_SPORE); } + } SCENE { + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_STUN_SPORE, player); + MESSAGE("It doesn't affect Foe Oddish…"); + } +} \ No newline at end of file diff --git a/test/battle/type/electric.c b/test/battle/type/electric.c deleted file mode 100644 index 5443808d8133..000000000000 --- a/test/battle/type/electric.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -SINGLE_BATTLE_TEST("Electric-type Pokémon cannot be paralyzed") -{ - GIVEN { - ASSUME(B_PARALYZE_ELECTRIC >= GEN_6); - ASSUME(gSpeciesInfo[SPECIES_PIKACHU].types[0] == TYPE_ELECTRIC); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_PIKACHU); - } WHEN { - TURN { MOVE(player, MOVE_THUNDER_SHOCK); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_THUNDER_SHOCK, player); - HP_BAR(opponent); - NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PRZ, opponent); - NOT STATUS_ICON(opponent, paralysis: TRUE); - } -} diff --git a/test/battle/type/fire.c b/test/battle/type/fire.c deleted file mode 100644 index 483999c8d94a..000000000000 --- a/test/battle/type/fire.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -SINGLE_BATTLE_TEST("Fire-type Pokémon cannot be burned") -{ - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_CHARMANDER].types[0] == TYPE_FIRE); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_CHARMANDER); - } WHEN { - TURN { MOVE(player, MOVE_EMBER); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_EMBER, player); - HP_BAR(opponent); - NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponent); - NOT STATUS_ICON(opponent, burn: TRUE); - } -} diff --git a/test/battle/type/ghost.c b/test/battle/type/ghost.c deleted file mode 100644 index 600a71205b24..000000000000 --- a/test/battle/type/ghost.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -SINGLE_BATTLE_TEST("Ghost-type Pokémon can bypass effects that prevent recall or escape") -{ - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_GENGAR].types[0] == TYPE_GHOST); - PLAYER(SPECIES_GENGAR); - PLAYER(SPECIES_WYNAUT); - OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_SHADOW_TAG); } - } WHEN { - TURN { SWITCH(player, 1); } - } SCENE { - NOT MESSAGE("Foe Wobbuffet prevents escape with Shadow Tag!"); - } -} - -TO_DO_BATTLE_TEST("Ghost-type Pokémon are guaranteed to flee from any wild battle regardless of Speed") \ No newline at end of file diff --git a/test/battle/type/grass.c b/test/battle/type/grass.c deleted file mode 100644 index 32c1c78b3611..000000000000 --- a/test/battle/type/grass.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -SINGLE_BATTLE_TEST("Grass-type Pokémon block powder and spore moves") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER); - ASSUME(gSpeciesInfo[SPECIES_ODDISH].types[0] == TYPE_GRASS); - PLAYER(SPECIES_WYNAUT); - OPPONENT(SPECIES_ODDISH); - } WHEN { - TURN { MOVE(player, MOVE_STUN_SPORE); } - } SCENE { - NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_STUN_SPORE, player); - MESSAGE("It doesn't affect Foe Oddish…"); - } -} - -SINGLE_BATTLE_TEST("Grass-type Pokémon are immune to Leech Seed") -{ - 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…"); - } -} \ No newline at end of file diff --git a/test/battle/type/ground.c b/test/battle/type/ground.c deleted file mode 100644 index 2d697c80ffcc..000000000000 --- a/test/battle/type/ground.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -SINGLE_BATTLE_TEST("Ground-type Pokémon are immune to Sandstorm damage") -{ - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_SANDSLASH].types[0] == TYPE_GROUND); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_SANDSLASH); - } WHEN { - TURN {MOVE(player, MOVE_SANDSTORM);} - } SCENE { - NOT MESSAGE("Foe Sandslash is buffeted by the sandstorm!"); - } -} \ No newline at end of file diff --git a/test/battle/type/ice.c b/test/battle/type/ice.c deleted file mode 100644 index fdcc1c892291..000000000000 --- a/test/battle/type/ice.c +++ /dev/null @@ -1,46 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -SINGLE_BATTLE_TEST("Ice-type Pokémon are immune to Hail damage") -{ - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_GLALIE].types[0] == TYPE_ICE); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_GLALIE); - } WHEN { - TURN {MOVE(player, MOVE_HAIL);} - } SCENE { - NOT MESSAGE("Foe Glalie is pelted by HAIL!"); - } -} - -SINGLE_BATTLE_TEST("Ice-type Pokémon cannot be frozen") -{ - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_GLALIE].types[0] == TYPE_ICE); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_GLALIE); - } WHEN { - TURN { MOVE(player, MOVE_POWDER_SNOW); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_POWDER_SNOW, player); - HP_BAR(opponent); - NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_FRZ, opponent); - NOT STATUS_ICON(opponent, freeze: TRUE); - } -} - -SINGLE_BATTLE_TEST("Ice-type Pokémon are immune to Sheer Cold") -{ - 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…"); - } -} diff --git a/test/battle/type/poison.c b/test/battle/type/poison.c deleted file mode 100644 index 0d4ec9515f9d..000000000000 --- a/test/battle/type/poison.c +++ /dev/null @@ -1,77 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -SINGLE_BATTLE_TEST("Poison-type Pokémon cannot be poisoned") -{ - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_NIDORAN_M].types[0] == TYPE_POISON); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_NIDORAN_M); - } WHEN { - TURN { MOVE(player, MOVE_POISON_STING); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_POISON_STING, player); - HP_BAR(opponent); - NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); - NOT STATUS_ICON(opponent, poison: TRUE); - } -} - - -SINGLE_BATTLE_TEST("Poison-type Pokémon remove Toxic Spikes on switch in if grounded") -{ - u32 species; - u32 item = ITEM_NONE; - u32 move = MOVE_CELEBRATE; - bool32 grounded; - PARAMETRIZE { species = SPECIES_EKANS; grounded = TRUE; } - PARAMETRIZE { species = SPECIES_ZUBAT; grounded = FALSE; } - PARAMETRIZE { species = SPECIES_ZUBAT; item = ITEM_IRON_BALL; grounded = TRUE; } - PARAMETRIZE { species = SPECIES_ZUBAT; move = MOVE_GRAVITY; grounded = TRUE; } - PARAMETRIZE { species = SPECIES_ZUBAT; move = MOVE_INGRAIN; grounded = TRUE; } - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_EKANS].types[0] == TYPE_POISON); - ASSUME(gSpeciesInfo[SPECIES_ZUBAT].types[0] == TYPE_POISON); - ASSUME(gSpeciesInfo[SPECIES_ZUBAT].types[1] == TYPE_FLYING); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - OPPONENT(species) { Item(item); } - } WHEN { - TURN { MOVE(player, MOVE_TOXIC_SPIKES); MOVE(opponent, move); } - TURN { MOVE(opponent, MOVE_BATON_PASS); SEND_OUT(opponent, 1); } - TURN { SWITCH(opponent, 0); } - } SCENE { - if (grounded) { - NOT STATUS_ICON(opponent, poison: TRUE); - MESSAGE("The poison spikes disappeared from around the opposing team's feet!"); - NOT STATUS_ICON(opponent, poison: TRUE); - } else { - NOT STATUS_ICON(opponent, poison: TRUE); - ANIMATION(ANIM_TYPE_MOVE, MOVE_BATON_PASS, opponent); - STATUS_ICON(opponent, poison: TRUE); - } - } -} - -// This would test for what I believe to be a bug in the mainline games. -// A Pokémon that gets passed magnet rise should still remove the Toxic -// Spikes even though it is airborne. -// The test currently fails, because we don't incorporate this bug. -SINGLE_BATTLE_TEST("Poison-type Pokémon remove Toxic Spikes on switch in if affected by Magnet Rise") -{ - KNOWN_FAILING; - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_EKANS].types[0] == TYPE_POISON); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_EKANS); - } WHEN { - TURN { MOVE(opponent, MOVE_MAGNET_RISE); } - TURN { MOVE(player, MOVE_TOXIC_SPIKES); MOVE(opponent, MOVE_BATON_PASS); SEND_OUT(opponent, 1); } - TURN { SWITCH(opponent, 0); } - } SCENE { - NOT STATUS_ICON(opponent, poison: TRUE); - MESSAGE("The poison spikes disappeared from around the opposing team's feet!"); - NOT STATUS_ICON(opponent, poison: TRUE); - } -} diff --git a/test/battle/type/rock.c b/test/battle/type/rock.c deleted file mode 100644 index ac73b3fe962b..000000000000 --- a/test/battle/type/rock.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -SINGLE_BATTLE_TEST("Rock-type Pokémon are immune to Sandstorm damage") -{ - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_NOSEPASS].types[0] == TYPE_ROCK); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_NOSEPASS); - } WHEN { - TURN {MOVE(player, MOVE_SANDSTORM);} - } SCENE { - NOT MESSAGE("Foe Nosepass is buffeted by the sandstorm!"); - } -} \ No newline at end of file diff --git a/test/battle/type/steel.c b/test/battle/type/steel.c deleted file mode 100644 index f86f0198ec61..000000000000 --- a/test/battle/type/steel.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -SINGLE_BATTLE_TEST("Steel-type Pokémon cannot be poisoned") -{ - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_REGISTEEL].types[0] == TYPE_STEEL); - PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_POISON_BARB); }; - OPPONENT(SPECIES_REGISTEEL); - } WHEN { - TURN { MOVE(player, MOVE_FLING); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_FLING, player); - HP_BAR(opponent); - NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); - NOT STATUS_ICON(opponent, poison: TRUE); - } -} - -SINGLE_BATTLE_TEST("Steel-type Pokémon are immune to Sandstorm damage") -{ - GIVEN { - ASSUME(gSpeciesInfo[SPECIES_REGISTEEL].types[0] == TYPE_STEEL); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_REGISTEEL); - } WHEN { - TURN {MOVE(player, MOVE_SANDSTORM);} - } SCENE { - NOT MESSAGE("Foe Registeel is buffeted by the sandstorm!"); - } -} \ No newline at end of file diff --git a/test/battle/weather/hail.c b/test/battle/weather/hail.c index a6f584c4ae70..11113e237711 100644 --- a/test/battle/weather/hail.c +++ b/test/battle/weather/hail.c @@ -16,125 +16,15 @@ SINGLE_BATTLE_TEST("Hail deals 1/16 damage per turn") } THEN { EXPECT_EQ(hailDamage, opponent->maxHP / 16); } } -SINGLE_BATTLE_TEST("Hail turns Weather Ball to an Ice-type move and doubles its power", s16 damage) +SINGLE_BATTLE_TEST("Hail damage does not affect Ice-type Pokémon") { - u16 move; - PARAMETRIZE{ move = MOVE_CELEBRATE; } - PARAMETRIZE{ move = MOVE_HAIL; } GIVEN { - ASSUME(gBattleMoves[MOVE_WEATHER_BALL].effect == EFFECT_WEATHER_BALL); + ASSUME(gSpeciesInfo[SPECIES_GLALIE].types[0] == TYPE_ICE); PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_DRAGONAIR) { Item(ITEM_SAFETY_GOGGLES); }; + OPPONENT(SPECIES_GLALIE); } WHEN { - TURN { MOVE(player, move); } - TURN { MOVE(player, MOVE_WEATHER_BALL); } - } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(4.0), results[1].damage); // double base power + type effectiveness. - } -} - -SINGLE_BATTLE_TEST("Hail allows Blizzard to bypass accuracy checks") -{ - PASSES_RANDOMLY(100, 100, RNG_ACCURACY); - GIVEN { - ASSUME(gBattleMoves[MOVE_BLIZZARD].accuracy == 70); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_BLIZZARD); } - } SCENE { - NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } - } -} - -SINGLE_BATTLE_TEST("Hail halves the power of Solar Beam", s16 damage) -{ - u16 move; - PARAMETRIZE{ move = MOVE_CELEBRATE; } - PARAMETRIZE{ move = MOVE_HAIL; } - GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; - } WHEN { - TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BEAM); } - TURN { SKIP_TURN(player); } - } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); - } -} - -SINGLE_BATTLE_TEST("Hail halves the power of Solar Blade", s16 damage) -{ - u16 move; - KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line - PARAMETRIZE{ move = MOVE_CELEBRATE; } - PARAMETRIZE{ move = MOVE_HAIL; } - GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; - } WHEN { - TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BLADE); } - TURN { SKIP_TURN(player); } - } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); - } -} - -SINGLE_BATTLE_TEST("Hail causes Moonlight to recover 1/4 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_MOONLIGHT].effect == EFFECT_MOONLIGHT); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_MOONLIGHT); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Hail causes Synthesis to recover 1/4 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_SYNTHESIS].effect == EFFECT_SYNTHESIS); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_SYNTHESIS); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Hail causes Morning Sun to recover 1/4 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_MORNING_SUN); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Hail allows Aurora Veil to be used") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_AURORA_VEIL); } + TURN {MOVE(player, MOVE_HAIL);} } SCENE { - NOT MESSAGE("But it failed!"); + NOT MESSAGE("Foe Glalie is pelted by HAIL!"); } } \ No newline at end of file diff --git a/test/battle/weather/rain.c b/test/battle/weather/rain.c index 0da324b1b481..a38474a8d58c 100644 --- a/test/battle/weather/rain.c +++ b/test/battle/weather/rain.c @@ -43,129 +43,4 @@ SINGLE_BATTLE_TEST("Rain multiplies the power of Water-type moves by 1.5x", s16 } FINALLY { EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); } -} - -SINGLE_BATTLE_TEST("Rain turns Weather Ball to a Water-type move and doubles its power", s16 damage) -{ - u16 move; - PARAMETRIZE{ move = MOVE_CELEBRATE; } - PARAMETRIZE{ move = MOVE_RAIN_DANCE; } - GIVEN { - ASSUME(gBattleMoves[MOVE_WEATHER_BALL].effect == EFFECT_WEATHER_BALL); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_ARCANINE); - } WHEN { - TURN { MOVE(player, move); } - TURN { MOVE(player, MOVE_WEATHER_BALL); } - } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(6.0), results[1].damage); // double base power + type effectiveness + rain 50% boost - } -} - -SINGLE_BATTLE_TEST("Rain allows Thunder to bypass accuracy checks") -{ - PASSES_RANDOMLY(100, 100, RNG_ACCURACY); - GIVEN { - ASSUME(gBattleMoves[MOVE_THUNDER].accuracy == 70); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_RAIN_DANCE); MOVE(player, MOVE_THUNDER); } - } SCENE { - NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } - } -} - -SINGLE_BATTLE_TEST("Rain allows Hurricane to bypass accuracy checks") -{ - PASSES_RANDOMLY(100, 100, RNG_ACCURACY); - GIVEN { - ASSUME(gBattleMoves[MOVE_HURRICANE].accuracy == 70); - 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!"); } - } -} - -SINGLE_BATTLE_TEST("Rain halves the power of Solar Beam", s16 damage) -{ - u16 move; - PARAMETRIZE{ move = MOVE_CELEBRATE; } - PARAMETRIZE{ move = MOVE_RAIN_DANCE; } - GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BEAM); } - TURN { SKIP_TURN(player); } - } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); - } -} - -SINGLE_BATTLE_TEST("Rain halves the power of Solar Blade", s16 damage) -{ - u16 move; - KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line - PARAMETRIZE{ move = MOVE_CELEBRATE; } - PARAMETRIZE{ move = MOVE_RAIN_DANCE; } - GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WYNAUT); - } WHEN { - TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BLADE); } - TURN { SKIP_TURN(player); } - } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); - } -} - -SINGLE_BATTLE_TEST("Rain causes Moonlight to recover 1/4 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_MOONLIGHT].effect == EFFECT_MOONLIGHT); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_RAIN_DANCE); MOVE(player, MOVE_MOONLIGHT); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Rain causes Synthesis to recover 1/4 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_SYNTHESIS].effect == EFFECT_SYNTHESIS); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_RAIN_DANCE); MOVE(player, MOVE_SYNTHESIS); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Rain causes Morning Sun to recover 1/4 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_RAIN_DANCE); MOVE(player, MOVE_MORNING_SUN); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } } \ No newline at end of file diff --git a/test/battle/weather/sandstorm.c b/test/battle/weather/sandstorm.c index 1e7bb263d774..7b8a6082473e 100644 --- a/test/battle/weather/sandstorm.c +++ b/test/battle/weather/sandstorm.c @@ -34,99 +34,41 @@ SINGLE_BATTLE_TEST("Sandstorm multiplies the special defense of Rock-types by 1. } } -SINGLE_BATTLE_TEST("Sandstorm turns Weather Ball to a Rock-type move and doubles its power", s16 damage) +SINGLE_BATTLE_TEST("Sandstorm damage does not hurt Ground-type Pokémon") { - u16 move; - PARAMETRIZE{ move = MOVE_CELEBRATE; } - PARAMETRIZE{ move = MOVE_SANDSTORM; } GIVEN { - ASSUME(gBattleMoves[MOVE_WEATHER_BALL].effect == EFFECT_WEATHER_BALL); + ASSUME(gSpeciesInfo[SPECIES_SANDSLASH].types[0] == TYPE_GROUND); PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_MAGMAR) { Item(ITEM_SAFETY_GOGGLES); }; //sandstorm damage throws the calculation off so i have to give safety goggles + OPPONENT(SPECIES_SANDSLASH); } WHEN { - TURN { MOVE(player, move); } - TURN { MOVE(player, MOVE_WEATHER_BALL); } + TURN {MOVE(player, MOVE_SANDSTORM);} } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(4.0), results[1].damage); // double base power + type effectiveness. + NOT MESSAGE("Foe Sandslash is buffeted by the sandstorm!"); } } -SINGLE_BATTLE_TEST("Sandstorm halves the power of Solar Beam", s16 damage) +SINGLE_BATTLE_TEST("Sandstorm damage does not hurt Rock-type Pokémon") { - u16 move; - PARAMETRIZE{ move = MOVE_CELEBRATE; } - PARAMETRIZE{ move = MOVE_SANDSTORM; } GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); + ASSUME(gSpeciesInfo[SPECIES_NOSEPASS].types[0] == TYPE_ROCK); PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; + OPPONENT(SPECIES_NOSEPASS); } WHEN { - TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BEAM); } - TURN { SKIP_TURN(player); } + TURN {MOVE(player, MOVE_SANDSTORM);} } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + NOT MESSAGE("Foe Nosepass is buffeted by the sandstorm!"); } } -SINGLE_BATTLE_TEST("Sandstorm halves the power of Solar Blade", s16 damage) +SINGLE_BATTLE_TEST("Sandstorm damage does not hurt Steel-type Pokémon") { - u16 move; - KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line - PARAMETRIZE{ move = MOVE_CELEBRATE; } - PARAMETRIZE{ move = MOVE_SANDSTORM; } GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); + ASSUME(gSpeciesInfo[SPECIES_REGISTEEL].types[0] == TYPE_STEEL); PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; - } WHEN { - TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BLADE); } - TURN { SKIP_TURN(player); } - } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); - } -} - -SINGLE_BATTLE_TEST("Sandstorm causes Moonlight to recover 1/4 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_MOONLIGHT].effect == EFFECT_MOONLIGHT); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SANDSTORM); MOVE(player, MOVE_MOONLIGHT); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Sandstorm causes Synthesis to recover 1/4 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_SYNTHESIS].effect == EFFECT_SYNTHESIS); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_REGISTEEL); } WHEN { - TURN { MOVE(opponent, MOVE_SANDSTORM); MOVE(player, MOVE_SYNTHESIS); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Sandstorm causes Morning Sun to recover 1/4 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SANDSTORM); MOVE(player, MOVE_MORNING_SUN); } + TURN {MOVE(player, MOVE_SANDSTORM);} } SCENE { - HP_BAR(player, damage: -(400 / 4)); + NOT MESSAGE("Foe Registeel is buffeted by the sandstorm!"); } -} +} \ No newline at end of file diff --git a/test/battle/weather/snow.c b/test/battle/weather/snow.c index 6facfce7cf31..499f69dc364a 100644 --- a/test/battle/weather/snow.c +++ b/test/battle/weather/snow.c @@ -24,127 +24,4 @@ SINGLE_BATTLE_TEST("Snow multiplies the defense of Ice-types by 1.5x", s16 damag } FINALLY { EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); } -} - -SINGLE_BATTLE_TEST("Snow turns Weather Ball to an Ice-type move and doubles its power", s16 damage) -{ - u16 move; - PARAMETRIZE{ move = MOVE_CELEBRATE; } - PARAMETRIZE{ move = MOVE_SNOWSCAPE; } - GIVEN { - ASSUME(gBattleMoves[MOVE_WEATHER_BALL].effect == EFFECT_WEATHER_BALL); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_DRAGONAIR); - } WHEN { - TURN { MOVE(player, move); } - TURN { MOVE(player, MOVE_WEATHER_BALL); } - } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(4.0), results[1].damage); // double base power + type effectiveness. - } -} - -SINGLE_BATTLE_TEST("Snow allows Blizzard to bypass accuracy checks") -{ - PASSES_RANDOMLY(100, 100, RNG_ACCURACY); - GIVEN { - ASSUME(gBattleMoves[MOVE_BLIZZARD].accuracy == 70); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_BLIZZARD); } - } SCENE { - NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } - } -} - -SINGLE_BATTLE_TEST("Snow halves the power of Solar Beam", s16 damage) -{ - u16 move; - PARAMETRIZE{ move = MOVE_CELEBRATE; } - PARAMETRIZE{ move = MOVE_SNOWSCAPE; } - GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BEAM); } - TURN { SKIP_TURN(player); } - } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); - } -} - -SINGLE_BATTLE_TEST("Snow halves the power of Solar Blade", s16 damage) -{ - u16 move; - KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line - PARAMETRIZE{ move = MOVE_CELEBRATE; } - PARAMETRIZE{ move = MOVE_SNOWSCAPE; } - GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WYNAUT); - } WHEN { - TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BLADE); } - TURN { SKIP_TURN(player); } - } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); - } -} - -SINGLE_BATTLE_TEST("Snow causes Moonlight to recover 1/4 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_MOONLIGHT].effect == EFFECT_MOONLIGHT); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_MOONLIGHT); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Snow causes Synthesis to recover 1/4 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_SYNTHESIS].effect == EFFECT_SYNTHESIS); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_SYNTHESIS); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Snow causes Morning Sun to recover 1/4 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_MORNING_SUN); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Snow allows Aurora Veil to be used") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_AURORA_VEIL); } - } SCENE { - NOT MESSAGE("But it failed!"); - } } \ No newline at end of file diff --git a/test/battle/weather/sunlight.c b/test/battle/weather/sunlight.c index 63309e04195d..8fa941549ceb 100644 --- a/test/battle/weather/sunlight.c +++ b/test/battle/weather/sunlight.c @@ -45,129 +45,4 @@ SINGLE_BATTLE_TEST("Sunlight multiplies the power of Water-type moves by 0.5x", } } -SINGLE_BATTLE_TEST("Sunlight turns Weather Ball to a Fire-type move and doubles its power", s16 damage) -{ - u16 move; - PARAMETRIZE{ move = MOVE_CELEBRATE; } - PARAMETRIZE{ move = MOVE_SUNNY_DAY; } - GIVEN { - ASSUME(gBattleMoves[MOVE_WEATHER_BALL].effect == EFFECT_WEATHER_BALL); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_MEGANIUM); - } WHEN { - TURN { MOVE(player, move); } - TURN { MOVE(player, MOVE_WEATHER_BALL); } - } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(6.0), results[1].damage); // double base power + type effectiveness + sun 50% boost - } -} - -SINGLE_BATTLE_TEST("Sunlight allows Solar Beam to be used instantly") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_SOLAR_BEAM); } - } SCENE { - NOT MESSAGE("Wobbuffet took in sunlight!"); - } -} - -SINGLE_BATTLE_TEST("Sunlight allows Solar Blade to be used instantly") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_SOLAR_BLADE); } - } SCENE { - NOT MESSAGE("Wobbuffet took in sunlight!"); - } -} - -SINGLE_BATTLE_TEST("Sunlight prevents being frozen") -{ - PASSES_RANDOMLY(100, 100, RNG_ACCURACY); //should freeze 10 times if no sun, but never under sun - 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("Sunlight causes Moonlight to recover 2/3 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_MOONLIGHT].effect == EFFECT_MOONLIGHT); - 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: -200); - } -} - -SINGLE_BATTLE_TEST("Sunlight causes Synthesis to recover 2/3 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_SYNTHESIS].effect == EFFECT_SYNTHESIS); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(300); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_SYNTHESIS); } - } SCENE { - HP_BAR(player, damage: -200); - } -} - -SINGLE_BATTLE_TEST("Sunlight causes Morning Sun to recover 2/3 of the user's max HP") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN); - 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: -200); - } -} - -SINGLE_BATTLE_TEST("Sunlight lowers accuracy of Thunder to 50%") -{ - PASSES_RANDOMLY(50, 100, RNG_ACCURACY); - GIVEN { - ASSUME(gBattleMoves[MOVE_THUNDER].accuracy == 70); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(player, MOVE_SUNNY_DAY); MOVE(opponent, MOVE_THUNDER); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_THUNDER, opponent); - } -} - -SINGLE_BATTLE_TEST("Sunlight lowers accuracy of Hurricane to 50%") -{ - PASSES_RANDOMLY(50, 100, RNG_ACCURACY); - GIVEN { - ASSUME(gBattleMoves[MOVE_HURRICANE].accuracy == 70); - 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); - } -} - -TO_DO_BATTLE_TEST("Sunlight guarantees Harvest will restore a held berry"); \ No newline at end of file +TO_DO_BATTLE_TEST("Harvest always restores a Berry in Sunlight"); //put this in the harvest ability file once its implemented \ No newline at end of file From a876d27828bce697e7042d1c18734605fe3b2ec6 Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Mon, 28 Aug 2023 16:31:54 -0500 Subject: [PATCH 03/14] More tests --- test/battle/hold_effect/safety_goggles.c | 27 +++- test/battle/move_effect/aurora_veil.c | 43 ++++++ test/battle/move_effect/hurricane.c | 34 +++++ test/battle/move_effect/moonlight.c | 79 ++++++++++ test/battle/move_effect/morning_sun.c | 80 ++++++++++ test/battle/move_effect/solar_beam.c | 187 +++++++++++++++++++++++ test/battle/move_effect/synthesis.c | 79 ++++++++++ test/battle/move_effect/thunder.c | 34 +++++ 8 files changed, 560 insertions(+), 3 deletions(-) create mode 100644 test/battle/move_effect/aurora_veil.c create mode 100644 test/battle/move_effect/hurricane.c create mode 100644 test/battle/move_effect/moonlight.c create mode 100644 test/battle/move_effect/morning_sun.c create mode 100644 test/battle/move_effect/solar_beam.c create mode 100644 test/battle/move_effect/synthesis.c create mode 100644 test/battle/move_effect/thunder.c diff --git a/test/battle/hold_effect/safety_goggles.c b/test/battle/hold_effect/safety_goggles.c index bec703443e2b..ee5464cf08fd 100644 --- a/test/battle/hold_effect/safety_goggles.c +++ b/test/battle/hold_effect/safety_goggles.c @@ -10,7 +10,6 @@ SINGLE_BATTLE_TEST("Safety Goggles block powder and spore moves") { GIVEN { ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER); - ASSUME(gItems[ITEM_SAFETY_GOGGLES].holdEffect == HOLD_EFFECT_SAFETY_GOGGLES); PLAYER(SPECIES_WYNAUT); OPPONENT(SPECIES_ABRA) { Item(ITEM_SAFETY_GOGGLES); } } WHEN { @@ -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"); diff --git a/test/battle/move_effect/aurora_veil.c b/test/battle/move_effect/aurora_veil.c new file mode 100644 index 000000000000..ed27318ff4e7 --- /dev/null +++ b/test/battle/move_effect/aurora_veil.c @@ -0,0 +1,43 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_AURORA_VEIL].effect == EFFECT_AURORA_VEIL); +} + +SINGLE_BATTLE_TEST("Aurora Veil cannot be used without Hail or Snow") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_AURORA_VEIL); } + } SCENE { + MESSAGE("But it failed!"); + } +} + +SINGLE_BATTLE_TEST("Aurora Veil can be used in Hail") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_AURORA_VEIL); } + } SCENE { + NOT MESSAGE("But it failed!"); + } +} + +SINGLE_BATTLE_TEST("Aurora Veil can be used in Snow") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_AURORA_VEIL); } + } SCENE { + NOT MESSAGE("But it failed!"); + } +} \ No newline at end of file diff --git a/test/battle/move_effect/hurricane.c b/test/battle/move_effect/hurricane.c new file mode 100644 index 000000000000..485816c17693 --- /dev/null +++ b/test/battle/move_effect/hurricane.c @@ -0,0 +1,34 @@ +#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!"); } + } +} \ No newline at end of file diff --git a/test/battle/move_effect/moonlight.c b/test/battle/move_effect/moonlight.c new file mode 100644 index 000000000000..eeb0f7b8dcab --- /dev/null +++ b/test/battle/move_effect/moonlight.c @@ -0,0 +1,79 @@ +#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") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_RAIN_DANCE); MOVE(player, MOVE_MOONLIGHT); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Moonlight recovers 1/4 of the user's max HP in a Sandstorm") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SANDSTORM); MOVE(player, MOVE_MOONLIGHT); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Moonlight recovers 1/4 of the user's max HP in Hail") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_MOONLIGHT); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Moonlight recovers 1/4 of the user's max HP in Snow") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_MOONLIGHT); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} \ No newline at end of file diff --git a/test/battle/move_effect/morning_sun.c b/test/battle/move_effect/morning_sun.c new file mode 100644 index 000000000000..137ec4484ef9 --- /dev/null +++ b/test/battle/move_effect/morning_sun.c @@ -0,0 +1,80 @@ +#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") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_RAIN_DANCE); MOVE(player, MOVE_MORNING_SUN); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Morning Sun recovers 1/4 of the user's max HP in a Sandstorm") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SANDSTORM); MOVE(player, MOVE_MORNING_SUN); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Morning Sun recovers 1/4 of the user's max HP in Hail") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_MORNING_SUN); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Morning Sun recovers 1/4 of the user's max HP in Snow") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN); + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_MORNING_SUN); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} \ No newline at end of file diff --git a/test/battle/move_effect/solar_beam.c b/test/battle/move_effect/solar_beam.c new file mode 100644 index 000000000000..be39bbf28afa --- /dev/null +++ b/test/battle/move_effect/solar_beam.c @@ -0,0 +1,187 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); +} + +SINGLE_BATTLE_TEST("Solar Beam can be used instantly in Sunlight") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_SOLAR_BEAM); } + } SCENE { + NOT MESSAGE("Wobbuffet took in sunlight!"); + } +} + +SINGLE_BATTLE_TEST("Solar Blade can be used instantly in Sunlight") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_SOLAR_BLADE); } + } SCENE { + NOT MESSAGE("Wobbuffet took in sunlight!"); + } +} + +SINGLE_BATTLE_TEST("Solar Beam's power is halved in Rain", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_RAIN_DANCE; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BEAM); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Solar Blade's power is halved in Rain", s16 damage) +{ + u16 move; + KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_RAIN_DANCE; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BLADE); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Solar Beam's power is halved in a Sandstorm", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_SANDSTORM; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BEAM); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Solar Blade's power is halved in a Sandstorm", s16 damage) +{ + u16 move; + KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_SANDSTORM; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BLADE); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Solar Beam's power is halved in Hail", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_HAIL; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BEAM); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Solar Blade's power is halved in Hail", s16 damage) +{ + u16 move; + KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_HAIL; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BLADE); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Solar Beam's power is halved in Snow", s16 damage) +{ + u16 move; + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_SNOWSCAPE; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BEAM); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Solar Blade's power is halved in Snow", s16 damage) +{ + u16 move; + KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line + PARAMETRIZE{ move = MOVE_CELEBRATE; } + PARAMETRIZE{ move = MOVE_SNOWSCAPE; } + GIVEN { + ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(opponent, move); MOVE(player, MOVE_SOLAR_BLADE); } + TURN { SKIP_TURN(player); } + } SCENE { + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} \ No newline at end of file diff --git a/test/battle/move_effect/synthesis.c b/test/battle/move_effect/synthesis.c new file mode 100644 index 000000000000..1ff8226a7d92 --- /dev/null +++ b/test/battle/move_effect/synthesis.c @@ -0,0 +1,79 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_SYNTHESIS].effect == EFFECT_SYNTHESIS); +} + +SINGLE_BATTLE_TEST("Synthesis 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_SYNTHESIS); } + } SCENE { + HP_BAR(player, damage: -(200 / 2)); + } +} + +SINGLE_BATTLE_TEST("Synthesis 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_SYNTHESIS); } + } SCENE { + HP_BAR(player, damage: -(300 / 1.5)); + } +} + +SINGLE_BATTLE_TEST("Synthesis recovers 1/4 of the user's max HP in Rain") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_RAIN_DANCE); MOVE(player, MOVE_SYNTHESIS); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Synthesis recovers 1/4 of the user's max HP in a Sandstorm") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SANDSTORM); MOVE(player, MOVE_SYNTHESIS); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Synthesis recovers 1/4 of the user's max HP in Hail") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_SYNTHESIS); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} + +SINGLE_BATTLE_TEST("Synthesis recovers 1/4 of the user's max HP in Snow") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_SYNTHESIS); } + } SCENE { + HP_BAR(player, damage: -(400 / 4)); + } +} \ No newline at end of file diff --git a/test/battle/move_effect/thunder.c b/test/battle/move_effect/thunder.c new file mode 100644 index 000000000000..a3674c498f3a --- /dev/null +++ b/test/battle/move_effect/thunder.c @@ -0,0 +1,34 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_THUNDER].effect == EFFECT_THUNDER); + ASSUME(gBattleMoves[MOVE_THUNDER].accuracy == 70); +} + +SINGLE_BATTLE_TEST("Thunder'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_THUNDER); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_THUNDER, opponent); + } +} + +SINGLE_BATTLE_TEST("Thunder 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_THUNDER); } + } SCENE { + NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } + } +} \ No newline at end of file From 5bc687c7d5921f6e809d6fc7c08e7460a7eea28d Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Mon, 28 Aug 2023 16:34:44 -0500 Subject: [PATCH 04/14] Formatting --- test/battle/move_flags/powder.c | 2 +- test/battle/weather/hail.c | 3 ++- test/battle/weather/rain.c | 3 ++- test/battle/weather/sandstorm.c | 3 ++- test/battle/weather/snow.c | 3 ++- test/battle/weather/sunlight.c | 3 ++- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/test/battle/move_flags/powder.c b/test/battle/move_flags/powder.c index 1cb41371f6ad..565fddfed68e 100644 --- a/test/battle/move_flags/powder.c +++ b/test/battle/move_flags/powder.c @@ -14,4 +14,4 @@ SINGLE_BATTLE_TEST("Powder moves are blocked by Grass-type Pokémon") NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_STUN_SPORE, player); MESSAGE("It doesn't affect Foe Oddish…"); } -} \ No newline at end of file +} diff --git a/test/battle/weather/hail.c b/test/battle/weather/hail.c index 11113e237711..8908e17a79ec 100644 --- a/test/battle/weather/hail.c +++ b/test/battle/weather/hail.c @@ -1,6 +1,7 @@ #include "global.h" #include "test/battle.h" +// Please add Hail interactions with move, item and ability effects on their respective files. SINGLE_BATTLE_TEST("Hail deals 1/16 damage per turn") { s16 hailDamage; @@ -27,4 +28,4 @@ SINGLE_BATTLE_TEST("Hail damage does not affect Ice-type Pokémon") } SCENE { NOT MESSAGE("Foe Glalie is pelted by HAIL!"); } -} \ No newline at end of file +} diff --git a/test/battle/weather/rain.c b/test/battle/weather/rain.c index a38474a8d58c..00ac263044af 100644 --- a/test/battle/weather/rain.c +++ b/test/battle/weather/rain.c @@ -1,6 +1,7 @@ #include "global.h" #include "test/battle.h" +// Please add Rain interactions with move, item and ability effects on their respective files. ASSUMPTIONS { ASSUME(gBattleMoves[MOVE_EMBER].type == TYPE_FIRE); @@ -43,4 +44,4 @@ SINGLE_BATTLE_TEST("Rain multiplies the power of Water-type moves by 1.5x", s16 } FINALLY { EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); } -} \ No newline at end of file +} diff --git a/test/battle/weather/sandstorm.c b/test/battle/weather/sandstorm.c index 7b8a6082473e..baf8b0dbeb3d 100644 --- a/test/battle/weather/sandstorm.c +++ b/test/battle/weather/sandstorm.c @@ -1,6 +1,7 @@ #include "global.h" #include "test/battle.h" +// Please add Sandstorm interactions with move, item and ability effects on their respective files. SINGLE_BATTLE_TEST("Sandstorm deals 1/16 damage per turn") { s16 sandstormDamage; @@ -71,4 +72,4 @@ SINGLE_BATTLE_TEST("Sandstorm damage does not hurt Steel-type Pokémon") } SCENE { NOT MESSAGE("Foe Registeel is buffeted by the sandstorm!"); } -} \ No newline at end of file +} diff --git a/test/battle/weather/snow.c b/test/battle/weather/snow.c index 499f69dc364a..dff18e7b76db 100644 --- a/test/battle/weather/snow.c +++ b/test/battle/weather/snow.c @@ -1,6 +1,7 @@ #include "global.h" #include "test/battle.h" +// Please add Snow interactions with move, item and ability effects on their respective files. ASSUMPTIONS { ASSUME(gBattleMoves[MOVE_SNOWSCAPE].effect == EFFECT_SNOWSCAPE); @@ -24,4 +25,4 @@ SINGLE_BATTLE_TEST("Snow multiplies the defense of Ice-types by 1.5x", s16 damag } FINALLY { EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); } -} \ No newline at end of file +} diff --git a/test/battle/weather/sunlight.c b/test/battle/weather/sunlight.c index 8fa941549ceb..adffce630aa8 100644 --- a/test/battle/weather/sunlight.c +++ b/test/battle/weather/sunlight.c @@ -1,6 +1,7 @@ #include "global.h" #include "test/battle.h" +// Please add Sunlight interactions with move, item and ability effects on their respective files. ASSUMPTIONS { ASSUME(gBattleMoves[MOVE_EMBER].type == TYPE_FIRE); @@ -45,4 +46,4 @@ SINGLE_BATTLE_TEST("Sunlight multiplies the power of Water-type moves by 0.5x", } } -TO_DO_BATTLE_TEST("Harvest always restores a Berry in Sunlight"); //put this in the harvest ability file once its implemented \ No newline at end of file +TO_DO_BATTLE_TEST("Harvest always restores a Berry in Sunlight"); //put this in the harvest ability file once its implemented From 5cf8a4b607c44626a1b4acb250efca674f8567f7 Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Mon, 28 Aug 2023 17:22:25 -0500 Subject: [PATCH 05/14] Add new line at the end of tests --- agbcc | 1 + test/battle/ability/prankster.c | 2 +- test/battle/move_effect/aurora_veil.c | 2 +- test/battle/move_effect/freeze_hit.c | 2 +- test/battle/move_effect/hurricane.c | 2 +- test/battle/move_effect/leech_seed.c | 2 +- test/battle/move_effect/moonlight.c | 2 +- test/battle/move_effect/morning_sun.c | 2 +- test/battle/move_effect/poison_hit.c | 2 +- test/battle/move_effect/solar_beam.c | 2 +- test/battle/move_effect/synthesis.c | 2 +- test/battle/move_effect/thunder.c | 2 +- test/battle/move_effect/weather_ball.c | 2 +- 13 files changed, 13 insertions(+), 12 deletions(-) create mode 160000 agbcc diff --git a/agbcc b/agbcc new file mode 160000 index 000000000000..b5f197430817 --- /dev/null +++ b/agbcc @@ -0,0 +1 @@ +Subproject commit b5f197430817132649786ea2a02a13f5eb90f567 diff --git a/test/battle/ability/prankster.c b/test/battle/ability/prankster.c index 31eefeff826b..26f7eeb6abc3 100644 --- a/test/battle/ability/prankster.c +++ b/test/battle/ability/prankster.c @@ -13,4 +13,4 @@ SINGLE_BATTLE_TEST("Prankster priority moves don't affect Dark-type Pokémon") NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_CONFUSE_RAY, player); MESSAGE("It doesn't affect Umbreon…"); } -} \ No newline at end of file +} diff --git a/test/battle/move_effect/aurora_veil.c b/test/battle/move_effect/aurora_veil.c index ed27318ff4e7..799af9354291 100644 --- a/test/battle/move_effect/aurora_veil.c +++ b/test/battle/move_effect/aurora_veil.c @@ -40,4 +40,4 @@ SINGLE_BATTLE_TEST("Aurora Veil can be used in Snow") } SCENE { NOT MESSAGE("But it failed!"); } -} \ No newline at end of file +} diff --git a/test/battle/move_effect/freeze_hit.c b/test/battle/move_effect/freeze_hit.c index cff1d8d615f4..72a55b39e620 100644 --- a/test/battle/move_effect/freeze_hit.c +++ b/test/battle/move_effect/freeze_hit.c @@ -72,4 +72,4 @@ SINGLE_BATTLE_TEST("Blizzard bypasses accuracy checks in Snow") } SCENE { NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } } -} \ No newline at end of file +} diff --git a/test/battle/move_effect/hurricane.c b/test/battle/move_effect/hurricane.c index 485816c17693..5d5ff408ba13 100644 --- a/test/battle/move_effect/hurricane.c +++ b/test/battle/move_effect/hurricane.c @@ -31,4 +31,4 @@ SINGLE_BATTLE_TEST("Hurricane bypasses accuracy checks in Rain") } SCENE { NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } } -} \ No newline at end of file +} diff --git a/test/battle/move_effect/leech_seed.c b/test/battle/move_effect/leech_seed.c index c3744f115cf9..58abaa941ee3 100644 --- a/test/battle/move_effect/leech_seed.c +++ b/test/battle/move_effect/leech_seed.c @@ -19,4 +19,4 @@ SINGLE_BATTLE_TEST("Leech Seed doesn't affect Grass-type Pokémon") NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_LEECH_SEED, player); MESSAGE("It doesn't affect Foe Oddish…"); } -} \ No newline at end of file +} diff --git a/test/battle/move_effect/moonlight.c b/test/battle/move_effect/moonlight.c index eeb0f7b8dcab..473dd57c73d9 100644 --- a/test/battle/move_effect/moonlight.c +++ b/test/battle/move_effect/moonlight.c @@ -76,4 +76,4 @@ SINGLE_BATTLE_TEST("Moonlight recovers 1/4 of the user's max HP in Snow") } SCENE { HP_BAR(player, damage: -(400 / 4)); } -} \ No newline at end of file +} diff --git a/test/battle/move_effect/morning_sun.c b/test/battle/move_effect/morning_sun.c index 137ec4484ef9..d467c9028eb9 100644 --- a/test/battle/move_effect/morning_sun.c +++ b/test/battle/move_effect/morning_sun.c @@ -77,4 +77,4 @@ SINGLE_BATTLE_TEST("Morning Sun recovers 1/4 of the user's max HP in Snow") } SCENE { HP_BAR(player, damage: -(400 / 4)); } -} \ No newline at end of file +} diff --git a/test/battle/move_effect/poison_hit.c b/test/battle/move_effect/poison_hit.c index afc6ef40ccb2..a2f8d1c6de2d 100644 --- a/test/battle/move_effect/poison_hit.c +++ b/test/battle/move_effect/poison_hit.c @@ -52,4 +52,4 @@ SINGLE_BATTLE_TEST("Poison cannot be inflicted on Steel-type Pokémon") NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); NOT STATUS_ICON(opponent, poison: TRUE); } -} \ No newline at end of file +} diff --git a/test/battle/move_effect/solar_beam.c b/test/battle/move_effect/solar_beam.c index be39bbf28afa..ee26ba18da6b 100644 --- a/test/battle/move_effect/solar_beam.c +++ b/test/battle/move_effect/solar_beam.c @@ -184,4 +184,4 @@ SINGLE_BATTLE_TEST("Solar Blade's power is halved in Snow", s16 damage) } FINALLY { EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); } -} \ No newline at end of file +} diff --git a/test/battle/move_effect/synthesis.c b/test/battle/move_effect/synthesis.c index 1ff8226a7d92..081f899b26ed 100644 --- a/test/battle/move_effect/synthesis.c +++ b/test/battle/move_effect/synthesis.c @@ -76,4 +76,4 @@ SINGLE_BATTLE_TEST("Synthesis recovers 1/4 of the user's max HP in Snow") } SCENE { HP_BAR(player, damage: -(400 / 4)); } -} \ No newline at end of file +} diff --git a/test/battle/move_effect/thunder.c b/test/battle/move_effect/thunder.c index a3674c498f3a..d6e5101f3b9a 100644 --- a/test/battle/move_effect/thunder.c +++ b/test/battle/move_effect/thunder.c @@ -31,4 +31,4 @@ SINGLE_BATTLE_TEST("Thunder bypasses accuracy checks in Rain") } SCENE { NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } } -} \ No newline at end of file +} diff --git a/test/battle/move_effect/weather_ball.c b/test/battle/move_effect/weather_ball.c index 8495bc978deb..583fce5e3f1f 100644 --- a/test/battle/move_effect/weather_ball.c +++ b/test/battle/move_effect/weather_ball.c @@ -94,4 +94,4 @@ SINGLE_BATTLE_TEST("Weather Ball doubles its power and turns to an Ice-type move } FINALLY { EXPECT_MUL_EQ(results[0].damage, Q_4_12(4.0), results[1].damage); // double base power + type effectiveness. } -} \ No newline at end of file +} From 90f45061cd7e869e7eea4e23a238049450d76192 Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Thu, 7 Sep 2023 15:33:36 -0500 Subject: [PATCH 06/14] Delete agbcc --- agbcc | 1 - 1 file changed, 1 deletion(-) delete mode 160000 agbcc diff --git a/agbcc b/agbcc deleted file mode 160000 index b5f197430817..000000000000 --- a/agbcc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b5f197430817132649786ea2a02a13f5eb90f567 From ce16a7549adef9a1379a805378f982df89c8e989 Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Thu, 7 Sep 2023 16:14:21 -0500 Subject: [PATCH 07/14] Change steel type poison immunity test --- test/battle/move_effect/poison_hit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/battle/move_effect/poison_hit.c b/test/battle/move_effect/poison_hit.c index a2f8d1c6de2d..6d6384b11ad5 100644 --- a/test/battle/move_effect/poison_hit.c +++ b/test/battle/move_effect/poison_hit.c @@ -4,9 +4,10 @@ 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") +SINGLE_BATTLE_TEST("Poison is inflicted by Poison Sting") { GIVEN { PLAYER(SPECIES_WOBBUFFET); @@ -42,12 +43,12 @@ SINGLE_BATTLE_TEST("Poison cannot be inflicted on Steel-type Pokémon") { GIVEN { ASSUME(gSpeciesInfo[SPECIES_REGISTEEL].types[0] == TYPE_STEEL); - PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_POISON_BARB); }; + PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_REGISTEEL); } WHEN { - TURN { MOVE(player, MOVE_FLING); } + TURN { MOVE(player, MOVE_TWINEEDLE); } } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_FLING, 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); From 68d71fe3ceb52991d6bf57dc1b531bedf304cbb5 Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Mon, 25 Sep 2023 13:09:06 -0500 Subject: [PATCH 08/14] Apply suggestions from code review Co-authored-by: Eduardo Quezada D'Ottone --- test/battle/ability/prankster.c | 16 +++++++++++++++- test/battle/hold_effect/safety_goggles.c | 4 ++-- test/battle/move_effect/aurora_veil.c | 6 ++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/test/battle/ability/prankster.c b/test/battle/ability/prankster.c index 26f7eeb6abc3..29fd11786e09 100644 --- a/test/battle/ability/prankster.c +++ b/test/battle/ability/prankster.c @@ -1,7 +1,7 @@ #include "global.h" #include "test/battle.h" -SINGLE_BATTLE_TEST("Prankster priority moves don't affect Dark-type Pokémon") +SINGLE_BATTLE_TEST("Prankster-affected moves don't affect Dark-type Pokémon") { GIVEN { ASSUME(gSpeciesInfo[SPECIES_UMBREON].types[0] == TYPE_DARK); @@ -14,3 +14,17 @@ SINGLE_BATTLE_TEST("Prankster priority moves don't affect Dark-type Pokémon") 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+"); diff --git a/test/battle/hold_effect/safety_goggles.c b/test/battle/hold_effect/safety_goggles.c index ee5464cf08fd..38efd867274d 100644 --- a/test/battle/hold_effect/safety_goggles.c +++ b/test/battle/hold_effect/safety_goggles.c @@ -26,7 +26,7 @@ SINGLE_BATTLE_TEST("Safety Goggles blocks damage from Hail") PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; } WHEN { - TURN {MOVE(player, MOVE_HAIL);} + TURN { MOVE(player, MOVE_HAIL); } } SCENE { NOT MESSAGE("Foe Wobbuffet is pelted by HAIL!"); } @@ -38,7 +38,7 @@ SINGLE_BATTLE_TEST("Safety Goggles blocks damage from Sandstorm") PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; } WHEN { - TURN {MOVE(player, MOVE_SANDSTORM);} + TURN { MOVE(player, MOVE_SANDSTORM); } } SCENE { NOT MESSAGE("Foe Wobbuffet is buffeted by the sandstorm!"); } diff --git a/test/battle/move_effect/aurora_veil.c b/test/battle/move_effect/aurora_veil.c index 799af9354291..26832ace598e 100644 --- a/test/battle/move_effect/aurora_veil.c +++ b/test/battle/move_effect/aurora_veil.c @@ -41,3 +41,9 @@ SINGLE_BATTLE_TEST("Aurora Veil can be used in Snow") 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 From 0a1414f6c54229b2f4f52668fd31d2faecfa9fcf Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Sun, 1 Oct 2023 19:16:38 -0500 Subject: [PATCH 09/14] Update solar_beam.c --- test/battle/move_effect/solar_beam.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/battle/move_effect/solar_beam.c b/test/battle/move_effect/solar_beam.c index ee26ba18da6b..4ab968a14979 100644 --- a/test/battle/move_effect/solar_beam.c +++ b/test/battle/move_effect/solar_beam.c @@ -52,7 +52,6 @@ SINGLE_BATTLE_TEST("Solar Beam's power is halved in Rain", s16 damage) SINGLE_BATTLE_TEST("Solar Blade's power is halved in Rain", s16 damage) { u16 move; - KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_RAIN_DANCE; } GIVEN { @@ -91,7 +90,6 @@ SINGLE_BATTLE_TEST("Solar Beam's power is halved in a Sandstorm", s16 damage) SINGLE_BATTLE_TEST("Solar Blade's power is halved in a Sandstorm", s16 damage) { u16 move; - KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_SANDSTORM; } GIVEN { @@ -130,7 +128,6 @@ SINGLE_BATTLE_TEST("Solar Beam's power is halved in Hail", s16 damage) SINGLE_BATTLE_TEST("Solar Blade's power is halved in Hail", s16 damage) { u16 move; - KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_HAIL; } GIVEN { @@ -169,7 +166,6 @@ SINGLE_BATTLE_TEST("Solar Beam's power is halved in Snow", s16 damage) SINGLE_BATTLE_TEST("Solar Blade's power is halved in Snow", s16 damage) { u16 move; - KNOWN_FAILING; // fails bc the bp of solar blade gets rounded up which leads to slightly incorrect calcs down the line PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_SNOWSCAPE; } GIVEN { From a8d31280bfe2aa916b95781d212105090d629366 Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Tue, 10 Oct 2023 21:01:38 -0500 Subject: [PATCH 10/14] Apply suggestions from code review Co-authored-by: Eduardo Quezada D'Ottone --- test/battle/move_effect/hurricane.c | 1 + test/battle/move_effect/leech_seed.c | 4 ++++ test/battle/move_effect/ohko.c | 4 ++++ test/battle/move_effect/paralyze_hit.c | 2 +- test/battle/move_effect/poison_hit.c | 4 ++-- test/battle/move_effect/solar_beam.c | 1 + 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/test/battle/move_effect/hurricane.c b/test/battle/move_effect/hurricane.c index 5d5ff408ba13..31cd956b106a 100644 --- a/test/battle/move_effect/hurricane.c +++ b/test/battle/move_effect/hurricane.c @@ -32,3 +32,4 @@ SINGLE_BATTLE_TEST("Hurricane bypasses accuracy checks in Rain") NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } } } +TO_DO_BATTLE_TEST("Hurricane Veil can hit airborne targets") // Fly, Bounce, Sky Drop diff --git a/test/battle/move_effect/leech_seed.c b/test/battle/move_effect/leech_seed.c index 58abaa941ee3..a2585a3d7fb7 100644 --- a/test/battle/move_effect/leech_seed.c +++ b/test/battle/move_effect/leech_seed.c @@ -20,3 +20,7 @@ SINGLE_BATTLE_TEST("Leech Seed doesn't affect Grass-type Pokémon") 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") diff --git a/test/battle/move_effect/ohko.c b/test/battle/move_effect/ohko.c index 9d5457d622fb..63e77b07f9ff 100644 --- a/test/battle/move_effect/ohko.c +++ b/test/battle/move_effect/ohko.c @@ -20,3 +20,7 @@ SINGLE_BATTLE_TEST("Sheer Cold doesn't affect Ice-type Pokémon") 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 diff --git a/test/battle/move_effect/paralyze_hit.c b/test/battle/move_effect/paralyze_hit.c index ec103c4ba4c8..4efe6746ceb6 100644 --- a/test/battle/move_effect/paralyze_hit.c +++ b/test/battle/move_effect/paralyze_hit.c @@ -21,7 +21,7 @@ SINGLE_BATTLE_TEST("Thunder Shock inflicts paralysis") } } -SINGLE_BATTLE_TEST("Paralysis cannot be inflicted on Electric-type Pokémon") +SINGLE_BATTLE_TEST("Thunder Shock cannot paralyze an Electric-type") { GIVEN { ASSUME(B_PARALYZE_ELECTRIC >= GEN_6); diff --git a/test/battle/move_effect/poison_hit.c b/test/battle/move_effect/poison_hit.c index 6d6384b11ad5..69eb0906fb8e 100644 --- a/test/battle/move_effect/poison_hit.c +++ b/test/battle/move_effect/poison_hit.c @@ -7,7 +7,7 @@ ASSUMPTIONS ASSUME(gBattleMoves[MOVE_TWINEEDLE].effect == EFFECT_POISON_HIT); } -SINGLE_BATTLE_TEST("Poison is inflicted by Poison Sting") +SINGLE_BATTLE_TEST("Poison Sting inflicts poison") { GIVEN { PLAYER(SPECIES_WOBBUFFET); @@ -23,7 +23,7 @@ SINGLE_BATTLE_TEST("Poison is inflicted by Poison Sting") } } -SINGLE_BATTLE_TEST("Poison cannot be inflicted on Poison-type Pokémon") +SINGLE_BATTLE_TEST("Poison Sting cannot poison Poison-type") { GIVEN { ASSUME(gSpeciesInfo[SPECIES_NIDORAN_M].types[0] == TYPE_POISON); diff --git a/test/battle/move_effect/solar_beam.c b/test/battle/move_effect/solar_beam.c index 4ab968a14979..e767a3c9ca4f 100644 --- a/test/battle/move_effect/solar_beam.c +++ b/test/battle/move_effect/solar_beam.c @@ -4,6 +4,7 @@ ASSUMPTIONS { ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); + ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); } SINGLE_BATTLE_TEST("Solar Beam can be used instantly in Sunlight") From ccd2cd4fae19be8b83996ad1ca01f946e36d0c8b Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Wed, 11 Oct 2023 11:32:25 -0500 Subject: [PATCH 11/14] Apply some changes from code review --- test/battle/move_effect/aurora_veil.c | 36 ++++++-------------- test/battle/move_effect/burn_hit.c | 2 +- test/battle/move_effect/freeze_hit.c | 25 +++++--------- test/battle/move_effect/moonlight.c | 45 ++++--------------------- test/battle/move_effect/morning_sun.c | 46 ++++---------------------- test/battle/move_effect/weather_ball.c | 21 ++---------- test/battle/weather/snow.c | 2 +- 7 files changed, 36 insertions(+), 141 deletions(-) diff --git a/test/battle/move_effect/aurora_veil.c b/test/battle/move_effect/aurora_veil.c index 26832ace598e..ff255d9ae460 100644 --- a/test/battle/move_effect/aurora_veil.c +++ b/test/battle/move_effect/aurora_veil.c @@ -6,41 +6,25 @@ ASSUMPTIONS ASSUME(gBattleMoves[MOVE_AURORA_VEIL].effect == EFFECT_AURORA_VEIL); } -SINGLE_BATTLE_TEST("Aurora Veil cannot be used without Hail or Snow") +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(player, MOVE_AURORA_VEIL); } + TURN { MOVE(opponent, move); MOVE(player, MOVE_AURORA_VEIL); } } SCENE { - MESSAGE("But it failed!"); + if (move == MOVE_CELEBRATE) + MESSAGE("But it failed!"); + else + NOT MESSAGE("But it failed!"); } } -SINGLE_BATTLE_TEST("Aurora Veil can be used in Hail") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_AURORA_VEIL); } - } SCENE { - NOT MESSAGE("But it failed!"); - } -} - -SINGLE_BATTLE_TEST("Aurora Veil can be used in Snow") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_AURORA_VEIL); } - } SCENE { - 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") diff --git a/test/battle/move_effect/burn_hit.c b/test/battle/move_effect/burn_hit.c index 9bcb36bb8702..762780009ceb 100644 --- a/test/battle/move_effect/burn_hit.c +++ b/test/battle/move_effect/burn_hit.c @@ -21,7 +21,7 @@ SINGLE_BATTLE_TEST("Ember inflicts burn") } } -SINGLE_BATTLE_TEST("Burn cannot be inflicted on Fire-type Pokémon") +SINGLE_BATTLE_TEST("Ember cannot burn a Fire-type Pokémon") { GIVEN { ASSUME(gSpeciesInfo[SPECIES_CHARMANDER].types[0] == TYPE_FIRE); diff --git a/test/battle/move_effect/freeze_hit.c b/test/battle/move_effect/freeze_hit.c index 72a55b39e620..9874ccc77580 100644 --- a/test/battle/move_effect/freeze_hit.c +++ b/test/battle/move_effect/freeze_hit.c @@ -22,12 +22,12 @@ SINGLE_BATTLE_TEST("Powder Snow inflicts freeze") } } -SINGLE_BATTLE_TEST("Freeze cannot be inflicted on Ice-type Pokémon") +SINGLE_BATTLE_TEST("Powder Snow cannot freeze an Ice-type Pokémon") { GIVEN { - ASSUME(gSpeciesInfo[SPECIES_GLALIE].types[0] == TYPE_ICE); + ASSUME(gSpeciesInfo[SPECIES_SNORUNT].types[0] == TYPE_ICE); PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_GLALIE); + OPPONENT(SPECIES_SNORUNT); } WHEN { TURN { MOVE(player, MOVE_POWDER_SNOW); } } SCENE { @@ -50,25 +50,16 @@ SINGLE_BATTLE_TEST("Freeze cannot be inflicted in Sunlight") } } -SINGLE_BATTLE_TEST("Blizzard bypasses accuracy checks in Hail") +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_HAIL); MOVE(player, MOVE_BLIZZARD); } - } SCENE { - NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } - } -} - -SINGLE_BATTLE_TEST("Blizzard bypasses accuracy checks in Snow") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_BLIZZARD); } + TURN { MOVE(opponent, move); MOVE(player, MOVE_BLIZZARD); } } SCENE { NONE_OF { MESSAGE("Wobbuffet's attack missed!"); } } diff --git a/test/battle/move_effect/moonlight.c b/test/battle/move_effect/moonlight.c index 473dd57c73d9..ded85c3fc416 100644 --- a/test/battle/move_effect/moonlight.c +++ b/test/battle/move_effect/moonlight.c @@ -30,49 +30,18 @@ SINGLE_BATTLE_TEST("Moonlight recovers 2/3 of the user's max HP in Sunlight") } } -SINGLE_BATTLE_TEST("Moonlight recovers 1/4 of the user's max HP in Rain") +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_RAIN_DANCE); MOVE(player, MOVE_MOONLIGHT); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Moonlight recovers 1/4 of the user's max HP in a Sandstorm") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SANDSTORM); MOVE(player, MOVE_MOONLIGHT); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Moonlight recovers 1/4 of the user's max HP in Hail") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_MOONLIGHT); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Moonlight recovers 1/4 of the user's max HP in Snow") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_MOONLIGHT); } + TURN { MOVE(opponent, move); MOVE(player, MOVE_MOONLIGHT); } } SCENE { HP_BAR(player, damage: -(400 / 4)); } diff --git a/test/battle/move_effect/morning_sun.c b/test/battle/move_effect/morning_sun.c index d467c9028eb9..7157944c6bdf 100644 --- a/test/battle/move_effect/morning_sun.c +++ b/test/battle/move_effect/morning_sun.c @@ -30,50 +30,18 @@ SINGLE_BATTLE_TEST("Morning Sun recovers 2/3 of the user's max HP in Sunlight") } } -SINGLE_BATTLE_TEST("Morning Sun recovers 1/4 of the user's max HP in Rain") +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_RAIN_DANCE); MOVE(player, MOVE_MORNING_SUN); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Morning Sun recovers 1/4 of the user's max HP in a Sandstorm") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SANDSTORM); MOVE(player, MOVE_MORNING_SUN); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Morning Sun recovers 1/4 of the user's max HP in Hail") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_MORNING_SUN); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Morning Sun recovers 1/4 of the user's max HP in Snow") -{ - GIVEN { - ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_MORNING_SUN); } + TURN { MOVE(opponent, move); MOVE(player, MOVE_MORNING_SUN); } } SCENE { HP_BAR(player, damage: -(400 / 4)); } diff --git a/test/battle/move_effect/weather_ball.c b/test/battle/move_effect/weather_ball.c index 583fce5e3f1f..629b32f97e75 100644 --- a/test/battle/move_effect/weather_ball.c +++ b/test/battle/move_effect/weather_ball.c @@ -60,32 +60,15 @@ SINGLE_BATTLE_TEST("Weather Ball doubles its power and turns to a Rock-type move } } -SINGLE_BATTLE_TEST("Weather Ball doubles its power and turns to an Ice-type move in Hail", s16 damage) +SINGLE_BATTLE_TEST("Weather Ball doubles its power and turns to an Ice-type move in Hail and Snow", s16 damage) { u16 move; PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_HAIL; } - GIVEN { - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_DRAGONAIR) { Item(ITEM_SAFETY_GOGGLES); }; - } WHEN { - TURN { MOVE(player, move); } - TURN { MOVE(player, MOVE_WEATHER_BALL); } - } SCENE { - HP_BAR(opponent, captureDamage: &results[i].damage); - } FINALLY { - EXPECT_MUL_EQ(results[0].damage, Q_4_12(4.0), results[1].damage); // double base power + type effectiveness. - } -} - -SINGLE_BATTLE_TEST("Weather Ball doubles its power and turns to an Ice-type move in Snow", s16 damage) -{ - u16 move; - PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_SNOWSCAPE; } GIVEN { PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_DRAGONAIR); + OPPONENT(SPECIES_DRAGONAIR) { Item(ITEM_SAFETY_GOGGLES); }; } WHEN { TURN { MOVE(player, move); } TURN { MOVE(player, MOVE_WEATHER_BALL); } diff --git a/test/battle/weather/snow.c b/test/battle/weather/snow.c index a063ebc87070..dff18e7b76db 100644 --- a/test/battle/weather/snow.c +++ b/test/battle/weather/snow.c @@ -25,4 +25,4 @@ SINGLE_BATTLE_TEST("Snow multiplies the defense of Ice-types by 1.5x", s16 damag } FINALLY { EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); } -} \ No newline at end of file +} From a0eaa751a271be88c70cd60c519048e595cde4c9 Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Wed, 11 Oct 2023 11:35:16 -0500 Subject: [PATCH 12/14] Harvest --- test/battle/ability/harvest.c | 5 +++++ test/battle/weather/sunlight.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 test/battle/ability/harvest.c diff --git a/test/battle/ability/harvest.c b/test/battle/ability/harvest.c new file mode 100644 index 000000000000..a9511c25aeb1 --- /dev/null +++ b/test/battle/ability/harvest.c @@ -0,0 +1,5 @@ +#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"); diff --git a/test/battle/weather/sunlight.c b/test/battle/weather/sunlight.c index adffce630aa8..9d471332ad69 100644 --- a/test/battle/weather/sunlight.c +++ b/test/battle/weather/sunlight.c @@ -45,5 +45,3 @@ SINGLE_BATTLE_TEST("Sunlight multiplies the power of Water-type moves by 0.5x", EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); } } - -TO_DO_BATTLE_TEST("Harvest always restores a Berry in Sunlight"); //put this in the harvest ability file once its implemented From 9beca4ff15d28d557daaab209581b8587e42c323 Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Fri, 13 Oct 2023 16:33:09 -0500 Subject: [PATCH 13/14] Update sandstorm.c --- test/battle/weather/sandstorm.c | 47 +++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/test/battle/weather/sandstorm.c b/test/battle/weather/sandstorm.c index baf8b0dbeb3d..3d4fbb631b21 100644 --- a/test/battle/weather/sandstorm.c +++ b/test/battle/weather/sandstorm.c @@ -35,41 +35,32 @@ SINGLE_BATTLE_TEST("Sandstorm multiplies the special defense of Rock-types by 1. } } -SINGLE_BATTLE_TEST("Sandstorm damage does not hurt Ground-type Pokémon") +SINGLE_BATTLE_TEST("Sandstorm damage does not hurt Ground, Rock, and Steel-type Pokémon") { + u32 mon; + PARAMETRIZE { mon = SPECIES_SANDSLASH; } + PARAMETRIZE { mon = SPECIES_NOSEPASS; } + PARAMETRIZE { mon = SPECIES_REGISTEEL; } GIVEN { ASSUME(gSpeciesInfo[SPECIES_SANDSLASH].types[0] == TYPE_GROUND); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_SANDSLASH); - } WHEN { - TURN {MOVE(player, MOVE_SANDSTORM);} - } SCENE { - NOT MESSAGE("Foe Sandslash is buffeted by the sandstorm!"); - } -} - -SINGLE_BATTLE_TEST("Sandstorm damage does not hurt Rock-type Pokémon") -{ - GIVEN { ASSUME(gSpeciesInfo[SPECIES_NOSEPASS].types[0] == TYPE_ROCK); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_NOSEPASS); - } WHEN { - TURN {MOVE(player, MOVE_SANDSTORM);} - } SCENE { - NOT MESSAGE("Foe Nosepass is buffeted by the sandstorm!"); - } -} - -SINGLE_BATTLE_TEST("Sandstorm damage does not hurt Steel-type Pokémon") -{ - GIVEN { ASSUME(gSpeciesInfo[SPECIES_REGISTEEL].types[0] == TYPE_STEEL); PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_REGISTEEL); + OPPONENT(mon); } WHEN { - TURN {MOVE(player, MOVE_SANDSTORM);} + TURN { MOVE(player, MOVE_SANDSTORM); } } SCENE { - NOT MESSAGE("Foe Registeel is buffeted by the sandstorm!"); + switch (mon) + { + case SPECIES_SANDSLASH: + NOT MESSAGE("Foe Sandslash is buffeted by the sandstorm!"); + break; + case SPECIES_NOSEPASS: + NOT MESSAGE("Foe Nosepass is buffeted by the sandstorm!"); + break; + case SPECIES_REGISTEEL: + NOT MESSAGE("Foe Registeel is buffeted by the sandstorm!"); + break; + } } } From 95150f5c7544d0deb1d44d1a478736d599e0b802 Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Sat, 14 Oct 2023 20:45:41 -0500 Subject: [PATCH 14/14] Actually finish addressing everything --- test/battle/ability/harvest.c | 12 ++++++++ test/battle/move_effect/poison_hit.c | 22 ++++---------- test/battle/move_effect/solar_beam.c | 27 ++++------------- test/battle/move_effect/synthesis.c | 45 +++++----------------------- 4 files changed, 29 insertions(+), 77 deletions(-) diff --git a/test/battle/ability/harvest.c b/test/battle/ability/harvest.c index a9511c25aeb1..9fb969b03621 100644 --- a/test/battle/ability/harvest.c +++ b/test/battle/ability/harvest.c @@ -3,3 +3,15 @@ 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"); diff --git a/test/battle/move_effect/poison_hit.c b/test/battle/move_effect/poison_hit.c index 69eb0906fb8e..95a8fbc946c7 100644 --- a/test/battle/move_effect/poison_hit.c +++ b/test/battle/move_effect/poison_hit.c @@ -23,28 +23,16 @@ 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); - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_NIDORAN_M); - } WHEN { - TURN { MOVE(player, MOVE_POISON_STING); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_POISON_STING, player); - HP_BAR(opponent); - NOT ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PSN, opponent); - NOT STATUS_ICON(opponent, poison: TRUE); - } -} - -SINGLE_BATTLE_TEST("Poison cannot be inflicted on Steel-type Pokémon") -{ - GIVEN { ASSUME(gSpeciesInfo[SPECIES_REGISTEEL].types[0] == TYPE_STEEL); PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_REGISTEEL); + OPPONENT(mon); } WHEN { TURN { MOVE(player, MOVE_TWINEEDLE); } } SCENE { diff --git a/test/battle/move_effect/solar_beam.c b/test/battle/move_effect/solar_beam.c index e767a3c9ca4f..6aa8056b728b 100644 --- a/test/battle/move_effect/solar_beam.c +++ b/test/battle/move_effect/solar_beam.c @@ -7,25 +7,16 @@ ASSUMPTIONS ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); } -SINGLE_BATTLE_TEST("Solar Beam can be used instantly in Sunlight") +SINGLE_BATTLE_TEST("Solar Beam and Solar Blade can be used instantly in Sunlight") { + u32 move; + PARAMETRIZE { move = MOVE_SOLAR_BEAM; } + PARAMETRIZE { move = MOVE_SOLAR_BLADE; } GIVEN { PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { - TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_SOLAR_BEAM); } - } SCENE { - NOT MESSAGE("Wobbuffet took in sunlight!"); - } -} - -SINGLE_BATTLE_TEST("Solar Blade can be used instantly in Sunlight") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_SOLAR_BLADE); } + TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, move); } } SCENE { NOT MESSAGE("Wobbuffet took in sunlight!"); } @@ -37,7 +28,6 @@ SINGLE_BATTLE_TEST("Solar Beam's power is halved in Rain", s16 damage) PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_RAIN_DANCE; } GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { @@ -56,7 +46,6 @@ SINGLE_BATTLE_TEST("Solar Blade's power is halved in Rain", s16 damage) PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_RAIN_DANCE; } GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WYNAUT); } WHEN { @@ -75,7 +64,6 @@ SINGLE_BATTLE_TEST("Solar Beam's power is halved in a Sandstorm", s16 damage) PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_SANDSTORM; } GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; } WHEN { @@ -94,7 +82,6 @@ SINGLE_BATTLE_TEST("Solar Blade's power is halved in a Sandstorm", s16 damage) PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_SANDSTORM; } GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; } WHEN { @@ -113,7 +100,6 @@ SINGLE_BATTLE_TEST("Solar Beam's power is halved in Hail", s16 damage) PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_HAIL; } GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; } WHEN { @@ -132,7 +118,6 @@ SINGLE_BATTLE_TEST("Solar Blade's power is halved in Hail", s16 damage) PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_HAIL; } GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_SAFETY_GOGGLES); }; } WHEN { @@ -151,7 +136,6 @@ SINGLE_BATTLE_TEST("Solar Beam's power is halved in Snow", s16 damage) PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_SNOWSCAPE; } GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BEAM].effect == EFFECT_SOLAR_BEAM); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { @@ -170,7 +154,6 @@ SINGLE_BATTLE_TEST("Solar Blade's power is halved in Snow", s16 damage) PARAMETRIZE{ move = MOVE_CELEBRATE; } PARAMETRIZE{ move = MOVE_SNOWSCAPE; } GIVEN { - ASSUME(gBattleMoves[MOVE_SOLAR_BLADE].effect == EFFECT_SOLAR_BEAM); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WYNAUT); } WHEN { diff --git a/test/battle/move_effect/synthesis.c b/test/battle/move_effect/synthesis.c index 081f899b26ed..7b0c260fa07a 100644 --- a/test/battle/move_effect/synthesis.c +++ b/test/battle/move_effect/synthesis.c @@ -30,49 +30,18 @@ SINGLE_BATTLE_TEST("Synthesis recovers 2/3 of the user's max HP in Sunlight") } } -SINGLE_BATTLE_TEST("Synthesis recovers 1/4 of the user's max HP in Rain") +SINGLE_BATTLE_TEST("Synthesis 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_RAIN_DANCE); MOVE(player, MOVE_SYNTHESIS); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Synthesis recovers 1/4 of the user's max HP in a Sandstorm") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SANDSTORM); MOVE(player, MOVE_SYNTHESIS); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Synthesis recovers 1/4 of the user's max HP in Hail") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_HAIL); MOVE(player, MOVE_SYNTHESIS); } - } SCENE { - HP_BAR(player, damage: -(400 / 4)); - } -} - -SINGLE_BATTLE_TEST("Synthesis recovers 1/4 of the user's max HP in Snow") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_SYNTHESIS); } + TURN { MOVE(opponent, move); MOVE(player, MOVE_SYNTHESIS); } } SCENE { HP_BAR(player, damage: -(400 / 4)); }