mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[10741] Add AI function OwnerKilledUnit for protector pets (when owner kills unit)
Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
82505a8633
commit
21d63d491b
3 changed files with 15 additions and 1 deletions
|
|
@ -101,6 +101,9 @@ class MANGOS_DLL_SPEC CreatureAI
|
||||||
// Called when the creature kills a unit
|
// Called when the creature kills a unit
|
||||||
virtual void KilledUnit(Unit *) {}
|
virtual void KilledUnit(Unit *) {}
|
||||||
|
|
||||||
|
// Called when owner of m_creature (if m_creature is PROTECTOR_PET) kills a unit
|
||||||
|
virtual void OwnerKilledUnit(Unit *) {}
|
||||||
|
|
||||||
// Called when the creature summon successfully other creature
|
// Called when the creature summon successfully other creature
|
||||||
virtual void JustSummoned(Creature* ) {}
|
virtual void JustSummoned(Creature* ) {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -785,7 +785,18 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||||
|
|
||||||
// Call KilledUnit for creatures
|
// Call KilledUnit for creatures
|
||||||
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->AI())
|
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->AI())
|
||||||
|
{
|
||||||
((Creature*)this)->AI()->KilledUnit(pVictim);
|
((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
|
// achievement stuff
|
||||||
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10740"
|
#define REVISION_NR "10741"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue