Core/Scripts: Moved HealReceived from CreatureAI to UnitAI and added HealDone and removed creature-only restriction
--HG-- branch : trunk
This commit is contained in:
@@ -545,11 +545,11 @@ void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb)
|
||||
|
||||
uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss)
|
||||
{
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsAIEnabled)
|
||||
pVictim->ToCreature()->AI()->DamageTaken(this, damage);
|
||||
if (pVictim->IsAIEnabled)
|
||||
pVictim->GetAI()->DamageTaken(this, damage);
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT && this->ToCreature()->IsAIEnabled)
|
||||
this->ToCreature()->AI()->DamageDealt(pVictim, damage, damagetype);
|
||||
if (IsAIEnabled)
|
||||
GetAI()->DamageDealt(pVictim, damage, damagetype);
|
||||
|
||||
if (damagetype != NODAMAGE)
|
||||
{
|
||||
@@ -9892,8 +9892,11 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth)
|
||||
{
|
||||
int32 gain = 0;
|
||||
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsAIEnabled)
|
||||
pVictim->ToCreature()->AI()->HealReceived(this, addhealth);
|
||||
if (pVictim->IsAIEnabled)
|
||||
pVictim->GetAI()->HealReceived(this, addhealth);
|
||||
|
||||
if (IsAIEnabled)
|
||||
GetAI()->HealDone(pVictim, addhealth);
|
||||
|
||||
if (addhealth)
|
||||
gain = pVictim->ModifyHealth(int32(addhealth));
|
||||
|
||||
@@ -1106,6 +1106,9 @@ class Unit : public WorldObject
|
||||
|
||||
virtual ~Unit ();
|
||||
|
||||
UnitAI* GetAI() { return i_AI; }
|
||||
void SetAI(UnitAI* newAI) { i_AI = newAI; }
|
||||
|
||||
void AddToWorld();
|
||||
void RemoveFromWorld();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user