From b0c76563bfe3fb9f1da047a87dc3fca525b8f0a3 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sat, 20 Jan 2024 14:10:22 +0100 Subject: [PATCH] Fixes Psychic Noise, Aroma Veil interaction in doubles (#4021) Co-authored-by: Bassoonian --- src/battle_script_commands.c | 6 ++++-- test/battle/move_effect/psychic_noise.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 642ea6f7c6..7dca24c286 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3793,9 +3793,11 @@ void SetMoveEffect(bool32 primary, bool32 certain) SetMoveEffect(primary, certain); break; case MOVE_EFFECT_PSYCHIC_NOISE: - if (GetBattlerAbility(gEffectBattler) == ABILITY_AROMA_VEIL || GetBattlerAbility(BATTLE_PARTNER(gEffectBattler)) == ABILITY_AROMA_VEIL) + battlerAbility = IsAbilityOnSide(gEffectBattler, ABILITY_AROMA_VEIL); + + if (battlerAbility) { - gBattlerAbility = gEffectBattler; + gBattlerAbility = battlerAbility - 1; BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_AromaVeilProtectsRet; } diff --git a/test/battle/move_effect/psychic_noise.c b/test/battle/move_effect/psychic_noise.c index 25d7f60795..405bbf492c 100644 --- a/test/battle/move_effect/psychic_noise.c +++ b/test/battle/move_effect/psychic_noise.c @@ -54,3 +54,20 @@ SINGLE_BATTLE_TEST("Psychic Noise heal block effect is blocked by Aroma Veil") ANIMATION(ANIM_TYPE_MOVE, MOVE_RECOVER, opponent); } } + +DOUBLE_BATTLE_TEST("Psychic Noise heal block effect is blocked by partners Aroma Veil in doubles") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_MILCERY) { Ability(ABILITY_AROMA_VEIL); } + } WHEN { + TURN { MOVE(playerLeft, MOVE_PSYCHIC_NOISE, target: opponentLeft); MOVE(opponentLeft, MOVE_RECOVER); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHIC_NOISE, playerLeft); + ABILITY_POPUP(opponentRight, ABILITY_AROMA_VEIL); + MESSAGE("Foe Wobbuffet is protected by an aromatic veil!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_RECOVER, opponentLeft); + } +}