Fixed Stomping Tantrum not doubling in damage if the user failed Protect (#8008)

This commit is contained in:
Eduardo Quezada 2025-10-22 10:20:44 -03:00 committed by GitHub
parent 2416bfb53b
commit dc0d910182
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 28 additions and 1 deletions

View File

@ -217,6 +217,7 @@ enum RandomTag
RNG_WRAP,
RNG_BALLTHROW_CRITICAL,
RNG_BALLTHROW_SHAKE,
RNG_PROTECT_FAIL,
};
#define RandomWeighted(tag, ...) \

View File

@ -9575,7 +9575,7 @@ static void Cmd_setprotectlike(void)
if (gCurrentTurnActionNumber == (gBattlersCount - 1))
notLastTurn = FALSE;
if ((sProtectSuccessRates[gDisableStructs[gBattlerAttacker].protectUses] >= Random() && notLastTurn)
if ((sProtectSuccessRates[gDisableStructs[gBattlerAttacker].protectUses] >= RandomUniform(RNG_PROTECT_FAIL, 0, USHRT_MAX) && notLastTurn)
|| (protectMethod == PROTECT_WIDE_GUARD && B_WIDE_GUARD != GEN_5)
|| (protectMethod == PROTECT_QUICK_GUARD && B_QUICK_GUARD != GEN_5))
{
@ -9604,6 +9604,7 @@ static void Cmd_setprotectlike(void)
gDisableStructs[gBattlerAttacker].protectUses = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PROTECT_FAILED;
gBattleStruct->moveResultFlags[gBattlerTarget] |= MOVE_RESULT_MISSED;
gBattleStruct->battlerState[gBattlerAttacker].stompingTantrumTimer = 2;
}
gBattlescriptCurrInstr = cmd->nextInstr;

View File

@ -90,6 +90,31 @@ SINGLE_BATTLE_TEST("Stomping Tantrum will not deal double damage if target prote
}
}
SINGLE_BATTLE_TEST("Stomping Tantrum will deal double damage if user failed a Protect")
{
s16 damage[2];
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); }
TURN { MOVE(player, MOVE_PROTECT); }
TURN { MOVE(player, MOVE_PROTECT, WITH_RNG(RNG_PROTECT_FAIL, USHRT_MAX)); }
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[0]);
ANIMATION(ANIM_TYPE_MOVE, MOVE_PROTECT, player);
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_PROTECT, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[1]);
} THEN {
EXPECT_MUL_EQ(damage[0], Q_4_12(2.0), damage[1]);
}
}
SINGLE_BATTLE_TEST("Stomping Tantrum will not deal double if it missed")
{
s16 damage[2];