diff options
author | megamage <none@none> | 2009-07-12 18:06:19 +0800 |
---|---|---|
committer | megamage <none@none> | 2009-07-12 18:06:19 +0800 |
commit | 8fedc832e8dc2655c7a6ef357c675233a4537e07 (patch) | |
tree | 2ba7796a8154621052833880a77e59bf093068a7 | |
parent | 721782b259ccd9b0ad0d78112164ff5a95318a2f (diff) |
[8163] Fixed typo and wrong check affecting threat calculation. Author: SeT
--HG--
branch : trunk
-rw-r--r-- | src/game/SpellAuras.cpp | 33 | ||||
-rw-r--r-- | src/game/ThreatManager.cpp | 6 |
2 files changed, 15 insertions, 24 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 8f679517c9b..4e2942eda1c 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -4119,12 +4119,12 @@ void AuraEffect::HandleModThreat(bool apply, bool Real, bool changeAmount) if(!Real && !changeAmount) 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; @@ -4142,17 +4142,14 @@ void AuraEffect::HandleModThreat(bool apply, bool Real, bool changeAmount) multiplier = 1; break; } + if (level_diff > 0) m_amount += multiplier * level_diff; - for(int8 x=0;x < MAX_SPELL_SCHOOL;x++) - { - if(GetMiscValue() & int32(1<<x)) - { - if(m_target->GetTypeId() == TYPEID_PLAYER) + if (m_target->GetTypeId() == TYPEID_PLAYER) + for(int8 x=0;x < MAX_SPELL_SCHOOL;x++) + if (GetMiscValue() & int32(1<<x)) ApplyPercentModFloatVar(m_target->m_threatModifier[x], m_amount, apply); - } - } } 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) 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_amount); - else - threatMod = float(-m_amount); + float threatMod = apply ? float(m_amount) : float(-m_amount); 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*/) { // 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 { diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp index 8cf3a76d0fe..60c46c2307d 100644 --- a/src/game/ThreatManager.cpp +++ b/src/game/ThreatManager.cpp @@ -34,11 +34,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 = pHatedUnit->GetSpellModOwner() ) + if (pThreatSpell) + if (Player* modOwner = pHatedUnit->GetSpellModOwner()) modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, pThreat); - } float threat = pHatedUnit->ApplyTotalThreatModifier(pThreat, schoolMask); return threat; |