From 6736f8f26f5db09e725d10d22a97163446a9a023 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 3 Jan 2024 01:22:15 -0500 Subject: [PATCH] Fix bot Flame Shield --- src/k_bot.cpp | 9 +++++- src/k_botitem.cpp | 70 +++++++++++++++++++++++++++++++++++++++++++---- src/k_kart.c | 1 - 3 files changed, 72 insertions(+), 8 deletions(-) diff --git a/src/k_bot.cpp b/src/k_bot.cpp index f79e94cbe..7afe53e5c 100644 --- a/src/k_bot.cpp +++ b/src/k_bot.cpp @@ -1931,7 +1931,14 @@ void K_UpdateBotGameplayVars(player_t *player) } else { - player->botvars.spindashconfirm += player->cmd.bot.spindashconfirm; + if (player->cmd.bot.spindashconfirm < 0 && abs(player->cmd.bot.spindashconfirm) > player->botvars.spindashconfirm) + { + player->botvars.spindashconfirm = 0; + } + else + { + player->botvars.spindashconfirm += player->cmd.bot.spindashconfirm; + } } if (K_TryRingShooter(player) == true) diff --git a/src/k_botitem.cpp b/src/k_botitem.cpp index fc1370b1f..8cc271108 100644 --- a/src/k_botitem.cpp +++ b/src/k_botitem.cpp @@ -1810,13 +1810,71 @@ void K_UpdateBotGameplayVarsItemUsage(player_t *player) return; } - player->botvars.itemconfirm += player->cmd.bot.itemconfirm; - - if (player->itemRoulette.active == true) + if (player->cmd.bot.itemconfirm < 0 && abs(player->cmd.bot.itemconfirm) > player->botvars.itemconfirm) { - // Mashing behaviors - K_UpdateBotGameplayVarsItemUsageMash(player); - return; + player->botvars.itemconfirm = 0; + } + else + { + player->botvars.itemconfirm += player->cmd.bot.itemconfirm; + } + + if (player->itemflags & IF_USERINGS) + { + ; + } + else + { + if (player->itemRoulette.active == true) + { + // Mashing behaviors + K_UpdateBotGameplayVarsItemUsageMash(player); + return; + } + + if (player->stealingtimer == 0) + { + if (player->eggmanexplode) + { + ; + } + else if (player->itemflags & IF_EGGMANOUT) + { + ; + } + else if (player->rocketsneakertimer > 0) + { + ; + } + else + { + switch (player->itemtype) + { + default: + { + break; + } + case KITEM_FLAMESHIELD: + { + if (player->botvars.itemconfirm == 0 + && (player->itemflags & IF_HOLDREADY) == IF_HOLDREADY) + { + INT32 flamemax = player->flamelength; + + if (player->flamemeter < flamemax || flamemax == 0) + { + ; + } + else + { + player->botvars.itemconfirm = (3 * flamemax / 4) + (TICRATE / 2); + } + } + break; + } + } + } + } } } diff --git a/src/k_kart.c b/src/k_kart.c index 2ebc91b31..def73ecfd 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -12288,7 +12288,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else { player->itemflags |= IF_HOLDREADY; - player->botvars.itemconfirm = 3*flamemax/4; if (!(gametyperules & GTR_CLOSERPLAYERS) || leveltime % 6 == 0) {