From 7c962fc0fa02d186228e3031a73352f226b9be78 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 27 Nov 2022 04:48:30 -0500 Subject: [PATCH] Improve Ballhog charge conditions --- src/k_botitem.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/k_botitem.c b/src/k_botitem.c index b8b848345..6c8b9ece4 100644 --- a/src/k_botitem.c +++ b/src/k_botitem.c @@ -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; }