Fixes self effect moves not procing for spread moves when battler 3 w… (#6020)

This commit is contained in:
Alex 2025-01-14 21:18:00 +01:00 committed by GitHub
parent 7eb96ec615
commit c46f8541f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 46 additions and 5 deletions

View File

@ -3566,7 +3566,7 @@ void SetMoveEffect(bool32 primary, bool32 certain)
// For a move that hits multiple targets (i.e. Make it Rain)
// we only want to print the message on the final hit
if (!(IsSpreadMove(moveTarget) && GetNextTarget(moveTarget, TRUE) != MAX_BATTLERS_COUNT))
if (!(NumAffectedSpreadMoveTargets() > 1 && GetNextTarget(moveTarget, TRUE) != MAX_BATTLERS_COUNT))
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_MoveEffectPayDay;
@ -4325,12 +4325,10 @@ void SetMoveEffect(bool32 primary, bool32 certain)
static bool32 CanApplyAdditionalEffect(const struct AdditionalEffect *additionalEffect)
{
u32 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove);
// Self-targeting move effects only apply after the last mon has been hit
if (additionalEffect->self
&& IsSpreadMove(moveTarget)
&& GetNextTarget(moveTarget, TRUE) != MAX_BATTLERS_COUNT)
&& NumAffectedSpreadMoveTargets() > 1
&& GetNextTarget(GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove), TRUE) != MAX_BATTLERS_COUNT)
return FALSE;
// Certain move effects only apply if the target raised stats this turn (e.g. Burning Jealousy)

View File

@ -58,3 +58,46 @@ DOUBLE_BATTLE_TEST("Make It Rain lowers special attack by one stage if it hits b
MESSAGE("Wobbuffet's Sp. Atk fell!");
}
}
DOUBLE_BATTLE_TEST("Make It Rain lowers special attack by one stage if it hits both targets")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET)
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(playerLeft, MOVE_MAKE_IT_RAIN); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_MAKE_IT_RAIN, playerLeft);
HP_BAR(opponentLeft);
NONE_OF {
MESSAGE("Coins were scattered everywhere!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft);
MESSAGE("Wobbuffet's Sp. Atk fell!");
}
HP_BAR(opponentRight);
MESSAGE("Coins were scattered everywhere!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft);
MESSAGE("Wobbuffet's Sp. Atk fell!");
}
}
DOUBLE_BATTLE_TEST("Make It Rain lowers special attack by one stage if second target Protects")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET)
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponentRight, MOVE_PROTECT); MOVE(playerLeft, MOVE_MAKE_IT_RAIN); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_PROTECT, opponentRight);
ANIMATION(ANIM_TYPE_MOVE, MOVE_MAKE_IT_RAIN, playerLeft);
HP_BAR(opponentLeft);
NOT HP_BAR(opponentRight);
MESSAGE("Coins were scattered everywhere!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft);
MESSAGE("Wobbuffet's Sp. Atk fell!");
}
}