[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

@ -1634,6 +1634,20 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
return true;
}
bool Creature::CanInitiateAttack()
{
if (hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED))
return false;
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
return false;
if (isPassiveToHostile())
return false;
return true;
}
void Creature::SaveRespawnTime()
{
if(isPet() || !m_DBTableGuid)