mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[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:
parent
7d4c96f244
commit
3d551a68b5
2 changed files with 4 additions and 19 deletions
|
|
@ -44,26 +44,11 @@ void HostileRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry co
|
||||||
Unit* redirectedTarget = redirectedMod ? pVictim->getHostileRefManager().GetThreatRedirectionTarget() : NULL;
|
Unit* redirectedTarget = redirectedMod ? pVictim->getHostileRefManager().GetThreatRedirectionTarget() : NULL;
|
||||||
|
|
||||||
uint32 size = pSingleTarget ? 1 : getSize(); // if pSingleTarget do not devide threat
|
uint32 size = pSingleTarget ? 1 : getSize(); // if pSingleTarget do not devide threat
|
||||||
|
float threat = pThreat/size;
|
||||||
HostileReference* ref = getFirst();
|
HostileReference* ref = getFirst();
|
||||||
while(ref != NULL)
|
while (ref)
|
||||||
{
|
{
|
||||||
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, false, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
|
ref->getSource()->addThreat(pVictim, threat, 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 = ref->next();
|
ref = ref->next();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11010"
|
#define REVISION_NR "11011"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue