From e995927d132a311e403486d8dc4cb710f633a150 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Fri, 26 Jan 2024 21:11:04 +0100 Subject: [PATCH 1/3] Add extra key item bag space checks (#4066) * Fix 4019 * I am exceedingly brilliant in my failure to build before pushing --- data/maps/DewfordTown/scripts.inc | 1 + data/maps/MauvilleCity/scripts.inc | 1 + data/maps/MauvilleCity_BikeShop/scripts.inc | 2 ++ data/maps/MauvilleCity_House2/scripts.inc | 3 ++- data/maps/MossdeepCity_House3/scripts.inc | 1 + data/maps/MtChimney/scripts.inc | 1 + data/maps/Route104_PrettyPetalFlowerShop/scripts.inc | 1 + data/maps/Route113_GlassWorkshop/scripts.inc | 1 + data/maps/Route118/scripts.inc | 1 + data/scripts/contest_hall.inc | 1 + 10 files changed, 12 insertions(+), 1 deletion(-) diff --git a/data/maps/DewfordTown/scripts.inc b/data/maps/DewfordTown/scripts.inc index 1250c2d767..5d13a6a16b 100644 --- a/data/maps/DewfordTown/scripts.inc +++ b/data/maps/DewfordTown/scripts.inc @@ -93,6 +93,7 @@ DewfordTown_EventScript_OldRodFisherman:: DewfordTown_EventScript_GiveOldRod:: msgbox DewfordTown_Text_GiveYouOneOfMyRods, MSGBOX_DEFAULT giveitem ITEM_OLD_ROD + goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull setflag FLAG_RECEIVED_OLD_ROD msgbox DewfordTown_Text_ThrowInFishingAdvice, MSGBOX_DEFAULT release diff --git a/data/maps/MauvilleCity/scripts.inc b/data/maps/MauvilleCity/scripts.inc index 9211402705..217621c344 100644 --- a/data/maps/MauvilleCity/scripts.inc +++ b/data/maps/MauvilleCity/scripts.inc @@ -423,6 +423,7 @@ MauvilleCity_EventScript_Wattson:: goto_if_set FLAG_GOT_BASEMENT_KEY_FROM_WATTSON, MauvilleCity_EventScript_BegunNewMauville msgbox MauvilleCity_Text_WattsonNeedFavorTakeKey, MSGBOX_DEFAULT giveitem ITEM_BASEMENT_KEY + goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull setflag FLAG_GOT_BASEMENT_KEY_FROM_WATTSON msgbox MauvilleCity_Text_WattsonWontBeChallenge, MSGBOX_DEFAULT release diff --git a/data/maps/MauvilleCity_BikeShop/scripts.inc b/data/maps/MauvilleCity_BikeShop/scripts.inc index 0893384101..94a48f3a74 100644 --- a/data/maps/MauvilleCity_BikeShop/scripts.inc +++ b/data/maps/MauvilleCity_BikeShop/scripts.inc @@ -41,12 +41,14 @@ MauvilleCity_BikeShop_EventScript_YesFar:: MauvilleCity_BikeShop_EventScript_GetMachBike:: msgbox MauvilleCity_BikeShop_Text_ChoseMachBike, MSGBOX_DEFAULT giveitem ITEM_MACH_BIKE + goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull goto MauvilleCity_BikeShop_EventScript_ComeBackToSwitchBikes end MauvilleCity_BikeShop_EventScript_GetAcroBike:: msgbox MauvilleCity_BikeShop_Text_ChoseAcroBike, MSGBOX_DEFAULT giveitem ITEM_ACRO_BIKE + goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull goto MauvilleCity_BikeShop_EventScript_ComeBackToSwitchBikes end diff --git a/data/maps/MauvilleCity_House2/scripts.inc b/data/maps/MauvilleCity_House2/scripts.inc index 193e0c04ce..0a9ef2aa64 100644 --- a/data/maps/MauvilleCity_House2/scripts.inc +++ b/data/maps/MauvilleCity_House2/scripts.inc @@ -24,8 +24,9 @@ MauvilleCity_House2_EventScript_AskToTradeForHarborMail:: MauvilleCity_House2_EventScript_AcceptTrade:: msgbox MauvilleCity_House2_Text_IllTradeYouCoinCase, MSGBOX_DEFAULT - removeitem ITEM_HARBOR_MAIL giveitem ITEM_COIN_CASE + goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull + removeitem ITEM_HARBOR_MAIL setflag FLAG_RECEIVED_COIN_CASE goto MauvilleCity_House2_EventScript_ReceivedCoinCase end diff --git a/data/maps/MossdeepCity_House3/scripts.inc b/data/maps/MossdeepCity_House3/scripts.inc index 73b0cc26e9..2419429c77 100644 --- a/data/maps/MossdeepCity_House3/scripts.inc +++ b/data/maps/MossdeepCity_House3/scripts.inc @@ -9,6 +9,7 @@ MossdeepCity_House3_EventScript_SuperRodFisherman:: goto_if_eq VAR_RESULT, NO, MossdeepCity_House3_EventScript_DeclineSuperRod msgbox MossdeepCity_House3_Text_SuperRodIsSuper, MSGBOX_DEFAULT giveitem ITEM_SUPER_ROD + goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull setflag FLAG_RECEIVED_SUPER_ROD msgbox MossdeepCity_House3_Text_TryDroppingRodInWater, MSGBOX_DEFAULT release diff --git a/data/maps/MtChimney/scripts.inc b/data/maps/MtChimney/scripts.inc index 1931633258..b4becfabee 100644 --- a/data/maps/MtChimney/scripts.inc +++ b/data/maps/MtChimney/scripts.inc @@ -448,6 +448,7 @@ MtChimney_EventScript_MeteoriteMachine:: goto_if_eq VAR_RESULT, NO, MtChimney_EventScript_LeaveMeteoriteAlone msgbox MtChimney_Text_PlayerRemovedMeteorite, MSGBOX_DEFAULT giveitem ITEM_METEORITE + goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull setflag FLAG_RECEIVED_METEORITE releaseall end diff --git a/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc b/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc index 5f0ec28fa5..54b2dacef1 100644 --- a/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc +++ b/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc @@ -74,6 +74,7 @@ Route104_PrettyPetalFlowerShop_EventScript_WailmerPailGirl:: Route104_PrettyPetalFlowerShop_EventScript_GiveWailmerPail:: msgbox Route104_PrettyPetalFlowerShop_Text_YouCanHaveThis, MSGBOX_DEFAULT giveitem ITEM_WAILMER_PAIL + goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull msgbox Route104_PrettyPetalFlowerShop_Text_WailmerPailExplanation, MSGBOX_DEFAULT setflag FLAG_RECEIVED_WAILMER_PAIL release diff --git a/data/maps/Route113_GlassWorkshop/scripts.inc b/data/maps/Route113_GlassWorkshop/scripts.inc index 41182b2ae5..b3f27001b1 100644 --- a/data/maps/Route113_GlassWorkshop/scripts.inc +++ b/data/maps/Route113_GlassWorkshop/scripts.inc @@ -28,6 +28,7 @@ Route113_GlassWorkshop_EventScript_GlassWorker:: goto_if_eq VAR_GLASS_WORKSHOP_STATE, 1, Route113_GlassWorkshop_EventScript_ExplainSootSack msgbox Route113_GlassWorkshop_Text_GoCollectAshWithThis, MSGBOX_DEFAULT giveitem ITEM_SOOT_SACK + goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull setvar VAR_GLASS_WORKSHOP_STATE, 1 msgbox Route113_GlassWorkshop_Text_ExplainSootSack, MSGBOX_DEFAULT release diff --git a/data/maps/Route118/scripts.inc b/data/maps/Route118/scripts.inc index 92dd8847d4..092c3d12fe 100644 --- a/data/maps/Route118/scripts.inc +++ b/data/maps/Route118/scripts.inc @@ -34,6 +34,7 @@ Route118_EventScript_GoodRodFisherman:: Route118_EventScript_ReceiveGoodRod:: msgbox Route118_Text_IdenticalMindsTakeThis, MSGBOX_DEFAULT giveitem ITEM_GOOD_ROD + goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull setflag FLAG_RECEIVED_GOOD_ROD msgbox Route118_Text_TryYourLuckFishing, MSGBOX_DEFAULT release diff --git a/data/scripts/contest_hall.inc b/data/scripts/contest_hall.inc index 04c62a6de3..3874e1a59e 100644 --- a/data/scripts/contest_hall.inc +++ b/data/scripts/contest_hall.inc @@ -31,6 +31,7 @@ LilycoveCity_ContestLobby_EventScript_ReceptionWelcome:: LilycoveCity_ContestLobby_EventScript_GivePokeblockCase:: msgbox LilycoveCity_ContestLobby_Text_ReceptionDontHavePokeblockCase, MSGBOX_DEFAULT giveitem ITEM_POKEBLOCK_CASE + goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull setflag FLAG_RECEIVED_POKEBLOCK_CASE msgbox LilycoveCity_ContestLobby_Text_NowThatWeveClearedThatUp, MSGBOX_DEFAULT return From 3e50480cabc0faabe93ca44f5864e0b47115eb1d Mon Sep 17 00:00:00 2001 From: johannakullmann <151456919+johannakullmann@users.noreply.github.com> Date: Sat, 27 Jan 2024 15:59:39 +0100 Subject: [PATCH 2/3] Fixed graphics bug with Steven double battle (#4078) Caused the wrong palette to be used during Steven's ball throw animation in the Mossdeep Space Center fight. --- src/battle_controller_player_partner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 5155db49ec..ed9f29c667 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -440,7 +440,7 @@ static void PlayerPartnerHandleIntroTrainerBallThrow(u32 battler) const u32 *trainerPal; if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER) - trainerPal = gTrainerBackPicPaletteTable[TRAINER_STEVEN_PARTNER].data; + trainerPal = gTrainerBackPicPaletteTable[TRAINER_BACK_PIC_STEVEN].data; else if (gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER) // Custom multi battle. trainerPal = gTrainerBackPicPaletteTable[gPartnerSpriteId].data; else if (IsAiVsAiBattle()) From 9bcd46bce817994003dc3270ad31bfb9834d4fb0 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sun, 28 Jan 2024 19:15:53 +0100 Subject: [PATCH 3/3] Fixes Pursuit, Tangling Hair interaction (#4086) --- data/battle_scripts_1.s | 2 ++ test/battle/move_effect/pursuit.c | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 test/battle/move_effect/pursuit.c diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 18d20ebc94..9a26c78dc2 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6716,6 +6716,7 @@ BattleScript_PrintFullBox:: BattleScript_ActionSwitch:: hpthresholds2 BS_ATTACKER + copybyte sSAVED_BATTLER, gBattlerAttacker printstring STRINGID_RETURNMON jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_PursuitSwitchDmgSetMultihit setmultihit 1 @@ -6733,6 +6734,7 @@ BattleScript_DoSwitchOut:: switchoutabilities BS_ATTACKER updatedynamax waitstate + copybyte gBattlerAttacker, sSAVED_BATTLER returnatktoball waitstate drawpartystatussummary BS_ATTACKER diff --git a/test/battle/move_effect/pursuit.c b/test/battle/move_effect/pursuit.c new file mode 100644 index 0000000000..9d53f30573 --- /dev/null +++ b/test/battle/move_effect/pursuit.c @@ -0,0 +1,26 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_PURSUIT].effect == EFFECT_PURSUIT); +} + +SINGLE_BATTLE_TEST("Pursuited mon correctly switches out after it got hit and activated ability Tangling Hair") +{ + GIVEN { + PLAYER(SPECIES_DUGTRIO) { Ability(ABILITY_TANGLING_HAIR); } + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WYNAUT); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { SWITCH(player, 1); MOVE(opponent, MOVE_PURSUIT); } + } SCENE { + MESSAGE("Dugtrio, that's enough! Come back!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_PURSUIT, opponent); + ABILITY_POPUP(player, ABILITY_TANGLING_HAIR); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent); + MESSAGE("Foe Wynaut's Speed fell!"); + MESSAGE("Go! Wobbuffet!"); + } +}