mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-15 09:50:27 +00:00
[Battlegrounds] many IOC fixes: fixed bots not being able to revive in their own base GY, fixed bots not able to use flags in IOC at all (couldnt cap anything), added path so bots could reach boss and several other paths too, fixed horde bots not being able to tell that alliance gate is down (stayed outside forever), fixed bots not able to get in vehicles, fixed bots not able to drive vehicles, fixed bots in vehicles becoming unresponsive after a fight (in-combat status seems to never clear in vehicle which may be AC bug), reduced bot 'agro distance' when in vehicle so they can get to their objective, redid selectObject strat completely, prevented bots using cannons (bots are useless in them) and catapults (they dont know how to use them), prevented bots using Glaive Thrower's Blade Salvo as it's bugged (and stops them using any attacks after they use it), many other fixes
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
bool NearestEnemyPlayersValue::AcceptUnit(Unit* unit)
|
||||
{
|
||||
@@ -25,7 +26,19 @@ bool NearestEnemyPlayersValue::AcceptUnit(Unit* unit)
|
||||
|
||||
Unit* EnemyPlayerValue::Calculate()
|
||||
{
|
||||
bool inCannon = botAI->IsInVehicle(false, true);
|
||||
bool controllingCannon = false;
|
||||
bool controllingVehicle = false;
|
||||
if (Vehicle* vehicle = bot->GetVehicle())
|
||||
{
|
||||
VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(bot);
|
||||
if (!seat || !seat->CanControl()) // not in control of vehicle so cant attack anyone
|
||||
return nullptr;
|
||||
VehicleEntry const* vi = vehicle->GetVehicleInfo();
|
||||
if (vi && vi->m_flags & VEHICLE_FLAG_FIXED_POSITION)
|
||||
controllingCannon = true;
|
||||
else
|
||||
controllingVehicle = true;
|
||||
}
|
||||
|
||||
// 1. Check units we are currently in combat with.
|
||||
std::vector<Unit*> targets;
|
||||
@@ -95,12 +108,15 @@ Unit* EnemyPlayerValue::Calculate()
|
||||
}
|
||||
|
||||
// Aggro weak enemies from further away.
|
||||
uint32 const aggroDistance = (inCannon || bot->GetHealth() > pTarget->GetHealth()) ? maxAggroDistance : 20.0f;
|
||||
// If controlling mobile vehicle only agro close enemies (otherwise will never reach objective)
|
||||
uint32 const aggroDistance = controllingVehicle ? 5.0f
|
||||
: (controllingCannon || bot->GetHealth() > pTarget->GetHealth()) ? maxAggroDistance
|
||||
: 20.0f;
|
||||
if (!bot->IsWithinDist(pTarget, aggroDistance))
|
||||
continue;
|
||||
|
||||
if (bot->IsWithinLOSInMap(pTarget) &&
|
||||
(inCannon || (fabs(bot->GetPositionZ() - pTarget->GetPositionZ()) < 30.0f)))
|
||||
(controllingCannon || (fabs(bot->GetPositionZ() - pTarget->GetPositionZ()) < 30.0f)))
|
||||
return pTarget;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user