mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 16:38:42 +01:00
Change temp threat aura mods to use temp threat modifier instead of "asisting" it's threat value over all references.
--HG-- branch : trunk
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user