From c46f8541f9237f154c894d4cd68762729c1da154 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Tue, 14 Jan 2025 21:18:00 +0100 Subject: [PATCH] =?UTF-8?q?Fixes=20self=20effect=20moves=20not=20procing?= =?UTF-8?q?=20for=20spread=20moves=20when=20battler=203=20w=E2=80=A6=20(#6?= =?UTF-8?q?020)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/battle_script_commands.c | 8 ++-- .../move_effects_combined/make_it_rain.c | 43 +++++++++++++++++++ 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index b602cdedf3..3846c55d7f 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -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) diff --git a/test/battle/move_effects_combined/make_it_rain.c b/test/battle/move_effects_combined/make_it_rain.c index e9c8b153ce..e0e00015a4 100644 --- a/test/battle/move_effects_combined/make_it_rain.c +++ b/test/battle/move_effects_combined/make_it_rain.c @@ -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!"); + } +}