fixed jason mode once more
high skill bots now making more headshots
This commit is contained in:
parent
1f3774c786
commit
b7baeb5852
6 changed files with 53 additions and 32 deletions
|
|
@ -1070,7 +1070,7 @@ private:
|
|||
|
||||
void SelectBestWeapon (void);
|
||||
void SelectPistol (void);
|
||||
bool IsFriendInLineOfFire (float distance);
|
||||
bool IsFriendInLineOfFire (void);
|
||||
bool IsGroupOfEnemies (const Vector &location, int numEnemies = 1, int radius = 256);
|
||||
|
||||
bool IsShootableThruObstacle (const Vector &dest);
|
||||
|
|
|
|||
|
|
@ -25,4 +25,5 @@
|
|||
#define PRODUCT_SUPPORT_VERSION "1.0 - CZ"
|
||||
#define PRODUCT_COMMENTS "http://github.com/jeefo/yapb/"
|
||||
#define PRODUCT_DATE __DATE__
|
||||
|
||||
#define PRODUCT_GIT_HASH "unspecified_hash"
|
||||
#define PRODUCT_GIT_COMMIT_AUTHOR "unspecified_author"
|
||||
|
|
|
|||
|
|
@ -116,6 +116,9 @@ bool Bot::CheckVisibility (edict_t *target, Vector *origin, byte *bodyPart)
|
|||
{
|
||||
*bodyPart |= VISIBLE_BODY;
|
||||
*origin = target->v.origin;
|
||||
|
||||
if (m_difficulty == 4)
|
||||
origin->z += 3.0f;
|
||||
}
|
||||
|
||||
// check for the head
|
||||
|
|
@ -125,6 +128,9 @@ bool Bot::CheckVisibility (edict_t *target, Vector *origin, byte *bodyPart)
|
|||
{
|
||||
*bodyPart |= VISIBLE_HEAD;
|
||||
*origin = target->v.origin + target->v.view_ofs;
|
||||
|
||||
if (m_difficulty == 4)
|
||||
origin->z += 1.0f;
|
||||
}
|
||||
|
||||
if (*bodyPart != 0)
|
||||
|
|
@ -670,7 +676,7 @@ void Bot::FindItem (void)
|
|||
// this function finds Items to collect or use in the near of a bot
|
||||
|
||||
// don't try to pickup anything while on ladder or trying to escape from bomb...
|
||||
if (IsOnLadder () || GetTaskId () == TASK_ESCAPEFROMBOMB)
|
||||
if (IsOnLadder () || GetTaskId () == TASK_ESCAPEFROMBOMB || yb_jasonmode.GetBool ())
|
||||
{
|
||||
m_pickupItem = NULL;
|
||||
m_pickupType = PICKUP_NONE;
|
||||
|
|
@ -2369,7 +2375,7 @@ bool Bot::LastEnemyShootable (void)
|
|||
if (!(m_aimFlags & AIM_LAST_ENEMY) || IsEntityNull (m_lastEnemy) || GetTaskId () == TASK_PAUSE || m_lastEnemyOrigin != nullvec)
|
||||
return false;
|
||||
|
||||
return GetShootingConeDeviation (GetEntity (), &m_lastEnemyOrigin) >= 0.90 && IsShootableThruObstacle (m_lastEnemy->v.origin);
|
||||
return GetShootingConeDeviation (GetEntity (), &m_lastEnemyOrigin) >= 0.90 && IsShootableThruObstacle (m_lastEnemyOrigin);
|
||||
}
|
||||
|
||||
void Bot::CheckRadioCommands (void)
|
||||
|
|
@ -4679,7 +4685,7 @@ void Bot::RunTask (void)
|
|||
case PICKUP_PLANTED_C4:
|
||||
m_aimFlags |= AIM_ENTITY;
|
||||
|
||||
if (m_team == TEAM_CF && itemDistance < 55)
|
||||
if (m_team == TEAM_CF && itemDistance < 80.0f)
|
||||
{
|
||||
ChatterMessage (Chatter_DefusingC4);
|
||||
|
||||
|
|
@ -4797,8 +4803,15 @@ void Bot::CheckSpawnTimeConditions (void)
|
|||
StartTask (TASK_SPRAY, TASKPRI_SPRAYLOGO, -1, GetWorldTime () + 1.0, false);
|
||||
|
||||
if (m_difficulty >= 2 && Random.Long (0, 100) < (m_personality == PERSONALITY_RUSHER ? 99 : 50) && !m_isReloading && (g_mapType & (MAP_CS | MAP_DE | MAP_ES | MAP_AS)))
|
||||
SelectWeaponByName ("weapon_knife");
|
||||
|
||||
{
|
||||
if (yb_jasonmode.GetBool ())
|
||||
{
|
||||
SelectPistol ();
|
||||
FakeClientCommand (GetEntity (), "drop");
|
||||
}
|
||||
else
|
||||
SelectWeaponByName ("weapon_knife");
|
||||
}
|
||||
m_checkKnifeSwitch = false;
|
||||
|
||||
if (Random.Long (0, 100) < yb_user_follow_percent.GetInt () && IsEntityNull (m_targetEntity) && !m_isLeader && !m_hasC4)
|
||||
|
|
@ -6092,12 +6105,8 @@ void Bot::ReactOnSound (void)
|
|||
m_states |= STATE_SEEING_ENEMY;
|
||||
m_seeEnemyTime = GetWorldTime ();
|
||||
}
|
||||
else if (m_lastEnemy == player && m_seeEnemyTime + 1.0 > GetWorldTime () && yb_shoots_thru_walls.GetBool () && IsShootableThruObstacle (player->v.origin))
|
||||
else if (m_lastEnemyOrigin != nullvec && m_lastEnemy == player && m_seeEnemyTime + 1.0 > GetWorldTime () && yb_shoots_thru_walls.GetBool () && IsShootableThruObstacle (m_lastEnemyOrigin))
|
||||
{
|
||||
m_enemy = player;
|
||||
m_lastEnemy = player;
|
||||
m_lastEnemyOrigin = player->v.origin;
|
||||
|
||||
m_states |= STATE_SEEING_ENEMY;
|
||||
m_seeEnemyTime = GetWorldTime ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ float Bot::GetZOffset (float distance)
|
|||
return result;
|
||||
}
|
||||
|
||||
bool Bot::IsFriendInLineOfFire (float distance)
|
||||
bool Bot::IsFriendInLineOfFire (void)
|
||||
{
|
||||
// bot can't hurt teammates, if friendly fire is not enabled...
|
||||
if (!mp_friendlyfire.GetBool () || yb_csdm_mode.GetInt () > 0)
|
||||
|
|
@ -401,10 +401,10 @@ bool Bot::IsFriendInLineOfFire (float distance)
|
|||
MakeVectors (pev->v_angle);
|
||||
|
||||
TraceResult tr;
|
||||
TraceLine (EyePosition (), EyePosition () + pev->v_angle.Normalize () * distance, false, false, GetEntity (), &tr);
|
||||
TraceLine (EyePosition (), EyePosition () + 10000.0f * pev->v_angle, false, false, GetEntity (), &tr);
|
||||
|
||||
// check if we hit something
|
||||
if (!IsEntityNull (tr.pHit))
|
||||
if (!IsEntityNull (tr.pHit) && tr.pHit != g_worldEdict)
|
||||
{
|
||||
int playerIndex = IndexOfEntity (tr.pHit) - 1;
|
||||
|
||||
|
|
@ -412,7 +412,9 @@ bool Bot::IsFriendInLineOfFire (float distance)
|
|||
if (playerIndex >= 0 && playerIndex < GetMaxClients () && g_clients[playerIndex].team == m_team && (g_clients[playerIndex].flags & CF_ALIVE))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
#if 0
|
||||
// search the world for players
|
||||
for (int i = 0; i < GetMaxClients (); i++)
|
||||
{
|
||||
|
|
@ -428,6 +430,7 @@ bool Bot::IsFriendInLineOfFire (float distance)
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Bot::IsShootableThruObstacle (const Vector &dest)
|
||||
|
|
@ -537,7 +540,7 @@ bool Bot::DoFirePause (float distance, FireDelay *fireDelay)
|
|||
float offset = 0.0f;
|
||||
const float BurstDistance = 300.0f;
|
||||
|
||||
if (distance < BurstDistance) // KWo - 09.04.2010
|
||||
if (distance < BurstDistance)
|
||||
return false;
|
||||
else if (distance < 2 * BurstDistance)
|
||||
offset = 10.0;
|
||||
|
|
@ -583,8 +586,16 @@ void Bot::FireWeapon (void)
|
|||
}
|
||||
|
||||
// or if friend in line of fire, stop this too but do not update shoot time
|
||||
if (!IsEntityNull (m_enemy) && IsFriendInLineOfFire (distance))
|
||||
return;
|
||||
if (!IsEntityNull (m_enemy))
|
||||
{
|
||||
if (IsFriendInLineOfFire ())
|
||||
{
|
||||
m_fightStyle = 1;
|
||||
m_lastFightStyleCheck = GetWorldTime ();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FireDelay *delay = &g_fireDelay[0];
|
||||
WeaponSelect *selectTab = &g_weaponSelect[0];
|
||||
|
|
@ -751,7 +762,7 @@ WeaponSelectEnd:
|
|||
{
|
||||
if (selectId == WEAPON_KNIFE)
|
||||
{
|
||||
if (distance < 99.0f)
|
||||
if (distance < 64.0f)
|
||||
{
|
||||
if (Random.Long (1, 100) < 15 || HasShield ())
|
||||
pev->button |= IN_ATTACK; // use primary attack
|
||||
|
|
@ -798,7 +809,6 @@ WeaponSelectEnd:
|
|||
m_shootTime = GetWorldTime () + baseDelay + Random.Float (minDelay, maxDelay);
|
||||
m_zoomCheckTime = GetWorldTime ();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -844,7 +854,7 @@ void Bot::FocusEnemy (void)
|
|||
{
|
||||
if (m_currentWeapon == WEAPON_KNIFE)
|
||||
{
|
||||
if (distance <= 99.0f)
|
||||
if (distance <= 80.0f)
|
||||
m_wantsToFire = true;
|
||||
}
|
||||
else
|
||||
|
|
@ -942,7 +952,7 @@ void Bot::CombatFight (void)
|
|||
else
|
||||
m_moveSpeed = pev->maxspeed;
|
||||
|
||||
if (distance < 96)
|
||||
if (distance < 96 && m_currentWeapon != WEAPON_KNIFE)
|
||||
m_moveSpeed = -pev->maxspeed;
|
||||
|
||||
if (UsesSniper ())
|
||||
|
|
@ -988,10 +998,6 @@ void Bot::CombatFight (void)
|
|||
}
|
||||
}
|
||||
|
||||
// if there is a friend between us and enemy, do a strafe movement
|
||||
if (m_lastFightStyleCheck + 2.5f < GetWorldTime () && IsFriendInLineOfFire (distance))
|
||||
m_fightStyle = 0;
|
||||
|
||||
if ((m_difficulty >= 1 && m_fightStyle == 0) || ((pev->button & IN_RELOAD) || m_isReloading) || (UsesPistol () && distance < 400.0f))
|
||||
{
|
||||
if (m_strafeSetTime < GetWorldTime ())
|
||||
|
|
@ -999,8 +1005,8 @@ void Bot::CombatFight (void)
|
|||
// to start strafing, we have to first figure out if the target is on the left side or right side
|
||||
MakeVectors (m_enemy->v.v_angle);
|
||||
|
||||
Vector dirToPoint = (pev->origin - m_enemy->v.origin).Normalize2D ();
|
||||
Vector rightSide = g_pGlobals->v_right.Normalize2D ();
|
||||
const Vector &dirToPoint = (pev->origin - m_enemy->v.origin).Normalize2D ();
|
||||
const Vector &rightSide = g_pGlobals->v_right.Normalize2D ();
|
||||
|
||||
if ((dirToPoint | rightSide) < 0)
|
||||
m_combatStrafeDir = 1;
|
||||
|
|
@ -1039,6 +1045,9 @@ void Bot::CombatFight (void)
|
|||
|
||||
if (m_moveSpeed > 0.0 && distance > 150.0 && m_currentWeapon != WEAPON_KNIFE)
|
||||
m_moveSpeed = 0.0;
|
||||
|
||||
if (m_currentWeapon == WEAPON_KNIFE)
|
||||
m_strafeSpeed = 0.0f;
|
||||
}
|
||||
else if (m_fightStyle == 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -108,10 +108,12 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c
|
|||
"------------------------------------------------\n"
|
||||
"Name: %s\n"
|
||||
"Version: %s (Build: %u)\n"
|
||||
"Compiled: %s, %s tz: +3\n"
|
||||
"Compiled: %s, %s\n"
|
||||
"Git Hash: %s\n"
|
||||
"Git Commit Author: %s\n"
|
||||
"------------------------------------------------";
|
||||
|
||||
ClientPrint (ent, print_console, versionData, PRODUCT_NAME, PRODUCT_VERSION, GenerateBuildNumber (), __DATE__, __TIME__);
|
||||
ClientPrint (ent, print_console, versionData, PRODUCT_NAME, PRODUCT_VERSION, GenerateBuildNumber (), __DATE__, __TIME__, PRODUCT_GIT_HASH, PRODUCT_GIT_COMMIT_AUTHOR);
|
||||
}
|
||||
|
||||
// display some sort of help information
|
||||
|
|
|
|||
|
|
@ -3288,7 +3288,7 @@ bool Bot::IsPointOccupied (int index)
|
|||
// check if this waypoint is already used
|
||||
if (IsAlive (bot->GetEntity ()))
|
||||
{
|
||||
if ((GetShootingConeDeviation (bot->GetEntity (), &pev->origin) >= 0.7 ? bot->m_prevWptIndex[0] : m_currentWaypointIndex) == index || bot->GetTask ()->data == index)
|
||||
if ((GetShootingConeDeviation (bot->GetEntity (), &pev->origin) >= 0.7f ? bot->m_prevWptIndex[0] : m_currentWaypointIndex) == index || bot->GetTask ()->data == index)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -3307,7 +3307,7 @@ edict_t *Bot::FindNearestButton (const char *targetName)
|
|||
edict_t *searchEntity = NULL, *foundEntity = NULL;
|
||||
|
||||
// find the nearest button which can open our target
|
||||
while (!IsEntityNull(searchEntity = FIND_ENTITY_BY_TARGET(searchEntity, targetName)))
|
||||
while (!IsEntityNull(searchEntity = FIND_ENTITY_BY_TARGET (searchEntity, targetName)))
|
||||
{
|
||||
Vector entityOrign = GetEntityOrigin (searchEntity);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue