From 50cea6638b8d211f562fc5422f91bcbfa646f396 Mon Sep 17 00:00:00 2001 From: w1sht0l1v3 Date: Wed, 5 Sep 2012 04:40:03 +0300 Subject: 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) --- src/server/game/AI/SmartScripts/SmartAI.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/server/game/AI/SmartScripts') 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) -- cgit v1.2.3