diff --git a/src/game/Combat/ThreatManager.cpp b/src/game/Combat/ThreatManager.cpp index b55306b7ac3..dc45ab34001 100644 --- a/src/game/Combat/ThreatManager.cpp +++ b/src/game/Combat/ThreatManager.cpp @@ -48,25 +48,8 @@ float ThreatCalcHelper::CalcThreat(Unit* hatedUnit, Unit* hatingUnit, float thre if (threatSpell) { - // Keep exception to calculate the real threat for SPELL_AURA_MOD_TOTAL_THREAT - bool HasExceptionForNoThreat = false; - for (int i = 0; i < MAX_EFFECT_INDEX; i++) - { - if (threatSpell->EffectApplyAuraName[i] == SPELL_AURA_MOD_TOTAL_THREAT && threatSpell->EffectBasePoints[i] < 0) - { - HasExceptionForNoThreat = true; - break; - } - } - - if (!HasExceptionForNoThreat) - { - if (threatSpell->HasAttribute(SPELL_ATTR_EX_NO_THREAT)) - return 0.0f; - - if (Player* modOwner = hatedUnit->GetSpellModOwner()) - modOwner->ApplySpellMod(threatSpell->Id, SPELLMOD_THREAT, threat); - } + if (Player* modOwner = hatedUnit->GetSpellModOwner()) + modOwner->ApplySpellMod(threatSpell->Id, SPELLMOD_THREAT, threat); if (crit) threat *= hatedUnit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRITICAL_THREAT, schoolMask); @@ -502,7 +485,7 @@ void ThreatManager::addThreat(Unit* victim, float threat, bool crit, SpellSchool { float redirectedThreat = threat * redirectedMod; totalMod += redirectedMod; - addThreatDirectly(redirectedTarget, redirectedThreat); + addThreatDirectly(redirectedTarget, redirectedThreat, false); } } if (totalMod != 0.f) @@ -512,10 +495,10 @@ void ThreatManager::addThreat(Unit* victim, float threat, bool crit, SpellSchool } } - addThreatDirectly(victim, calculatedThreat); + addThreatDirectly(victim, calculatedThreat, threatSpell && threatSpell->HasAttribute(SPELL_ATTR_EX_NO_THREAT)); } -void ThreatManager::addThreatDirectly(Unit* victim, float threat) +void ThreatManager::addThreatDirectly(Unit* victim, float threat, bool noNew) { HostileReference* ref = iThreatContainer.addThreat(victim, threat); // Ref is online @@ -525,7 +508,7 @@ void ThreatManager::addThreatDirectly(Unit* victim, float threat) else ref = iThreatOfflineContainer.addThreat(victim, threat); - if (!ref) // there was no ref => create a new one + if (!ref && !noNew) // there was no ref => create a new one { HostileReference* hostileReference = new HostileReference(victim, this, 0); // threat has to be 0 here iThreatContainer.addReference(hostileReference); diff --git a/src/game/Combat/ThreatManager.h b/src/game/Combat/ThreatManager.h index 2f1eeed8cd6..b30c239a647 100644 --- a/src/game/Combat/ThreatManager.h +++ b/src/game/Combat/ThreatManager.h @@ -204,7 +204,7 @@ class ThreatManager void addThreat(Unit* victim, float threat) { addThreat(victim, threat, false, SPELL_SCHOOL_MASK_NONE, nullptr, false); } // add threat as raw value (ignore redirections and expection all mods applied already to it - void addThreatDirectly(Unit* victim, float threat); + void addThreatDirectly(Unit* victim, float threat, bool noNew); void modifyThreatPercent(Unit* victim, int32 threatPercent); // -101 removes whole ref, -100 sets threat to 0, rest modifies it void modifyAllThreatPercent(int32 threatPercent); diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index 0cb42210a59..3f9acab5b52 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -7664,7 +7664,7 @@ void Spell::EffectTaunt(SpellEffectIndex eff_idx) if (unitTarget->CanHaveThreatList()) { float addedThreat = unitTarget->getThreatManager().GetHighestThreat() - unitTarget->getThreatManager().getThreat(m_caster); - unitTarget->getThreatManager().addThreatDirectly(m_caster, addedThreat); + unitTarget->getThreatManager().addThreatDirectly(m_caster, addedThreat, false); unitTarget->getThreatManager().setCurrentVictimByTarget(m_caster); // force changes the target to caster of taunt } // Units without threat lists but with AI are susceptible to attack target interference by taunt effect: @@ -7975,14 +7975,6 @@ void Spell::EffectThreat(SpellEffectIndex /*eff_idx*/) if (!unitTarget->CanHaveThreatList()) return; - if (!m_caster->IsInCombat() || !unitTarget->IsInCombat()) - { - if (unitTarget->AI()) - unitTarget->AI()->AttackStart(m_caster); - else - unitTarget->EngageInCombatWith(m_caster); - } - unitTarget->AddThreat(m_caster, float(damage), false, GetSpellSchoolMask(m_spellInfo), m_spellInfo); }