From ec9cc9a4436a1d16dd39153055e0e597f31660c1 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Mon, 11 Dec 2023 00:05:39 +0100 Subject: [PATCH] =?UTF-8?q?Config=20for=20trying=20to=20catch=20a=20Traine?= =?UTF-8?q?r's=20Pok=C3=A9mon=20(#3684)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Config for trying to catch a Trainer's Pokémon * Prevent removal instead of adding it back --- include/config/battle.h | 1 + src/item_use.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/config/battle.h b/include/config/battle.h index 503ce9328e..26cda4e6e2 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -220,6 +220,7 @@ #define B_USE_FROSTBITE FALSE // In PLA, Frostbite replaces Freeze. Enabling this flag does the same here. Moves can still be cherry-picked to either Freeze or Frostbite. Freeze-Dry, Secret Power & Tri Attack depend on this config. #define B_OVERWORLD_SNOW GEN_LATEST // In Gen9+, overworld Snow will summon snow instead of hail. #define B_TOXIC_REVERSAL GEN_LATEST // In Gen5+, bad poison will change to regular poison at the end of battles. +#define B_TRY_CATCH_TRAINER_BALL GEN_LATEST // In Gen4+, trying to catch a Trainer's Pokémon does not consume the Poké Ball. // Animation Settings #define B_NEW_SWORD_PARTICLE TRUE // If set to TRUE, it updates Swords Dance's particle. diff --git a/src/item_use.c b/src/item_use.c index 1b87cc0e36..6abec6498a 100644 --- a/src/item_use.c +++ b/src/item_use.c @@ -1234,7 +1234,8 @@ void ItemUseInBattle_BagMenu(u8 taskId) else { PlaySE(SE_SELECT); - RemoveUsedItem(); + if (!(B_TRY_CATCH_TRAINER_BALL >= GEN_4 && (ItemId_GetBattleUsage(gSpecialVar_ItemId) == EFFECT_ITEM_THROW_BALL) && (gBattleTypeFlags & BATTLE_TYPE_TRAINER))) + RemoveUsedItem(); ScheduleBgCopyTilemapToVram(2); if (!InBattlePyramid()) gTasks[taskId].func = Task_FadeAndCloseBagMenu;