diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 8a7a4f7563..8160357d76 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -5966,6 +5966,7 @@ BattleScript_PrintFullBox:: BattleScript_ActionSwitch:: hpthresholds2 BS_ATTACKER + copybyte sSAVED_BATTLER, gBattlerAttacker printstring STRINGID_RETURNMON jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_PursuitSwitchDmgSetMultihit setmultihit 1 @@ -5983,6 +5984,7 @@ BattleScript_DoSwitchOut:: switchoutabilities BS_ATTACKER updatedynamax waitstate + copybyte gBattlerAttacker, sSAVED_BATTLER returnatktoball waitstate drawpartystatussummary BS_ATTACKER 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 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!"); + } +}