From b249399a530727dec08911cc769c86c844a25e37 Mon Sep 17 00:00:00 2001 From: TheXaman <48356183+TheXaman@users.noreply.github.com> Date: Tue, 6 Sep 2022 23:00:26 +0200 Subject: [PATCH] changed 'B_FLAG_NO_CATCHING' to be evaluated by 'GetBallThrowableState()' --- include/item_use.h | 1 + src/item_use.c | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/item_use.h b/include/item_use.h index 036a541012..d55f7cf0d7 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -43,6 +43,7 @@ enum { BALL_THROW_UNABLE_NO_ROOM, BALL_THROW_UNABLE_SEMI_INVULNERABLE, BALL_THROW_ABLE, + BALL_THROW_UNABLE_DISABLED_FLAG, }; bool32 CanThrowBall(void); diff --git a/src/item_use.c b/src/item_use.c index cb85ae3e35..645a5d1647 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -968,6 +968,8 @@ static u32 GetBallThrowableState(void) else if (gStatuses3[GetCatchingBattler()] & STATUS3_SEMI_INVULNERABLE) return BALL_THROW_UNABLE_SEMI_INVULNERABLE; #endif + else if (FlagGet(B_FLAG_NO_CATCHING)) + return BALL_THROW_UNABLE_DISABLED_FLAG; return BALL_THROW_ABLE; } @@ -979,15 +981,9 @@ bool32 CanThrowBall(void) static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThere are two Pokémon out there!\p"); static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a ball!\nThere's no Pokémon in sight!\p"); +static const u8 sText_CantThrowPokeBall_Disabled[] = _("POKé BALLS cannot be used\nright now!\p"); void ItemUseInBattle_PokeBall(u8 taskId) -{ - if (FlagGet(B_FLAG_NO_CATCHING)) - { - static const u8 sText_BallsCannotBeUsed[] = _("Poké Balls cannot be used\nright now!\p"); - DisplayItemMessage(taskId, 1, sText_BallsCannotBeUsed, CloseItemMessage); - return; - } - +{ switch (GetBallThrowableState()) { case BALL_THROW_ABLE: @@ -1018,6 +1014,12 @@ void ItemUseInBattle_PokeBall(u8 taskId) DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_SemiInvulnerable, Task_CloseBattlePyramidBagMessage); break; #endif + case BALL_THROW_UNABLE_DISABLED_FLAG: + if (!InBattlePyramid()) + DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_Disabled, CloseItemMessage); + else + DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_Disabled, Task_CloseBattlePyramidBagMessage); + break; } }