From 1a80636ed3fdd8bbbc2cda7dbb6a090645bcfd2f Mon Sep 17 00:00:00 2001 From: AlexOn1ine Date: Wed, 18 Dec 2024 21:50:05 +0100 Subject: [PATCH 1/3] Fixes Room Serive --- data/battle_scripts_1.s | 2 +- src/battle_script_commands.c | 5 ++++- test/battle/move_effect/hit_escape.c | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 2441b9547d00..d8eb279661e0 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -9101,7 +9101,7 @@ BattleScript_BerryStatRaiseEnd2:: BattleScript_BerryStatRaiseEnd2_AbilityPopup: call BattleScript_AbilityPopUp BattleScript_BerryStatRaiseEnd2_Anim: - statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_BerryStatRaiseEnd2_End + statbuffchange STAT_CHANGE_ALLOW_PTR | MOVE_EFFECT_AFFECTS_USER, BattleScript_BerryStatRaiseEnd2_End setgraphicalstatchangevalues playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, sB_ANIM_ARG1 setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_ROSE_ITEM diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 1d03cf3f5612..9fed169073de 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -11920,7 +11920,10 @@ static void Cmd_statbuffchange(void) const u8 *ptrBefore = gBattlescriptCurrInstr; const u8 *failInstr = cmd->failInstr; - if (ChangeStatBuffs(GET_STAT_BUFF_VALUE_WITH_SIGN(gBattleScripting.statChanger), GET_STAT_BUFF_ID(gBattleScripting.statChanger), flags, failInstr) == STAT_CHANGE_WORKED) + if (ChangeStatBuffs(GET_STAT_BUFF_VALUE_WITH_SIGN(gBattleScripting.statChanger), + GET_STAT_BUFF_ID(gBattleScripting.statChanger), + flags, + failInstr) == STAT_CHANGE_WORKED) gBattlescriptCurrInstr = cmd->nextInstr; else if (gBattlescriptCurrInstr == ptrBefore) // Prevent infinite looping. gBattlescriptCurrInstr = failInstr; diff --git a/test/battle/move_effect/hit_escape.c b/test/battle/move_effect/hit_escape.c index 0a494cc667d4..76a01afa4f1b 100644 --- a/test/battle/move_effect/hit_escape.c +++ b/test/battle/move_effect/hit_escape.c @@ -179,3 +179,26 @@ SINGLE_BATTLE_TEST("Electric Seed boost is received by the right pokemon after U EXPECT_EQ(player->statStages[STAT_DEF], DEFAULT_STAT_STAGE + 1); } } + +SINGLE_BATTLE_TEST("XX Held items are consumed immediately after a mon switched in by U-turn and Intimidate activates after it: player side") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_EKANS) { Ability(ABILITY_INTIMIDATE); Item(ITEM_ROOM_SERVICE); } + OPPONENT(SPECIES_WYNAUT) { HP(1); } + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(player, MOVE_TRICK_ROOM); } + TURN { MOVE(player, MOVE_EXPLOSION); SEND_OUT(player, 1); SEND_OUT(opponent, 1); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TRICK_ROOM, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_EXPLOSION, player); + HP_BAR(opponent); + MESSAGE("2 sent out Wynaut!"); + ABILITY_POPUP(player, ABILITY_INTIMIDATE); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + } THEN { + EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE - 1); + } +} From b240ac5c9dd72ba2f22259da0cadaf278503d16d Mon Sep 17 00:00:00 2001 From: AlexOn1ine Date: Wed, 18 Dec 2024 22:08:34 +0100 Subject: [PATCH 2/3] room service test file --- test/battle/move_effect/hit_escape.c | 23 ------------------ test/battle/move_effect/room_service.c | 33 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 test/battle/move_effect/room_service.c diff --git a/test/battle/move_effect/hit_escape.c b/test/battle/move_effect/hit_escape.c index 76a01afa4f1b..0a494cc667d4 100644 --- a/test/battle/move_effect/hit_escape.c +++ b/test/battle/move_effect/hit_escape.c @@ -179,26 +179,3 @@ SINGLE_BATTLE_TEST("Electric Seed boost is received by the right pokemon after U EXPECT_EQ(player->statStages[STAT_DEF], DEFAULT_STAT_STAGE + 1); } } - -SINGLE_BATTLE_TEST("XX Held items are consumed immediately after a mon switched in by U-turn and Intimidate activates after it: player side") -{ - GIVEN { - PLAYER(SPECIES_WOBBUFFET); - PLAYER(SPECIES_EKANS) { Ability(ABILITY_INTIMIDATE); Item(ITEM_ROOM_SERVICE); } - OPPONENT(SPECIES_WYNAUT) { HP(1); } - OPPONENT(SPECIES_WYNAUT); - } WHEN { - TURN { MOVE(player, MOVE_TRICK_ROOM); } - TURN { MOVE(player, MOVE_EXPLOSION); SEND_OUT(player, 1); SEND_OUT(opponent, 1); } - } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_TRICK_ROOM, player); - ANIMATION(ANIM_TYPE_MOVE, MOVE_EXPLOSION, player); - HP_BAR(opponent); - MESSAGE("2 sent out Wynaut!"); - ABILITY_POPUP(player, ABILITY_INTIMIDATE); - ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); - ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); - } THEN { - EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE - 1); - } -} diff --git a/test/battle/move_effect/room_service.c b/test/battle/move_effect/room_service.c new file mode 100644 index 000000000000..04b6450e0510 --- /dev/null +++ b/test/battle/move_effect/room_service.c @@ -0,0 +1,33 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gItemsInfo[ITEM_ROOM_SERVICE].holdEffect == HOLD_EFFECT_ROOM_SERVICE); +} + +SINGLE_BATTLE_TEST("Room Serive decreases the holder's seep by one stage") +{ + GIVEN { + ASSUME(gMovesInfo[MOVE_U_TURN].effect == EFFECT_HIT_ESCAPE); + ASSUME(gMovesInfo[MOVE_TRICK_ROOM].effect == EFFECT_TRICK_ROOM); + ASSUME(gMovesInfo[MOVE_EXPLOSION].effect == EFFECT_EXPLOSION); + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_EKANS) { Ability(ABILITY_INTIMIDATE); Item(ITEM_ROOM_SERVICE); } + OPPONENT(SPECIES_WYNAUT) { HP(1); } + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(player, MOVE_TRICK_ROOM); } + TURN { MOVE(player, MOVE_EXPLOSION); SEND_OUT(player, 1); SEND_OUT(opponent, 1); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TRICK_ROOM, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_EXPLOSION, player); + HP_BAR(opponent); + MESSAGE("2 sent out Wynaut!"); + ABILITY_POPUP(player, ABILITY_INTIMIDATE); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + } THEN { + EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE - 1); + } +} From 79e6f4c0d770a501a8e61622eec3f91271378975 Mon Sep 17 00:00:00 2001 From: AlexOn1ine Date: Thu, 19 Dec 2024 13:41:20 +0100 Subject: [PATCH 3/3] change files dir --- test/battle/{move_effect => hold_effect}/room_service.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/battle/{move_effect => hold_effect}/room_service.c (100%) diff --git a/test/battle/move_effect/room_service.c b/test/battle/hold_effect/room_service.c similarity index 100% rename from test/battle/move_effect/room_service.c rename to test/battle/hold_effect/room_service.c