[8163] Fixed typo and wrong check affecting threat calculation.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
SeT 2009-07-12 00:15:07 +04:00 committed by VladimirMangos
parent 0dc7ea6cc2
commit e6d40697a1
3 changed files with 19 additions and 28 deletions

View file

@ -3789,15 +3789,15 @@ void Aura::HandleAuraModSilence(bool apply, bool Real)
void Aura::HandleModThreat(bool apply, bool Real)
{
// only at real add/remove aura
if(!Real)
if (!Real)
return;
if(!m_target->isAlive())
if (!m_target->isAlive())
return;
Unit* caster = GetCaster();
if(!caster || !caster->isAlive())
if (!caster || !caster->isAlive())
return;
int level_diff = 0;
@ -3815,38 +3815,31 @@ void Aura::HandleModThreat(bool apply, bool Real)
multiplier = 1;
break;
}
if (level_diff > 0)
m_modifier.m_amount += multiplier * level_diff;
for(int8 x=0;x < MAX_SPELL_SCHOOL;x++)
{
if(m_modifier.m_miscvalue & int32(1<<x))
{
if(m_target->GetTypeId() == TYPEID_PLAYER)
ApplyPercentModFloatVar(m_target->m_threatModifier[x], m_positive ? m_modifier.m_amount : -m_modifier.m_amount, apply);
}
}
if (m_target->GetTypeId() == TYPEID_PLAYER)
for(int8 x=0;x < MAX_SPELL_SCHOOL;x++)
if (m_modifier.m_miscvalue & int32(1<<x))
ApplyPercentModFloatVar(m_target->m_threatModifier[x], m_modifier.m_amount, apply);
}
void Aura::HandleAuraModTotalThreat(bool apply, bool Real)
{
// only at real add/remove aura
if(!Real)
if (!Real)
return;
if(!m_target->isAlive() || m_target->GetTypeId()!= TYPEID_PLAYER)
if (!m_target->isAlive() || m_target->GetTypeId() != TYPEID_PLAYER)
return;
Unit* caster = GetCaster();
if(!caster || !caster->isAlive())
if (!caster || !caster->isAlive())
return;
float threatMod = 0.0f;
if(apply)
threatMod = float(m_modifier.m_amount);
else
threatMod = float(-m_modifier.m_amount);
float threatMod = apply ? float(m_modifier.m_amount) : float(-m_modifier.m_amount);
m_target->getHostilRefManager().threatAssist(caster, threatMod);
}
@ -3854,18 +3847,18 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real)
void Aura::HandleModTaunt(bool apply, bool Real)
{
// only at real add/remove aura
if(!Real)
if (!Real)
return;
if(!m_target->isAlive() || !m_target->CanHaveThreatList())
if (!m_target->isAlive() || !m_target->CanHaveThreatList())
return;
Unit* caster = GetCaster();
if(!caster || !caster->isAlive())
if (!caster || !caster->isAlive())
return;
if(apply)
if (apply)
m_target->TauntApply(caster);
else
{

View file

@ -32,11 +32,9 @@
// The pHatingUnit is not used yet
float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float pThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
{
if(pThreatSpell)
{
if( Player* modOwner = pHatingUnit->GetSpellModOwner() )
if (pThreatSpell)
if (Player* modOwner = pHatedUnit->GetSpellModOwner())
modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, pThreat);
}
float threat = pHatedUnit->ApplyTotalThreatModifier(pThreat, schoolMask);
return threat;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8162"
#define REVISION_NR "8163"
#endif // __REVISION_NR_H__