Make bots stop roulette instead of waiting it out

Done in kind of a lazy way, might revisit later.
This commit is contained in:
Sally Coolatta 2022-12-12 04:35:51 -05:00
parent c8f3533b00
commit e45cef44df
2 changed files with 7 additions and 15 deletions

View file

@ -1394,27 +1394,15 @@ static void K_BotItemRings(player_t *player, ticcmd_t *cmd)
--------------------------------------------------*/
static void K_BotItemRouletteMash(player_t *player, ticcmd_t *cmd)
{
boolean mash = false;
if (K_ItemButtonWasDown(player) == true)
{
return;
}
if (player->rings < 0 && K_ItemEnabled(KITEM_SUPERRING) == true)
{
// Uh oh, we need a loan!
// It'll be better in the long run for bots to lose an item set for 10 free rings.
mash = true;
}
// TODO: Would be nice to implement smarter behavior
// for selecting items.
// TODO: Mash based on how far behind you are, when items are
// almost garantueed to be in your favor.
if (mash == true)
{
cmd->buttons |= BT_ATTACK;
}
cmd->buttons |= BT_ATTACK;
}
/*--------------------------------------------------

View file

@ -823,6 +823,10 @@ static void K_CalculateRouletteSpeed(player_t *const player, itemroulette_t *con
}
roulette->tics = roulette->speed = ROULETTE_SPEED_FASTEST + FixedMul(ROULETTE_SPEED_SLOWEST - ROULETTE_SPEED_FASTEST, total);
// Make them select their item after a little while.
// One of the few instances of bot RNG, would be nice to remove it.
player->botvars.itemdelay = P_RandomRange(PR_UNDEFINED, TICRATE, TICRATE*3);
}
void K_StartItemRoulette(player_t *const player, itemroulette_t *const roulette)