diff options
author | Discover- <amort11@hotmail.com> | 2014-11-02 17:30:44 +0100 |
---|---|---|
committer | MitchesD <majklprofik@seznam.cz> | 2014-11-02 18:48:31 +0100 |
commit | b61098a2d451fde5199ddce132ad3f2ed806e743 (patch) | |
tree | a632b51a7b9efc1c2409159af8026d7c051336be | |
parent | 11e192cb8157be43b9affa2e429efdeb26ddb649 (diff) |
Core/SAI: Allow dropping a specific amount of aura charges using SMART_ACTION_REMOVEAURASFROMSPELL (action_param2).
(cherry picked from commit ed4feec276bd395715c23c58b74a6dae4198039b)
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 10 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index f3060972288..36918231fbb 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -776,7 +776,15 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u continue; if (e.action.removeAura.spell) - (*itr)->ToUnit()->RemoveAurasDueToSpell(e.action.removeAura.spell); + { + if (e.action.removeAura.charges) + { + if (Aura* aur = (*itr)->ToUnit()->GetAura(e.action.removeAura.spell)) + aur->ModCharges(-e.action.removeAura.charges, AURA_REMOVE_BY_EXPIRE); + } + else + (*itr)->ToUnit()->RemoveAurasDueToSpell(e.action.removeAura.spell); + } else (*itr)->ToUnit()->RemoveAllAuras(); diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 9bb34d1347e..71a3ed8156f 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -444,7 +444,7 @@ enum SMART_ACTION SMART_ACTION_FLEE_FOR_ASSIST = 25, // With Emote SMART_ACTION_CALL_GROUPEVENTHAPPENS = 26, // QuestID // none = 27, - SMART_ACTION_REMOVEAURASFROMSPELL = 28, // Spellid, 0 removes all auras + SMART_ACTION_REMOVEAURASFROMSPELL = 28, // Spellid (0 removes all auras), charges (0 removes aura) SMART_ACTION_FOLLOW = 29, // Distance (0 = default), Angle (0 = default), EndCreatureEntry, credit, creditType (0monsterkill, 1event) SMART_ACTION_RANDOM_PHASE = 30, // PhaseId1, PhaseId2, PhaseId3... SMART_ACTION_RANDOM_PHASE_RANGE = 31, // PhaseMin, PhaseMax @@ -656,6 +656,7 @@ struct SmartAction struct { uint32 spell; + uint32 charges; } removeAura; struct |