B_BINDING_TURNS config tests (#8595)

This commit is contained in:
Eduardo Quezada 2025-12-20 11:24:39 -03:00 committed by GitHub
parent 44b658935f
commit 36e71c8236
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 11 deletions

View File

@ -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 */ \

View File

@ -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.

View File

@ -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
}
}