changed 'B_FLAG_NO_CATCHING' to be evaluated by 'GetBallThrowableState()'

This commit is contained in:
TheXaman 2022-09-06 23:00:26 +02:00
parent f6d111d0c7
commit b249399a53
2 changed files with 11 additions and 8 deletions

View file

@ -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);

View file

@ -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;
}
}