From 4005288d4008bd1d9d10aebd3a81d00a67f6f22e Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Thu, 4 Jun 2020 15:59:51 -0400 Subject: [PATCH] Adjust max/min rubberband multiplier with bot difficulty Lv. 1: Ranges from x0.75 to x1.0 (never speeds up, only slows down) Lv. 5: Ranges from x0.875 to x1.5 (completely average) Lv. 9: Ranges from x1.0 to x2.0 (never slows down, only speeds up) --- src/k_bot.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/k_bot.c b/src/k_bot.c index 38b9bff5a..2f2511f86 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -342,6 +342,7 @@ static UINT32 K_BotRubberbandDistance(player_t *player) fixed_t K_BotRubberband(player_t *player) { fixed_t rubberband = FRACUNIT; + fixed_t max, min; player_t *firstplace = NULL; UINT8 i; @@ -388,13 +389,23 @@ fixed_t K_BotRubberband(player_t *player) } } - if (rubberband > 2*FRACUNIT) + // Lv. 1: x1.0 max + // Lv. 5: x1.5 max + // Lv. 9: x2.0 max + max = FRACUNIT + ((FRACUNIT * (player->botvars.difficulty - 1)) / (MAXBOTDIFFICULTY - 1)); + + // Lv. 1: x0.75 min + // Lv. 5: x0.875 min + // Lv. 9: x1.0 min + min = FRACUNIT - (((FRACUNIT/4) * (MAXBOTDIFFICULTY - player->botvars.difficulty)) / (MAXBOTDIFFICULTY - 1)); + + if (rubberband > max) { - rubberband = 2*FRACUNIT; + rubberband = max; } - else if (rubberband < 7*FRACUNIT/8) + else if (rubberband < min) { - rubberband = 7*FRACUNIT/8; + rubberband = min; } return rubberband;