diff options
-rw-r--r-- | src/game/HostilRefManager.cpp | 21 | ||||
-rw-r--r-- | src/game/HostilRefManager.h | 2 | ||||
-rw-r--r-- | src/game/SpellAuraEffects.cpp | 4 | ||||
-rw-r--r-- | src/game/ThreatManager.h | 7 |
4 files changed, 30 insertions, 4 deletions
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 @@ -53,6 +53,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) { HostilReference* ref; 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<Unit, ThreatManager> // 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<Unit, ThreatManager> // 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); } |