too close trigger

This commit is contained in:
Yunfan Li
2023-08-27 00:05:06 +08:00
parent 695d0c83b5
commit fe49f10477

View File

@@ -15,7 +15,7 @@ static float GetSpeedInMotion(Unit* target)
bool EnemyTooCloseForSpellTrigger::IsActive() bool EnemyTooCloseForSpellTrigger::IsActive()
{ {
Unit* target = AI_VALUE(Unit*, "current target"); Unit* target = AI_VALUE(Unit*, "current target");
return target && target->GetVictim() != bot && return target && (target->GetVictim() != bot || target->isFrozen() || !target->CanFreeMove()) &&
target->GetObjectSize() <= 10.0f && target->GetObjectSize() <= 10.0f &&
AI_VALUE2(float, "distance", "current target") <= sPlayerbotAIConfig->tooCloseDistance; AI_VALUE2(float, "distance", "current target") <= sPlayerbotAIConfig->tooCloseDistance;
// Unit* target = AI_VALUE(Unit*, "current target"); // Unit* target = AI_VALUE(Unit*, "current target");
@@ -79,7 +79,7 @@ bool EnemyTooCloseForAutoShotTrigger::IsActive()
bool EnemyTooCloseForShootTrigger::IsActive() bool EnemyTooCloseForShootTrigger::IsActive()
{ {
Unit* target = AI_VALUE(Unit*, "current target"); Unit* target = AI_VALUE(Unit*, "current target");
return target && target->GetVictim() != bot && AI_VALUE2(float, "distance", "current target") <= sPlayerbotAIConfig->shootDistance; return target && (target->GetVictim() != bot || target->isFrozen() || !target->CanFreeMove()) && AI_VALUE2(float, "distance", "current target") <= sPlayerbotAIConfig->shootDistance;
// Unit* target = AI_VALUE(Unit*, "current target"); // Unit* target = AI_VALUE(Unit*, "current target");
// if (!target) // if (!target)