Fixed Snore not hitting twice with Parental Bond (#5264)

Co-authored-by: Hedara <hedara90@gmail.com>
This commit is contained in:
hedara90 2024-08-26 21:59:39 +02:00 committed by GitHub
parent c075d8e6b1
commit 2e43ffd5f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 7 deletions

View file

@ -1240,10 +1240,10 @@ static void Cmd_attackcanceler(void)
}
if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_OFF
&& GetBattlerAbility(gBattlerAttacker) == ABILITY_PARENTAL_BOND
&& IsMoveAffectedByParentalBond(gCurrentMove, gBattlerAttacker)
&& !(gAbsentBattlerFlags & gBitTable[gBattlerTarget])
&& GetActiveGimmick(gBattlerAttacker) != GIMMICK_Z_MOVE)
&& GetBattlerAbility(gBattlerAttacker) == ABILITY_PARENTAL_BOND
&& IsMoveAffectedByParentalBond(gCurrentMove, gBattlerAttacker)
&& !(gAbsentBattlerFlags & gBitTable[gBattlerTarget])
&& GetActiveGimmick(gBattlerAttacker) != GIMMICK_Z_MOVE)
{
gSpecialStatuses[gBattlerAttacker].parentalBondState = PARENTAL_BOND_1ST_HIT;
gMultiHitCounter = 2;
@ -6038,9 +6038,9 @@ static void Cmd_moveend(void)
gBattlerTarget = BATTLE_PARTNER(gBattlerTarget); // Target the partner in doubles for second hit.
if (gBattleMons[gBattlerAttacker].hp
&& gBattleMons[gBattlerTarget].hp
&& (gChosenMove == MOVE_SLEEP_TALK || !(gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP))
&& !(gBattleMons[gBattlerAttacker].status1 & STATUS1_FREEZE))
&& gBattleMons[gBattlerTarget].hp
&& (gChosenMove == MOVE_SLEEP_TALK || (gChosenMove == MOVE_SNORE) || !(gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP))
&& !(gBattleMons[gBattlerAttacker].status1 & STATUS1_FREEZE))
{
if (gSpecialStatuses[gBattlerAttacker].parentalBondState)
gSpecialStatuses[gBattlerAttacker].parentalBondState--;

View file

@ -263,6 +263,29 @@ SINGLE_BATTLE_TEST("Parental Bond Smack Down effect triggers after 2nd hit")
}
}
SINGLE_BATTLE_TEST("Parental Bond Snore strikes twice while asleep")
{
s16 damage[2];
GIVEN {
ASSUME(gMovesInfo[MOVE_SNORE].effect == EFFECT_SNORE);
PLAYER(SPECIES_KANGASKHAN_MEGA) { Status1(STATUS1_SLEEP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_SNORE); }
} SCENE {
MESSAGE("Kangaskhan is fast asleep.");
ANIMATION(ANIM_TYPE_MOVE, MOVE_SNORE, player);
HP_BAR(opponent, captureDamage: &damage[0]);
HP_BAR(opponent, captureDamage: &damage[1]);
MESSAGE("Hit 2 time(s)!");
} THEN {
if (B_PARENTAL_BOND_DMG == GEN_6)
EXPECT_MUL_EQ(damage[0], Q_4_12(0.5), damage[1]);
else
EXPECT_MUL_EQ(damage[0], Q_4_12(0.25), damage[1]);
}
}
TO_DO_BATTLE_TEST("Parental Bond tests");
// Temporary TODO: Convert Bulbapedia description into tests.