From e213e39d172d79a45fa6b557fdb538777fecdfe5 Mon Sep 17 00:00:00 2001 From: dmitry Date: Wed, 15 Sep 2021 11:14:05 +0300 Subject: [PATCH] change: bot path type selection is based on morale (fear/aggression level) fix: partially fixes #227 (in matter of player pings) --- ext/crlib | 2 +- src/manager.cpp | 8 +++++--- src/support.cpp | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ext/crlib b/ext/crlib index 1992b92..544851d 160000 --- a/ext/crlib +++ b/ext/crlib @@ -1 +1 @@ -Subproject commit 1992b929e55f02d54b3978109a71da22802d6142 +Subproject commit 544851dd2f24a2fd4d11633167c773d98383ba29 diff --git a/src/manager.cpp b/src/manager.cpp index ae8b684..fd6775e 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -1399,18 +1399,20 @@ void Bot::newRound () { } void Bot::resetPathSearchType () { + const auto morale = m_fearLevel > m_agressionLevel ? rg.chance (30) : rg.chance (70); + switch (m_personality) { default: case Personality::Normal: - m_pathType = rg.chance (50) ? FindPath::Optimal : FindPath::Safe; + m_pathType = morale ? FindPath::Optimal : FindPath::Safe; break; case Personality::Rusher: - m_pathType = rg.chance (75) ? FindPath::Fast : FindPath::Optimal; + m_pathType = morale ? FindPath::Fast : FindPath::Optimal; break; case Personality::Careful: - m_pathType = rg.chance (75) ? FindPath::Safe : FindPath::Optimal; + m_pathType = morale ? FindPath::Optimal : FindPath::Safe; break; } } diff --git a/src/support.cpp b/src/support.cpp index a15faa1..0690f8d 100644 --- a/src/support.cpp +++ b/src/support.cpp @@ -582,7 +582,7 @@ void BotSupport::calculatePings () { engfuncs.pfnGetPlayerStats (client.ent, &ping, &loss); // store normal client ping - client.ping = getPingBitmask (client.ent, loss, ping > 0 ? ping / 2 : rg.get (8, 16)); // getting player ping sometimes fails + client.ping = getPingBitmask (client.ent, loss, ping > 0 ? ping : rg.get (8, 16)); // getting player ping sometimes fails client.pingUpdate = true; // force resend ping ++numHumans;