[9603] Implement use of UNIT_FLAG_PASSIVE for creature.

Add function to check creatures own ability to initiate an attack in MoveInLineOfSight.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-03-18 11:28:43 +01:00
parent a27ff3e79d
commit bfecdc3ded
6 changed files with 21 additions and 5 deletions

View file

@ -1022,7 +1022,7 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who)
if (m_creature->isCivilian() || m_creature->IsNeutralToAll())
return;
if (!m_creature->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED) && who->isTargetableForAttack() &&
if (m_creature->CanInitiateAttack() && who->isTargetableForAttack() &&
m_creature->IsHostileTo(who) && who->isInAccessablePlaceFor(m_creature))
{
if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)