Fix melee reach target

This commit is contained in:
Yunfan Li
2024-02-09 20:31:34 +08:00
parent 27569f431f
commit 5e39f3c732
6 changed files with 46 additions and 8 deletions

View File

@@ -131,7 +131,9 @@ bool EnemyIsCloseTrigger::IsActive()
bool OutOfRangeTrigger::IsActive()
{
Unit* target = AI_VALUE(Unit*, GetTargetName());
return target && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", GetTargetName()), distance);
// increase contact distance to prevent calculation error
float dis = distance + CONTACT_DISTANCE;
return target && !bot->IsWithinCombatRange(target, dis); // sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", GetTargetName()), distance);
}
EnemyOutOfSpellRangeTrigger::EnemyOutOfSpellRangeTrigger(PlayerbotAI* botAI) : OutOfRangeTrigger(botAI, "enemy out of spell range", botAI->GetRange("spell"))