[11011] Remove some more code from threatAssist()

* calcThreat() is also called in addThreat() when given proper parameters,
  and division by 'size' is commutative
* threat redirection is also handled in addThreat() again
This commit is contained in:
Lynx3d 2011-01-15 15:49:45 +01:00
parent 7d4c96f244
commit 3d551a68b5
2 changed files with 4 additions and 19 deletions

View file

@ -44,26 +44,11 @@ void HostileRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry co
Unit* redirectedTarget = redirectedMod ? pVictim->getHostileRefManager().GetThreatRedirectionTarget() : NULL;
uint32 size = pSingleTarget ? 1 : getSize(); // if pSingleTarget do not devide threat
float threat = pThreat/size;
HostileReference* ref = getFirst();
while(ref != NULL)
while (ref)
{
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, false, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
if (threat > 0.0f)
{
if (redirectedTarget && redirectedTarget != ref->getTarget() && redirectedTarget->isAlive())
{
float redirectedThreat = threat * redirectedMod;
threat -= redirectedThreat;
if(redirectedTarget == getOwner()) // It is faster to modify the threat durectly if possible
ref->addThreat(float (threat) / size);
else
ref->getSource()->addThreat(redirectedTarget, redirectedThreat);
}
}
ref->getSource()->addThreat(pVictim, float (threat) / size);
ref->getSource()->addThreat(pVictim, threat, false, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
ref = ref->next();
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11010"
#define REVISION_NR "11011"
#endif // __REVISION_NR_H__