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

This commit is contained in:
Alex 2025-01-06 12:03:41 +01:00 committed by GitHub
parent 40ba25dd3e
commit 5317371fea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 44 additions and 2 deletions

View file

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

View file

@ -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);

View file

@ -12224,3 +12224,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;
}

View file

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

View file

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