Core/SAI: Fix an issue where SAI was ignoring civilian and passive unit flags
Closes #2526 Disclaimer: This was not thoroughly tested; report any issue caused by this change.
This commit is contained in:
@@ -470,6 +470,9 @@ void SmartAI::MoveInLineOfSight(Unit* who)
|
|||||||
if (!CanAIAttack(who))
|
if (!CanAIAttack(who))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!me->canStartAttack(who, false))
|
||||||
|
return;
|
||||||
|
|
||||||
if (me->IsHostileTo(who))
|
if (me->IsHostileTo(who))
|
||||||
{
|
{
|
||||||
float fAttackRadius = me->GetAttackDistance(who);
|
float fAttackRadius = me->GetAttackDistance(who);
|
||||||
@@ -487,9 +490,6 @@ void SmartAI::MoveInLineOfSight(Unit* who)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (me->canStartAttack(who, false))
|
|
||||||
// AttackStart(who);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SmartAI::CanAIAttack(const Unit* /*who*/) const
|
bool SmartAI::CanAIAttack(const Unit* /*who*/) const
|
||||||
|
|||||||
@@ -1025,15 +1025,11 @@ namespace Trinity
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_force)
|
if (m_force)
|
||||||
{
|
|
||||||
if (!me->IsValidAttackTarget(u))
|
if (!me->IsValidAttackTarget(u))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (!me->canStartAttack(u, false))
|
if (!me->canStartAttack(u, false))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
m_range = me->GetDistance(u); // use found unit range as new range limit for next check
|
m_range = me->GetDistance(u); // use found unit range as new range limit for next check
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user