From be9879f94a2774b384ec1a4e882e52c880ac70d9 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Thu, 18 Dec 2025 20:48:54 -0300 Subject: [PATCH] `B_IRON_BALL` config test (#8569) --- include/constants/generational_changes.h | 2 +- src/battle_util.c | 2 +- test/battle/hold_effect/iron_ball.c | 13 ++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/constants/generational_changes.h b/include/constants/generational_changes.h index a22b686d77..701330ae10 100644 --- a/include/constants/generational_changes.h +++ b/include/constants/generational_changes.h @@ -176,7 +176,7 @@ F(SAFARI_BALL_MODIFIER, safariBallModifier, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ F(FRIEND_BALL_MODIFIER, friendBallModifier, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ F(SERENE_GRACE_BOOST, sereneGraceBoost, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ - F(IRON_BALL, ironBall, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ + F(IRON_BALL, ironBall, (u32, GEN_COUNT - 1)) \ /* Weather settings */ \ F(ABILITY_WEATHER, abilityWeather, (u32, GEN_COUNT - 1)) \ F(SANDSTORM_SPDEF_BOOST, sandstormSpDefBoost, (u32, GEN_COUNT - 1)) \ diff --git a/src/battle_util.c b/src/battle_util.c index 975e1f094c..ea4c918d40 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8798,7 +8798,7 @@ static inline uq4_12_t CalcTypeEffectivenessMultiplierInternal(struct DamageCont } // Iron Ball ignores type modifiers for flying-type mons if it is the only source of grounding - if (B_IRON_BALL >= GEN_5 + if (GetConfig(CONFIG_IRON_BALL) >= GEN_5 && ctx->moveType == TYPE_GROUND && ctx->holdEffectDef == HOLD_EFFECT_IRON_BALL && IS_BATTLER_OF_TYPE(ctx->battlerDef, TYPE_FLYING) diff --git a/test/battle/hold_effect/iron_ball.c b/test/battle/hold_effect/iron_ball.c index 134c47d9af..90c370e8f3 100644 --- a/test/battle/hold_effect/iron_ball.c +++ b/test/battle/hold_effect/iron_ball.c @@ -5,17 +5,24 @@ ASSUMPTIONS{ ASSUME(gItemsInfo[ITEM_IRON_BALL].holdEffect == HOLD_EFFECT_IRON_BALL); } -SINGLE_BATTLE_TEST("Ground-type moves do neutral damage to non-grounded Flying types holding Iron Ball regardless of other typings") //gen5+ only +SINGLE_BATTLE_TEST("Ground-type moves do neutral damage to non-grounded Flying types holding Iron Ball regardless of other typings (Gen5+)") { - ASSUME(B_IRON_BALL >= GEN_5); + u32 config; + PARAMETRIZE { config = GEN_4; } + PARAMETRIZE { config = GEN_5; } GIVEN { + WITH_CONFIG(CONFIG_IRON_BALL, config); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_SKARMORY) { Item(ITEM_IRON_BALL); }; } WHEN { TURN { MOVE(player, MOVE_EARTHQUAKE); }; } SCENE { ANIMATION(ANIM_TYPE_MOVE, MOVE_EARTHQUAKE, player); - NONE_OF { + if (config >= GEN_5) { + NONE_OF { + MESSAGE("It's super effective!"); + } + } else { MESSAGE("It's super effective!"); } }