From 3598a187031c7b93c760919bc2bc8826c638609f Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sun, 11 Feb 2024 10:40:30 +0100 Subject: [PATCH] Adds config for Soundproof change during Uproar status (#4174) --- include/config/battle.h | 1 + src/battle_script_commands.c | 4 ++-- test/battle/move_effect/uproar.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 test/battle/move_effect/uproar.c diff --git a/include/config/battle.h b/include/config/battle.h index a003b8f5d8..2d40bdbdb2 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -50,6 +50,7 @@ // Turn settings #define B_BINDING_TURNS GEN_LATEST // In Gen5+, binding moves last for 4-5 turns instead of 2-5 turns. (With Grip Claw, 7 and 5 turns respectively.) #define B_UPROAR_TURNS GEN_LATEST // In Gen5+, Uproar lasts for 3 turns instead of 2-5 turns. +#define B_UPROAR_IGNORE_SOUNDPROOF GEN_LATEST // In Gen5+, Uproar status ignores Soundproof. #define B_DISABLE_TURNS GEN_LATEST // Disable's turns. See Cmd_disablelastusedattack. #define B_TAILWIND_TURNS GEN_LATEST // In Gen5+, Tailwind lasts 4 turns instead of 3. #define B_SLEEP_TURNS GEN_LATEST // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8d4df643c8..9965b3e80d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2848,7 +2848,7 @@ void SetMoveEffect(bool32 primary, u32 certain) { case STATUS1_SLEEP: // check active uproar - if (battlerAbility != ABILITY_SOUNDPROOF) + if (battlerAbility != ABILITY_SOUNDPROOF || B_UPROAR_IGNORE_SOUNDPROOF >= GEN_5) { for (i = 0; i < gBattlersCount && !(gBattleMons[i].status2 & STATUS2_UPROAR); i++) ; @@ -11004,7 +11004,7 @@ bool8 UproarWakeUpCheck(u8 battler) for (i = 0; i < gBattlersCount; i++) { - if (!(gBattleMons[i].status2 & STATUS2_UPROAR) || GetBattlerAbility(battler) == ABILITY_SOUNDPROOF) + if (!(gBattleMons[i].status2 & STATUS2_UPROAR) || (GetBattlerAbility(battler) == ABILITY_SOUNDPROOF && B_UPROAR_IGNORE_SOUNDPROOF < GEN_5)) continue; gBattleScripting.battler = i; diff --git a/test/battle/move_effect/uproar.c b/test/battle/move_effect/uproar.c new file mode 100644 index 0000000000..a4faab1efa --- /dev/null +++ b/test/battle/move_effect/uproar.c @@ -0,0 +1,28 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_UPROAR].effect == EFFECT_UPROAR); +} + +DOUBLE_BATTLE_TEST("Uproar status causes sleeping pokemon to wake up during an attack") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_SLEEP); } + OPPONENT(SPECIES_VOLTORB) { Ability(ABILITY_SOUNDPROOF); Status1(STATUS1_SLEEP); } + OPPONENT(SPECIES_WOBBUFFET) { Status1(STATUS1_SLEEP); } + } WHEN { + TURN { MOVE(playerLeft, MOVE_UPROAR); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_UPROAR, playerLeft); + HP_BAR(opponentRight); + MESSAGE("Wobbuffet woke up in the UPROAR!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, playerRight); + MESSAGE("Foe Voltorb woke up in the UPROAR!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponentLeft); + MESSAGE("Foe Wobbuffet woke up in the UPROAR!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponentRight); + } +}