From 76102c1cdd0fc8bb473f9b3fd3965cea5a3794f6 Mon Sep 17 00:00:00 2001 From: thenecromancer Date: Thu, 21 Jan 2010 16:25:09 +0100 Subject: Change temp threat aura mods to use temp threat modifier instead of "asisting" it's threat value over all references. --HG-- branch : trunk --- src/game/HostilRefManager.cpp | 21 +++++++++++++++++++++ src/game/HostilRefManager.h | 2 ++ src/game/SpellAuraEffects.cpp | 4 +--- src/game/ThreatManager.h | 7 ++++++- 4 files changed, 30 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/game/HostilRefManager.cpp b/src/game/HostilRefManager.cpp index e3fdcf4fb4e..8da2e566d24 100644 --- a/src/game/HostilRefManager.cpp +++ b/src/game/HostilRefManager.cpp @@ -51,6 +51,27 @@ void HostilRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry con } } +//================================================= + +void HostilRefManager::addTempThreat(float fThreat, bool apply) +{ + HostilReference* ref = getFirst(); + + while(ref != NULL) + { + if (apply) + { + if (ref->getTempThreatModifier() == 0.0f) + ref->addTempThreat(fThreat); + } + else + ref->resetTempThreat(); + + ref = ref->next(); + } +} + + //================================================= void HostilRefManager::addThreatPercent(int32 iPercent) diff --git a/src/game/HostilRefManager.h b/src/game/HostilRefManager.h index 3a675deed32..defaea1ea12 100644 --- a/src/game/HostilRefManager.h +++ b/src/game/HostilRefManager.h @@ -46,6 +46,8 @@ class HostilRefManager : public RefManager // use for buffs and healing threat functionality void threatAssist(Unit *pVictim, float fThreat, SpellEntry const *threatSpell = 0, bool pSingleTarget = false); + void addTempThreat(float fThreat, bool apply); + void addThreatPercent(int32 iPercent); // The references are not needed anymore diff --git a/src/game/SpellAuraEffects.cpp b/src/game/SpellAuraEffects.cpp index da27cc0ef10..6f8818298b3 100644 --- a/src/game/SpellAuraEffects.cpp +++ b/src/game/SpellAuraEffects.cpp @@ -3662,9 +3662,7 @@ void AuraEffect::HandleAuraModTotalThreat(AuraApplication const * aurApp, uint8 if (!caster || !caster->isAlive()) return; - float threatMod = (apply) ? float(GetAmount()) : float(-GetAmount()); - - target->getHostilRefManager().threatAssist(caster, threatMod); + target->getHostilRefManager().addTempThreat(GetAmount(), apply); } void AuraEffect::HandleModTaunt(AuraApplication const * aurApp, uint8 mode, bool apply) const diff --git a/src/game/ThreatManager.h b/src/game/ThreatManager.h index 3dd444a065d..6865453ae44 100644 --- a/src/game/ThreatManager.h +++ b/src/game/ThreatManager.h @@ -76,7 +76,12 @@ class TRINITY_DLL_SPEC HostilReference : public Reference // the threat modification is stored void setTempThreat(float fThreat) { - iTempThreatModifier = fThreat - getThreat(); + addTempThreat(fThreat - getThreat()); + } + + void addTempThreat(float fThreat) + { + iTempThreatModifier = fThreat; if (iTempThreatModifier != 0.0f) addThreat(iTempThreatModifier); } -- cgit v1.2.3