Improve Ballhog charge conditions

This commit is contained in:
Sally Coolatta 2022-11-27 04:48:30 -05:00
parent bd2507bee7
commit 7c962fc0fa

View file

@ -923,6 +923,7 @@ static void K_BotItemBallhog(player_t *player, ticcmd_t *cmd)
boolean tryLookback = false;
UINT8 snipeMul = 2;
player_t *target = NULL;
boolean hold = false;
if (player->speed > topspeed)
{
@ -930,8 +931,6 @@ static void K_BotItemBallhog(player_t *player, ticcmd_t *cmd)
snipeMul = 3; // Confirm faster when you'll throw it with a bunch of extra speed!!
}
player->botvars.itemconfirm++;
target = K_PlayerInCone(player, radius, 15, false);
if (target != NULL)
{
@ -955,11 +954,24 @@ static void K_BotItemBallhog(player_t *player, ticcmd_t *cmd)
cmd->buttons |= BT_LOOKBACK;
}
if (player->botvars.itemconfirm > 10*TICRATE)
if (target != NULL)
{
// Charge up!
hold = true;
}
else
{
// If we lose sight of the target, then we'll just
// let go and it'll do a partial-blast.
// If we've been waiting for too long though, then
// we'll go for the full charge :)
player->botvars.itemconfirm++;
hold = (player->botvars.itemconfirm > 10*TICRATE);
}
if (hold == true)
{
// Charge up. If we lose sight of the target, then
// we'll just let go and do a partial-charge.
// Otherwise we'll go for full-charge :)
cmd->throwdir = KART_FULLTURN * throwdir;
cmd->buttons |= BT_ATTACK;
}