From 99ba36b446c79c4b671077c966a71eeacfc9c446 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Tue, 17 Dec 2024 09:47:37 +0100 Subject: [PATCH] Fixes Tidy Up (#5819) --- data/battle_scripts_1.s | 6 ++++++ src/battle_script_commands.c | 4 ++-- test/battle/move_effect/tidy_up.c | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 1eb74cea31..2441b9547d 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -134,7 +134,11 @@ BattleScript_EffectTidyUp:: pause B_WAIT_TIME_MED ppreduce waitstate + saveattacker + savetarget trytidyup FALSE, BattleScript_EffectTidyUpDoMoveAnimation + restoreattacker + restoretarget goto BattleScript_EffectDragonDanceFromStatUp BattleScript_EffectTidyUpDoMoveAnimation:: @@ -143,6 +147,8 @@ BattleScript_EffectTidyUpDoMoveAnimation:: trytidyup TRUE, NULL printstring STRINGID_TIDYINGUPCOMPLETE waitmessage B_WAIT_TIME_LONG + restoreattacker + restoretarget goto BattleScript_EffectDragonDanceFromStatUp BattleScript_EffectUpperHand:: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index f37a18b2ed..1d03cf3f56 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8839,8 +8839,8 @@ static bool32 TryDefogClear(u32 battlerAtk, bool32 clear) static bool32 TryTidyUpClear(u32 battlerAtk, bool32 clear) { - s32 i; - u8 saveBattler = gBattlerAttacker; + u32 i; + u32 saveBattler = gBattlerAttacker; for (i = 0; i < NUM_BATTLE_SIDES; i++) { diff --git a/test/battle/move_effect/tidy_up.c b/test/battle/move_effect/tidy_up.c index 986e9a2ba3..fcb78ba962 100644 --- a/test/battle/move_effect/tidy_up.c +++ b/test/battle/move_effect/tidy_up.c @@ -99,3 +99,24 @@ AI_SINGLE_BATTLE_TEST("AI will try to remove hazards if slower then target even TURN { EXPECT_MOVE(opponent, MOVE_TIDY_UP); } } } + +SINGLE_BATTLE_TEST("Tidy Up raises Attack and Speed by one after clearing hazards on opposing field") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_STEALTH_ROCK); } + TURN { MOVE(player, MOVE_TIDY_UP); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_STEALTH_ROCK, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TIDY_UP, player); + MESSAGE("Tidying up complete!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + MESSAGE("Wobbuffet's Attack rose!"); + MESSAGE("Wobbuffet's Speed rose!"); + } THEN { + EXPECT_EQ(player->statStages[STAT_ATK], DEFAULT_STAT_STAGE + 1); + EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE + 1); + } +}