[10741] Add AI function OwnerKilledUnit for protector pets (when owner kills unit)

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-11-19 01:55:44 +01:00
parent 82505a8633
commit 21d63d491b
3 changed files with 15 additions and 1 deletions

View file

@ -785,7 +785,18 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
// Call KilledUnit for creatures
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->AI())
{
((Creature*)this)->AI()->KilledUnit(pVictim);
}
else if (GetTypeId() == TYPEID_PLAYER)
{
// currently not known if other pet types (not controllable) may have some action at owner kills
if (Pet* pProtector = GetProtectorPet())
{
if (pProtector->AI())
pProtector->AI()->OwnerKilledUnit(pVictim);
}
}
// achievement stuff
if (pVictim->GetTypeId() == TYPEID_PLAYER)