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)
This commit is contained in:
Sally Coolatta 2020-06-04 15:59:51 -04:00
parent 889cf581d1
commit 4005288d40

View file

@ -342,6 +342,7 @@ static UINT32 K_BotRubberbandDistance(player_t *player)
fixed_t K_BotRubberband(player_t *player) fixed_t K_BotRubberband(player_t *player)
{ {
fixed_t rubberband = FRACUNIT; fixed_t rubberband = FRACUNIT;
fixed_t max, min;
player_t *firstplace = NULL; player_t *firstplace = NULL;
UINT8 i; 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; return rubberband;