Expanded B_SANDSTORM_SPDEF_BOOST test (#8532)

This commit is contained in:
Eduardo Quezada 2025-12-14 14:14:27 -03:00 committed by GitHub
parent 26688dd1ce
commit 5700fb08a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 7 deletions

View File

@ -179,7 +179,7 @@
F(IRON_BALL, ironBall, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \
/* Weather settings */ \
F(ABILITY_WEATHER, abilityWeather, (u32, GEN_COUNT - 1)) \
F(SANDSTORM_SPDEF_BOOST, sandstormSpDefBoost, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \
F(SANDSTORM_SPDEF_BOOST, sandstormSpDefBoost, (u32, GEN_COUNT - 1)) \
F(OVERWORLD_FOG, overworldFog, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \
F(OVERWORLD_SNOW, overworldSnow, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \
F(SNOW_WARNING, snowWarning, (u32, GEN_COUNT - 1)) \

View File

@ -8046,7 +8046,7 @@ static inline u32 CalcDefenseStat(struct DamageContext *ctx)
}
// sandstorm sp.def boost for rock types
if (B_SANDSTORM_SPDEF_BOOST >= GEN_4 && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ROCK) && IsBattlerWeatherAffected(battlerDef, B_WEATHER_SANDSTORM) && !usesDefStat)
if (GetConfig(CONFIG_SANDSTORM_SPDEF_BOOST) >= GEN_4 && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ROCK) && IsBattlerWeatherAffected(battlerDef, B_WEATHER_SANDSTORM) && !usesDefStat)
modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5));
// snow def boost for ice types
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE) && IsBattlerWeatherAffected(battlerDef, B_WEATHER_SNOW) && usesDefStat)

View File

@ -17,12 +17,14 @@ SINGLE_BATTLE_TEST("Sandstorm deals 1/16 damage per turn")
} THEN { EXPECT_EQ(sandstormDamage, opponent->maxHP / 16); }
}
SINGLE_BATTLE_TEST("Sandstorm multiplies the special defense of Rock-types by 1.5x", s16 damage)
SINGLE_BATTLE_TEST("Sandstorm multiplies the special defense of Rock-types by 1.5x (Gen4+)", s16 damage)
{
u16 move;
PARAMETRIZE { move = MOVE_SANDSTORM; }
PARAMETRIZE { move = MOVE_CELEBRATE; }
u32 move, config;
PARAMETRIZE { move = MOVE_CELEBRATE; config = GEN_3; }
PARAMETRIZE { move = MOVE_SANDSTORM; config = GEN_3; }
PARAMETRIZE { move = MOVE_SANDSTORM; config = GEN_4; }
GIVEN {
WITH_CONFIG(CONFIG_SANDSTORM_SPDEF_BOOST, config);
ASSUME(GetMoveCategory(MOVE_SWIFT) == DAMAGE_CATEGORY_SPECIAL);
PLAYER(SPECIES_WOBBUFFET) ;
OPPONENT(SPECIES_NOSEPASS);
@ -32,7 +34,8 @@ SINGLE_BATTLE_TEST("Sandstorm multiplies the special defense of Rock-types by 1.
} SCENE {
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage);
EXPECT_MUL_EQ(results[2].damage, Q_4_12(1.5), results[0].damage);
EXPECT_MUL_EQ(results[2].damage, Q_4_12(1.5), results[1].damage);
}
}