mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08: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:
File diff suppressed because it is too large
Load Diff
@@ -177,6 +177,28 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Vehicle* vehicle = bot->GetVehicle())
|
||||
{
|
||||
VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(bot);
|
||||
Unit* vehicleBase = vehicle->GetBase();
|
||||
if (!vehicleBase || !seat || !seat->CanControl()) // is passenger and cant move anyway
|
||||
return false;
|
||||
|
||||
float distance = vehicleBase->GetExactDist(x, y, z);
|
||||
if (distance <= sPlayerbotAIConfig->contactDistance)
|
||||
return false;
|
||||
|
||||
MotionMaster& mm = *vehicleBase->GetMotionMaster(); // need to move vehicle, not bot
|
||||
mm.Clear();
|
||||
mm.MovePoint(mapId, x, y, z, generatePath);
|
||||
|
||||
float delay = 1000.0f * (distance / vehicleBase->GetSpeed(MOVE_RUN)) - sPlayerbotAIConfig->reactDelay;
|
||||
delay = std::max(.0f, delay);
|
||||
delay = std::min((float)sPlayerbotAIConfig->maxWaitForMove, delay);
|
||||
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation(), delay);
|
||||
return true;
|
||||
}
|
||||
// if (bot->Unit::IsFalling()) {
|
||||
// bot->Say("I'm falling!, flag:" + std::to_string(bot->m_movementInfo.GetMovementFlags()), LANG_UNIVERSAL);
|
||||
// return false;
|
||||
|
||||
@@ -119,7 +119,11 @@ bool AutoReleaseSpiritAction::Execute(Event event)
|
||||
}
|
||||
if (bot->GetDistance(unit) >= INTERACTION_DISTANCE)
|
||||
{
|
||||
bot->GetMotionMaster()->MoveChase(unit);
|
||||
// bot needs to actually click spirit-healer in BG to get res timer going
|
||||
// and in IOC it's not within clicking range when they res in own base
|
||||
MotionMaster& mm = *bot->GetMotionMaster();
|
||||
mm.Clear();
|
||||
mm.MovePoint(bot->GetMapId(), unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5,11 +5,16 @@
|
||||
|
||||
#include "VehicleActions.h"
|
||||
|
||||
#include "BattlegroundIC.h"
|
||||
#include "ItemVisitors.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
// TODO methods to enter/exit vehicle should be added to BGTactics or MovementAction (so that we can better control
|
||||
// whether bot is in vehicle, eg: get out of vehicle to cap flag, if we're down to final boss, etc),
|
||||
// right now they will enter vehicle based only what's available here, then they're stuck in vehicle until they die
|
||||
// (LeaveVehicleAction doesnt do much seeing as they, or another bot, will get in immediately after exit)
|
||||
bool EnterVehicleAction::Execute(Event event)
|
||||
{
|
||||
// do not switch vehicles yet
|
||||
@@ -21,21 +26,31 @@ bool EnterVehicleAction::Execute(Event event)
|
||||
{
|
||||
Unit* vehicleBase = botAI->GetUnit(*i);
|
||||
if (!vehicleBase)
|
||||
return false;
|
||||
continue;
|
||||
|
||||
// dont let them get in the cannons as they'll stay forever and do nothing useful
|
||||
// dont let them in catapult they cant use them at all
|
||||
if (NPC_KEEP_CANNON == vehicleBase->GetEntry() || NPC_CATAPULT == vehicleBase->GetEntry())
|
||||
continue;
|
||||
|
||||
if (!vehicleBase->IsFriendlyTo(bot))
|
||||
return false;
|
||||
continue;
|
||||
|
||||
if (!vehicleBase->GetVehicleKit()->GetAvailableSeatCount())
|
||||
return false;
|
||||
continue;
|
||||
|
||||
if (fabs(bot->GetPositionZ() - vehicleBase->GetPositionZ()) < 20.0f)
|
||||
// this will avoid adding passengers (which dont really do much for the IOC vehicles which is the only place
|
||||
// this code is used)
|
||||
if (vehicleBase->GetVehicleKit()->IsVehicleInUse())
|
||||
continue;
|
||||
|
||||
// if (sServerFacade->GetDistance2d(bot, vehicle) > 100.0f)
|
||||
// continue;
|
||||
// if (fabs(bot->GetPositionZ() - vehicleBase->GetPositionZ()) < 20.0f)
|
||||
|
||||
if (sServerFacade->GetDistance2d(bot, vehicleBase) > 10.0f)
|
||||
return MoveTo(vehicleBase, INTERACTION_DISTANCE);
|
||||
// if (sServerFacade->GetDistance2d(bot, vehicle) > 100.0f)
|
||||
// continue;
|
||||
|
||||
if (sServerFacade->GetDistance2d(bot, vehicleBase) > INTERACTION_DISTANCE)
|
||||
return MoveTo(vehicleBase, INTERACTION_DISTANCE - 1.0f);
|
||||
|
||||
bot->EnterVehicle(vehicleBase);
|
||||
|
||||
|
||||
@@ -99,8 +99,9 @@ void IsleStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||
new TriggerNode("in vehicle", NextAction::array(0, new NextAction("incendiary rocket", 70.0f), nullptr)));
|
||||
triggers.push_back(
|
||||
new TriggerNode("in vehicle", NextAction::array(0, new NextAction("rocket blast", 70.0f), nullptr)));
|
||||
triggers.push_back(
|
||||
new TriggerNode("in vehicle", NextAction::array(0, new NextAction("blade salvo", 71.0f), nullptr)));
|
||||
// this is bugged: it doesn't work, and stops glaive throw working (which is needed to take down gate)
|
||||
// triggers.push_back(
|
||||
// new TriggerNode("in vehicle", NextAction::array(0, new NextAction("blade salvo", 71.0f), nullptr)));
|
||||
triggers.push_back(
|
||||
new TriggerNode("in vehicle", NextAction::array(0, new NextAction("glaive throw", 70.0f), nullptr)));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ bool NearestVehiclesValue::AcceptUnit(Unit* unit)
|
||||
if (!unit || !unit->IsVehicle() || !unit->IsAlive())
|
||||
return false;
|
||||
|
||||
Vehicle* veh = unit->GetVehicle();
|
||||
Vehicle* veh = unit->GetVehicleKit();
|
||||
if (!veh || !veh->GetAvailableSeatCount())
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user