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

--HG--
branch : trunk
This commit is contained in:
megamage
2009-07-12 18:06:19 +08:00
parent 721782b259
commit 8fedc832e8
2 changed files with 15 additions and 24 deletions
+12 -19
View File
@@ -4119,12 +4119,12 @@ void AuraEffect::HandleModThreat(bool apply, bool Real, bool changeAmount)
if(!Real && !changeAmount) if(!Real && !changeAmount)
return; return;
if(!m_target->isAlive()) if (!m_target->isAlive())
return; return;
Unit* caster = GetCaster(); Unit* caster = GetCaster();
if(!caster || !caster->isAlive()) if (!caster || !caster->isAlive())
return; return;
int level_diff = 0; int level_diff = 0;
@@ -4142,17 +4142,14 @@ void AuraEffect::HandleModThreat(bool apply, bool Real, bool changeAmount)
multiplier = 1; multiplier = 1;
break; break;
} }
if (level_diff > 0) if (level_diff > 0)
m_amount += multiplier * level_diff; m_amount += multiplier * level_diff;
if (m_target->GetTypeId() == TYPEID_PLAYER)
for(int8 x=0;x < MAX_SPELL_SCHOOL;x++) for(int8 x=0;x < MAX_SPELL_SCHOOL;x++)
{ if (GetMiscValue() & int32(1<<x))
if(GetMiscValue() & int32(1<<x))
{
if(m_target->GetTypeId() == TYPEID_PLAYER)
ApplyPercentModFloatVar(m_target->m_threatModifier[x], m_amount, apply); ApplyPercentModFloatVar(m_target->m_threatModifier[x], m_amount, apply);
}
}
} }
void AuraEffect::HandleAuraModTotalThreat(bool apply, bool Real, bool changeAmount) void AuraEffect::HandleAuraModTotalThreat(bool apply, bool Real, bool changeAmount)
@@ -4161,19 +4158,15 @@ void AuraEffect::HandleAuraModTotalThreat(bool apply, bool Real, bool changeAmou
if(!Real && !changeAmount) if(!Real && !changeAmount)
return; return;
if(!m_target->isAlive() || m_target->GetTypeId()!= TYPEID_PLAYER) if (!m_target->isAlive() || m_target->GetTypeId() != TYPEID_PLAYER)
return; return;
Unit* caster = GetCaster(); Unit* caster = GetCaster();
if(!caster || !caster->isAlive()) if (!caster || !caster->isAlive())
return; return;
float threatMod = 0.0f; float threatMod = apply ? float(m_amount) : float(-m_amount);
if(apply)
threatMod = float(m_amount);
else
threatMod = float(-m_amount);
m_target->getHostilRefManager().threatAssist(caster, threatMod); m_target->getHostilRefManager().threatAssist(caster, threatMod);
} }
@@ -4181,18 +4174,18 @@ void AuraEffect::HandleAuraModTotalThreat(bool apply, bool Real, bool changeAmou
void AuraEffect::HandleModTaunt(bool apply, bool Real, bool /*changeAmount*/) void AuraEffect::HandleModTaunt(bool apply, bool Real, bool /*changeAmount*/)
{ {
// only at real add/remove aura // only at real add/remove aura
if(!Real) if (!Real)
return; return;
if(!m_target->isAlive() || !m_target->CanHaveThreatList()) if (!m_target->isAlive() || !m_target->CanHaveThreatList())
return; return;
Unit* caster = GetCaster(); Unit* caster = GetCaster();
if(!caster || !caster->isAlive()) if (!caster || !caster->isAlive())
return; return;
if(apply) if (apply)
m_target->TauntApply(caster); m_target->TauntApply(caster);
else else
{ {
+2 -4
View File
@@ -34,11 +34,9 @@
// The pHatingUnit is not used yet // The pHatingUnit is not used yet
float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float pThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell) float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float pThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
{ {
if(pThreatSpell) if (pThreatSpell)
{ if (Player* modOwner = pHatedUnit->GetSpellModOwner())
if( Player* modOwner = pHatedUnit->GetSpellModOwner() )
modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, pThreat); modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, pThreat);
}
float threat = pHatedUnit->ApplyTotalThreatModifier(pThreat, schoolMask); float threat = pHatedUnit->ApplyTotalThreatModifier(pThreat, schoolMask);
return threat; return threat;