mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Merge pull request #422 from fuzzdeveloper/bots-hiding-in-av-flags-fix
Bots will no longer hide within flagpoles when capping points in AV AB or IOC
This commit is contained in:
@@ -4410,11 +4410,11 @@ bool BGTactics::moveToObjective()
|
|||||||
//std::ostringstream out; out << "Moving to objective " << pos.x << ", " << pos.y << ", Distance: " << sServerFacade->GetDistance2d(bot, pos.x, pos.y);
|
//std::ostringstream out; out << "Moving to objective " << pos.x << ", " << pos.y << ", Distance: " << sServerFacade->GetDistance2d(bot, pos.x, pos.y);
|
||||||
//bot->Say(out.str(), LANG_UNIVERSAL);
|
//bot->Say(out.str(), LANG_UNIVERSAL);
|
||||||
|
|
||||||
// more precise position for wsg and AV (flags in AV towers require precision)
|
// more precise position for wsg
|
||||||
if (bgType == BATTLEGROUND_WS || bgType == BATTLEGROUND_AV)
|
if (bgType == BATTLEGROUND_WS)
|
||||||
return MoveTo(bot->GetMapId(), pos.x, pos.y, pos.z);
|
return MoveTo(bot->GetMapId(), pos.x, pos.y, pos.z);
|
||||||
else
|
else
|
||||||
return MoveNear(bot->GetMapId(), pos.x, pos.y, pos.z, 3.0f);
|
return MoveNear(bot->GetMapId(), pos.x, pos.y, pos.z, 1.5f);//note - don't make distance too large or horde bots may struggle to get flags in alliance AV towers (because they'll be targetting a spot in midair)
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -4774,9 +4774,9 @@ bool BGTactics::atFlag(std::vector<BattleBotPath*> const& vPaths, std::vector<ui
|
|||||||
if (!bot->CanUseBattlegroundObject(go) && bgType != BATTLEGROUND_WS)
|
if (!bot->CanUseBattlegroundObject(go) && bgType != BATTLEGROUND_WS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (flagRange)
|
float const dist = sqrt(bot->GetDistance(go));
|
||||||
if (!bot->IsWithinDistInMap(go, flagRange))
|
if (flagRange && dist > flagRange)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool atBase = bgType == BATTLEGROUND_WS ? go->GetEntry() == vFlagsWS[bot->GetTeamId()] : bgType == BATTLEGROUND_EY ? go->GetEntry() == vFlagsEY[0] : false;
|
bool atBase = bgType == BATTLEGROUND_WS ? go->GetEntry() == vFlagsWS[bot->GetTeamId()] : bgType == BATTLEGROUND_EY ? go->GetEntry() == vFlagsEY[0] : false;
|
||||||
|
|
||||||
@@ -4789,6 +4789,13 @@ bool BGTactics::atFlag(std::vector<BattleBotPath*> const& vPaths, std::vector<ui
|
|||||||
case BATTLEGROUND_AB:
|
case BATTLEGROUND_AB:
|
||||||
case BATTLEGROUND_IC:
|
case BATTLEGROUND_IC:
|
||||||
{
|
{
|
||||||
|
if (dist == 0.0f)
|
||||||
|
{
|
||||||
|
// this is to prevent bots capping while standing INSIDE the flag pole (which can be thick enough to hide player entirely)
|
||||||
|
// note that dist is taking into account size of object and bot (it's the space between outside of both) so moveDist needs to as well
|
||||||
|
float const moveDist = bot->GetObjectSize() + go->GetObjectSize() + 0.1f;
|
||||||
|
return MoveTo(bot->GetMapId(), go->GetPositionX() + (urand(0, 1) ? -moveDist : moveDist), go->GetPositionY() + (urand(0, 1) ? -moveDist : moveDist), go->GetPositionZ());
|
||||||
|
}
|
||||||
if (bot->IsMounted())
|
if (bot->IsMounted())
|
||||||
bot->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
bot->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||||
|
|
||||||
@@ -4820,7 +4827,7 @@ bool BGTactics::atFlag(std::vector<BattleBotPath*> const& vPaths, std::vector<ui
|
|||||||
}
|
}
|
||||||
case BATTLEGROUND_WS:
|
case BATTLEGROUND_WS:
|
||||||
{
|
{
|
||||||
if (bot->IsWithinDistInMap(go, INTERACTION_DISTANCE))
|
if (dist < INTERACTION_DISTANCE)
|
||||||
{
|
{
|
||||||
if (atBase)
|
if (atBase)
|
||||||
{
|
{
|
||||||
@@ -4868,7 +4875,7 @@ bool BGTactics::atFlag(std::vector<BattleBotPath*> const& vPaths, std::vector<ui
|
|||||||
}
|
}
|
||||||
case BATTLEGROUND_EY:
|
case BATTLEGROUND_EY:
|
||||||
{
|
{
|
||||||
if (bot->IsWithinDistInMap(go, INTERACTION_DISTANCE))
|
if (dist < INTERACTION_DISTANCE)
|
||||||
{
|
{
|
||||||
if (bot->IsMounted())
|
if (bot->IsMounted())
|
||||||
bot->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
bot->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||||
|
|||||||
Reference in New Issue
Block a user