Add support for CreatureAI::DamageDealt used in a Zul'Aman script. Thanks joshwhedon.

--HG--
branch : trunk
This commit is contained in:
silinoron
2010-08-02 14:18:30 -07:00
parent e798097ae3
commit 14827321bf
3 changed files with 7 additions and 1 deletions
+3
View File
@@ -95,6 +95,9 @@ class CreatureAI : public UnitAI
// Called for reaction at enter to combat if not in combat yet (enemy can be NULL) // Called for reaction at enter to combat if not in combat yet (enemy can be NULL)
virtual void EnterCombat(Unit* /*enemy*/) {} virtual void EnterCombat(Unit* /*enemy*/) {}
// Called at any Damage to any victim (before damage apply)
virtual void DamageDealt(Unit * /*done_to*/, uint32 & /*damage*/) { }
// Called at any Damage from any attacker (before damage apply) // Called at any Damage from any attacker (before damage apply)
// Note: it for recalculation damage or special reaction at damage // Note: it for recalculation damage or special reaction at damage
// for attack reaction use AttackedBy called for not DOT damage in Unit::DealDamage also // for attack reaction use AttackedBy called for not DOT damage in Unit::DealDamage also
+3
View File
@@ -567,6 +567,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsAIEnabled) if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsAIEnabled)
pVictim->ToCreature()->AI()->DamageTaken(this, damage); pVictim->ToCreature()->AI()->DamageTaken(this, damage);
if (GetTypeId() == TYPEID_UNIT && this->ToCreature()->IsAIEnabled)
this->ToCreature()->AI()->DamageDealt(pVictim, damage);
if (damagetype != NODAMAGE) if (damagetype != NODAMAGE)
{ {
// interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras) // interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)
@@ -179,7 +179,7 @@ struct boss_janalaiAI : public ScriptedAI
// DoZoneInCombat(); // DoZoneInCombat();
} }
void DamageDeal(Unit *pTarget, uint32 &damage) void DamageDealt(Unit *pTarget, uint32 &damage)
{ {
if (isFlameBreathing) if (isFlameBreathing)
{ {