Core/SAI: Fix SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL

Proper usage of params:
-param1: flat hp value
-param2: percent hp value
Note: only one of these params should be used(in case you set values in both,the script will chose percent)
This commit is contained in:
w1sht0l1v3
2012-09-05 04:40:03 +03:00
parent b8d55cc019
commit 50cea6638b

View File

@@ -634,8 +634,11 @@ void SmartAI::SpellHitTarget(Unit* target, const SpellInfo* spellInfo)
void SmartAI::DamageTaken(Unit* doneBy, uint32& damage)
{
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage);
if ((me->GetHealth() - damage) <= mInvincibilityHpLevel)
damage = me->GetHealth() - mInvincibilityHpLevel;
if (damage >= me->GetHealth() - mInvincibilityHpLevel)
{
damage = 0;
me->SetHealth(mInvincibilityHpLevel);
}
}
void SmartAI::HealReceived(Unit* doneBy, uint32& addhealth)