diff --git a/test/battle/ability/heavy_metal.c b/test/battle/ability/heavy_metal.c index baaa039b19..2257b5d068 100644 --- a/test/battle/ability/heavy_metal.c +++ b/test/battle/ability/heavy_metal.c @@ -1,4 +1,4 @@ #include "global.h" #include "test/battle.h" -TO_DO_BATTLE_TEST("TODO: Write Heavy Metal (Ability) test titles") +// Tests for Heavy Metal are handled in test/battle/ability/light_metal.c diff --git a/test/battle/ability/light_metal.c b/test/battle/ability/light_metal.c index 8ad4a6a4b5..d09204c25d 100644 --- a/test/battle/ability/light_metal.c +++ b/test/battle/ability/light_metal.c @@ -1,4 +1,30 @@ #include "global.h" #include "test/battle.h" -TO_DO_BATTLE_TEST("TODO: Write Light Metal (Ability) test titles") +SINGLE_BATTLE_TEST("Light Metal and Heavy Metal affect the power of Low Kick", s16 damage) +{ + enum Ability ability; + PARAMETRIZE { ability = ABILITY_LIGHT_METAL; } // 10.0 - 24.9 kg (40 power) + PARAMETRIZE { ability = ABILITY_STALWART; } // 25.0 - 49.9 kg (60 power) + PARAMETRIZE { ability = ABILITY_HEAVY_METAL; } // 50.0 - 99.9 kg (80 power) + + GIVEN { + ASSUME(GetMoveEffect(MOVE_SOAK) == EFFECT_SOAK); + ASSUME(GetMoveArgType(MOVE_SOAK) == TYPE_WATER); + ASSUME(GetSpeciesWeight(SPECIES_DURALUDON) == 400); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_DURALUDON) { Ability(ability); } + } WHEN { + TURN { MOVE(player, MOVE_SOAK); } // To remove super-effectiveness, as it was messing with calculations. + TURN { MOVE(player, MOVE_LOW_KICK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_LOW_KICK, player); + HP_BAR(opponent, captureDamage: &results[i].damage); + } THEN { + // Calc 20 power increase, with the first iteration being 40 power + if (i != 0) + EXPECT_MUL_EQ(results[0].damage, Q_4_12((i * 0.5) + 1), results[i].damage); + } +} + +TO_DO_BATTLE_TEST("Light Metal and Heavy Metal don't affect Heavy Ball's multiplier") diff --git a/test/battle/hold_effect/float_stone.c b/test/battle/hold_effect/float_stone.c index f677c41369..88221a7122 100644 --- a/test/battle/hold_effect/float_stone.c +++ b/test/battle/hold_effect/float_stone.c @@ -1,4 +1,32 @@ #include "global.h" #include "test/battle.h" -TO_DO_BATTLE_TEST("TODO: Write Float Stone (Hold Effect) test titles") +ASSUMPTIONS +{ + ASSUME(GetItemHoldEffect(ITEM_FLOAT_STONE) == HOLD_EFFECT_FLOAT_STONE); +} + +SINGLE_BATTLE_TEST("Float Stone halves the holder's weight", s16 damage) +{ + u32 item; + PARAMETRIZE { item = ITEM_FLOAT_STONE; } // 10.0 - 24.9 kg (40 power) + PARAMETRIZE { item = ITEM_NONE; } // 25.0 - 49.9 kg (60 power) + + GIVEN { + ASSUME(GetMoveEffect(MOVE_SOAK) == EFFECT_SOAK); + ASSUME(GetMoveArgType(MOVE_SOAK) == TYPE_WATER); + ASSUME(GetSpeciesWeight(SPECIES_DURALUDON) == 400); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_DURALUDON) { Ability(ABILITY_STALWART); Item(item); } + } WHEN { + TURN { MOVE(player, MOVE_SOAK); } // To remove super-effectiveness, as it was messing with calculations. + TURN { MOVE(player, MOVE_LOW_KICK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_LOW_KICK, player); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); + } +} + +TO_DO_BATTLE_TEST("Float Stone doesn't affect Heavy Ball's multiplier") diff --git a/test/battle/move_effect/autotomize.c b/test/battle/move_effect/autotomize.c index 79a71ecbc7..e749ea1cbc 100644 --- a/test/battle/move_effect/autotomize.c +++ b/test/battle/move_effect/autotomize.c @@ -1,12 +1,45 @@ #include "global.h" #include "test/battle.h" -TO_DO_BATTLE_TEST("Autotomize increases Speed by 2 stages"); -TO_DO_BATTLE_TEST("Autotomize decreases weight by 100kg (220 lbs.)"); -TO_DO_BATTLE_TEST("Autotomize can be used multiple times to decrease weight each time"); +TO_DO_BATTLE_TEST("Autotomize increases Speed by 2 stages") + +SINGLE_BATTLE_TEST("Autotomize decreases weight by 100kg (220 lbs.) each time it's used") +{ + s16 damage[3]; + + GIVEN { + ASSUME(GetSpeciesWeight(SPECIES_METANG) == 2025); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_METANG); + } WHEN { + TURN { MOVE(player, MOVE_LOW_KICK); } + TURN { MOVE(opponent, MOVE_AUTOTOMIZE); MOVE(player, MOVE_LOW_KICK); } + TURN { MOVE(opponent, MOVE_AUTOTOMIZE); MOVE(player, MOVE_LOW_KICK); } + } SCENE { + // 200.0 kg or more (120 power) + ANIMATION(ANIM_TYPE_MOVE, MOVE_LOW_KICK, player); + HP_BAR(opponent, captureDamage: &damage[0]); + + // 100.0 - 199.9 kg (100 power) + ANIMATION(ANIM_TYPE_MOVE, MOVE_AUTOTOMIZE, opponent); + ANIMATION(ANIM_TYPE_MOVE, MOVE_LOW_KICK, player); + HP_BAR(opponent, captureDamage: &damage[1]); + + // 0.1 - 9.9 kg (20 power) + ANIMATION(ANIM_TYPE_MOVE, MOVE_AUTOTOMIZE, opponent); + ANIMATION(ANIM_TYPE_MOVE, MOVE_LOW_KICK, player); + HP_BAR(opponent, captureDamage: &damage[2]); + } THEN { + EXPECT_MUL_EQ(damage[2], Q_4_12(6.0), damage[0]); + EXPECT_MUL_EQ(damage[2], Q_4_12(5.0), damage[0]); + } +} + + TO_DO_BATTLE_TEST("Autotomize cannot decrease weight below 0.1kg (0.2 lbs)"); TO_DO_BATTLE_TEST("Autotomize's weight reduction cannot be Baton Passed"); TO_DO_BATTLE_TEST("Autotomize's weight reduction cannot be removed by Haze"); TO_DO_BATTLE_TEST("Autotomize's weight reduction is reset upon form change (Gen6+)"); TO_DO_BATTLE_TEST("Autotomize's weight reduction is reset upon switch"); TO_DO_BATTLE_TEST("Autotomize's weight reduction is reset upon fainting"); +TO_DO_BATTLE_TEST("Autotomize doesn't affect Heavy Ball's multiplier") diff --git a/test/battle/move_effect/low_kick.c b/test/battle/move_effect/low_kick.c index c68b152e2d..d88996aba6 100644 --- a/test/battle/move_effect/low_kick.c +++ b/test/battle/move_effect/low_kick.c @@ -1,4 +1,29 @@ #include "global.h" #include "test/battle.h" -TO_DO_BATTLE_TEST("TODO: Write Low Kick (Move Effect) test titles") +SINGLE_BATTLE_TEST("Low Kick's damage varies based on the target's weight", s16 damage) +{ + u32 species, weight; + + PARAMETRIZE { species = SPECIES_CUBONE; weight = 65; } // 0.1 - 9.9 kg (20 power) + PARAMETRIZE { species = SPECIES_SANDSHREW; weight = 120; } // 10.0 - 24.9 kg (40 power) + PARAMETRIZE { species = SPECIES_MAROWAK; weight = 450; } // 25.0 - 49.9 kg (60 power) + PARAMETRIZE { species = SPECIES_SANDACONDA; weight = 655; } // 50.0 - 99.9 kg (80 power) + PARAMETRIZE { species = SPECIES_DONPHAN; weight = 1200; } // 100.0 - 199.9 kg (100 power) + PARAMETRIZE { species = SPECIES_HIPPOWDON; weight = 3000; } // 200.0 kg or more (120 power) + + GIVEN { + ASSUME(GetSpeciesWeight(species) == weight); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(species) { Defense(170); } // Cubone's Defense, the lowest one in hopes of avoid distorting the results. + } WHEN { + TURN { MOVE(player, MOVE_LOW_KICK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_LOW_KICK, player); + HP_BAR(opponent, captureDamage: &results[i].damage); + } THEN { + // Since Low Kick increases by 20 each tier, multiply by tier number to compare with the first tier. + if (i != 0) + EXPECT_MUL_EQ(results[0].damage, Q_4_12(i + 1), results[i].damage); + } +} diff --git a/test/battle/move_effect/sky_drop.c b/test/battle/move_effect/sky_drop.c index b3bc6739af..29cb431bb4 100644 --- a/test/battle/move_effect/sky_drop.c +++ b/test/battle/move_effect/sky_drop.c @@ -68,7 +68,7 @@ DOUBLE_BATTLE_TEST("Sky Drop is cancelled if Gravity activated") } } -SINGLE_BATTLE_TEST("Sky Drop fails on heavy targets") +SINGLE_BATTLE_TEST("Sky Drop fails on targets heavier or equal than 200kg") { GIVEN { ASSUME(gSpeciesInfo[SPECIES_METAGROSS].weight >= 2000);