Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last fix for Sparkling Aria / Covert Cloak / Shield Dust interaction #5956

Merged
merged 3 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/battle_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,5 +338,6 @@ bool32 IsSleepClauseEnabled();
void ClearDamageCalcResults(void);
u32 DoesDestinyBondFail(u32 battler);
bool32 IsMoveEffectBlockedByTarget(u32 ability);
u32 NumAffectedSpreadMoveTargets(void);

#endif // GUARD_BATTLE_UTIL_H
2 changes: 1 addition & 1 deletion src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -6275,7 +6275,7 @@ static void Cmd_moveend(void)
if ((gBattleMons[gBattlerTarget].status1 & argStatus)
&& IsBattlerAlive(gBattlerTarget)
&& !DoesSubstituteBlockMove(gBattlerAttacker, gBattlerTarget, gCurrentMove)
&& (gBattleStruct->numSpreadTargets > 1 || !IsMoveEffectBlockedByTarget(GetBattlerAbility(gBattlerTarget))))
&& (NumAffectedSpreadMoveTargets() > 1 || !IsMoveEffectBlockedByTarget(GetBattlerAbility(gBattlerTarget))))
{
gBattleMons[gBattlerTarget].status1 &= ~(argStatus);

Expand Down
17 changes: 17 additions & 0 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -12222,3 +12222,20 @@ bool32 IsMoveEffectBlockedByTarget(u32 ability)

return FALSE;
}

u32 NumAffectedSpreadMoveTargets(void)
{
u32 targetCount = 1;

if (!IsDoubleSpreadMove())
return targetCount;

targetCount = 0;
for (u32 battler = 0; battler < gBattlersCount; battler++)
{
if (MoveResultHasEffect(battler))
targetCount++;
}

return targetCount;
}
1 change: 0 additions & 1 deletion test/battle/ability/shield_dust.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ DOUBLE_BATTLE_TEST("Shield Dust does or does not block Sparkling Aria depending

DOUBLE_BATTLE_TEST("Shield Dust blocks Sparkling Aria if all other targets avoid getting hit by")
{
KNOWN_FAILING; // #4636
GIVEN {
PLAYER(SPECIES_PRIMARINA);
PLAYER(SPECIES_VIVILLON) { Ability(ABILITY_SHIELD_DUST); Status1(STATUS1_BURN); }
Expand Down
25 changes: 25 additions & 0 deletions test/battle/hold_effect/covert_cloak.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,31 @@ DOUBLE_BATTLE_TEST("Covert Cloak does or does not block Sparkling Aria depending
}
}

DOUBLE_BATTLE_TEST("Covert Cloak does block Sparkling Aria when only one mon is hit")
{
u32 move;
PARAMETRIZE { move = MOVE_PROTECT; }
PARAMETRIZE { move = MOVE_FLY; }

GIVEN {
PLAYER(SPECIES_WYNAUT);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_COVERT_CLOAK); Status1(STATUS1_BURN); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponentRight, move, target: playerLeft);
MOVE(playerRight, move, target: opponentRight);
MOVE(playerLeft, MOVE_SPARKLING_ARIA); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, move, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_SPARKLING_ARIA, playerLeft);
NONE_OF {
MESSAGE("The opposing Wobbuffet's burn was cured!");
STATUS_ICON(opponentLeft, none: TRUE);
}
}
}

SINGLE_BATTLE_TEST("Covert Cloak blocks Sparkling Aria in singles")
{
GIVEN {
Expand Down
Loading