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:
thenecromancer
2010-01-21 16:25:09 +01:00
parent 3b29a4e6f4
commit 76102c1cdd
4 changed files with 30 additions and 4 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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);
}