Core/Scripts: Moved HealReceived from CreatureAI to UnitAI and added HealDone and removed creature-only restriction

--HG--
branch : trunk
This commit is contained in:
Shauren committed 2010-10-25 11:12:47 +02:00
1 parent 4f5a60c487
commit 42065a236e
4 files changed
+18 -9

No files matched your search

+9 -6
View File
@@ -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));