Encourage hunter bots to use auto shot

This commit is contained in:
qudzy
2022-06-01 22:49:40 +02:00
parent 66e77e324d
commit 15e3e452d8
7 changed files with 49 additions and 2 deletions

View File

@@ -44,6 +44,34 @@ bool EnemyTooCloseForSpellTrigger::IsActive()
return false;
}
bool EnemyTooCloseForAutoShotTrigger::IsActive()
{
Unit* target = AI_VALUE(Unit*, "current target");
if (!target)
return false;
if (target->GetTarget() == bot->GetGUID() && !bot->GetGroup() && !target->HasUnitState(UNIT_STATE_ROOT) && GetSpeedInMotion(target) > GetSpeedInMotion(bot) * 0.65f)
return false;
bool isBoss = false;
bool isRaid = false;
float combatReach = bot->GetCombatReach() + target->GetCombatReach();
float targetDistance = sServerFacade->GetDistance2d(bot, target) + combatReach;
if (target->GetTypeId() == TYPEID_UNIT)
{
Creature* creature = botAI->GetCreature(target->GetGUID());
if (creature)
{
isBoss = creature->isWorldBoss();
}
}
if (bot->GetMap() && bot->GetMap()->IsRaid())
isRaid = true;
return sServerFacade->IsDistanceLessOrEqualThan(targetDistance, 5.0f);
}
bool EnemyTooCloseForShootTrigger::IsActive()
{
Unit* target = AI_VALUE(Unit*, "current target");