diff options
author | w1sht0l1v3 <w1sht0l1v3@gmail.com> | 2012-09-05 04:40:03 +0300 |
---|---|---|
committer | w1sht0l1v3 <w1sht0l1v3@gmail.com> | 2012-09-05 04:53:06 +0300 |
commit | 50cea6638b8d211f562fc5422f91bcbfa646f396 (patch) | |
tree | d396d96b175b40f981b7499cdaf8952bbb19bcfd | |
parent | b8d55cc019f8ce3a936f9d805e6d762c60d28c5d (diff) |
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)
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 0b8236908a0..b86521fee45 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -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) |