diff --git a/include/constants/generational_changes.h b/include/constants/generational_changes.h index 755a4d1186..2fae8ee886 100644 --- a/include/constants/generational_changes.h +++ b/include/constants/generational_changes.h @@ -47,7 +47,7 @@ F(ROOST_PURE_FLYING, roostPureFlying, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ F(STATUS_TYPE_IMMUNITY, statusTypeImmunity, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ /* Turn settings */ \ - F(BINDING_TURNS, bindingTurns, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ + F(BINDING_TURNS, bindingTurns, (u32, GEN_COUNT - 1)) \ F(UPROAR_TURNS, uproarTurns, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ F(UPROAR_IGNORE_SOUNDPROOF, uproarIgnoreSoundproof, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ F(DISABLE_TURNS, disableTurns, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9dbbbe914d..babb89c0b9 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3213,9 +3213,9 @@ void SetMoveEffect(u32 battler, u32 effectBattler, enum MoveEffect moveEffect, c else { if (GetBattlerHoldEffect(gBattlerAttacker) == HOLD_EFFECT_GRIP_CLAW) - gDisableStructs[gEffectBattler].wrapTurns = B_BINDING_TURNS >= GEN_5 ? 7 : 5; + gDisableStructs[gEffectBattler].wrapTurns = GetConfig(CONFIG_BINDING_TURNS) >= GEN_5 ? 7 : 5; else - gDisableStructs[gEffectBattler].wrapTurns = B_BINDING_TURNS >= GEN_5 ? RandomUniform(RNG_WRAP, 4, 5) : RandomUniform(RNG_WRAP, 2, 5); + gDisableStructs[gEffectBattler].wrapTurns = GetConfig(CONFIG_BINDING_TURNS) >= GEN_5 ? RandomUniform(RNG_WRAP, 4, 5) : RandomUniform(RNG_WRAP, 2, 5); gBattleMons[gEffectBattler].volatiles.wrapped = TRUE; gBattleMons[gEffectBattler].volatiles.wrappedMove = gCurrentMove; gBattleMons[gEffectBattler].volatiles.wrappedBy = gBattlerAttacker; @@ -3975,7 +3975,7 @@ void SetMoveEffect(u32 battler, u32 effectBattler, enum MoveEffect moveEffect, c { gBattleMons[battler].volatiles.wrapped = TRUE; if (GetBattlerHoldEffect(gBattlerAttacker) == HOLD_EFFECT_GRIP_CLAW) - gDisableStructs[battler].wrapTurns = (B_BINDING_TURNS >= GEN_5) ? 7 : 5; + gDisableStructs[battler].wrapTurns = (GetConfig(CONFIG_BINDING_TURNS) >= GEN_5) ? 7 : 5; else gDisableStructs[battler].wrapTurns = (Random() % 2) + 4; // The Wrap effect does not expire when the user switches, so here's some cheese. diff --git a/test/battle/move_effect_secondary/wrap.c b/test/battle/move_effect_secondary/wrap.c index dc05bbe288..2e430871fd 100644 --- a/test/battle/move_effect_secondary/wrap.c +++ b/test/battle/move_effect_secondary/wrap.c @@ -6,10 +6,14 @@ ASSUMPTIONS ASSUME(MoveHasAdditionalEffect(MOVE_WRAP, MOVE_EFFECT_WRAP)); } -SINGLE_BATTLE_TEST("Wrap can damage the wrapped mon for 5 turns 50% of the time") +SINGLE_BATTLE_TEST("Wrap can damage the wrapped mon for 5 turns 25% (Gen3-4) or 50% (Gen5+) of the time") { - PASSES_RANDOMLY(50, 100, RNG_WRAP); + u32 config, passes, trials; + PARAMETRIZE { config = GEN_4; passes = 25; trials = 100; } + PARAMETRIZE { config = GEN_5; passes = 50; trials = 100; } + PASSES_RANDOMLY(passes, trials, RNG_WRAP); GIVEN { + WITH_CONFIG(CONFIG_BINDING_TURNS, config); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { @@ -32,10 +36,14 @@ SINGLE_BATTLE_TEST("Wrap can damage the wrapped mon for 5 turns 50% of the time" } } -SINGLE_BATTLE_TEST("Wrap can damage the wrapped mon for 4 turns 50% of the time") +SINGLE_BATTLE_TEST("Wrap can damage the wrapped mon for 4 turns 25% (Gen3-4) or 50% (Gen5+) of the time") { - PASSES_RANDOMLY(50, 100, RNG_WRAP); + u32 config, passes, trials; + PARAMETRIZE { config = GEN_4; passes = 25; trials = 100; } + PARAMETRIZE { config = GEN_5; passes = 50; trials = 100; } + PASSES_RANDOMLY(passes, trials, RNG_WRAP); GIVEN { + WITH_CONFIG(CONFIG_BINDING_TURNS, config); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { @@ -56,9 +64,13 @@ SINGLE_BATTLE_TEST("Wrap can damage the wrapped mon for 4 turns 50% of the time" } } -SINGLE_BATTLE_TEST("Wrap can damage the wrapped mon 7 turns while holding a Grip Claw") +SINGLE_BATTLE_TEST("Wrap can damage the wrapped mon 5 turns (Gen4) or 7 turns (Gen5+) while holding a Grip Claw") { + u32 config; + PARAMETRIZE { config = GEN_4; } + PARAMETRIZE { config = GEN_5; } GIVEN { + WITH_CONFIG(CONFIG_BINDING_TURNS, config); PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_GRIP_CLAW); } OPPONENT(SPECIES_WOBBUFFET); } WHEN { @@ -79,8 +91,10 @@ SINGLE_BATTLE_TEST("Wrap can damage the wrapped mon 7 turns while holding a Grip HP_BAR(opponent); // Residual Damage HP_BAR(opponent); // Residual Damage HP_BAR(opponent); // Residual Damage - HP_BAR(opponent); // Residual Damage - HP_BAR(opponent); // Residual Damage + if (config >= GEN_5) { + HP_BAR(opponent); // Residual Damage + HP_BAR(opponent); // Residual Damage + } NOT HP_BAR(opponent); // Residual Damage } }