diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Spell.h | 1 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 14 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 8 | ||||
-rw-r--r-- | src/game/ThreatManager.cpp | 8 | ||||
-rw-r--r-- | src/game/Unit.cpp | 2 | ||||
-rw-r--r-- | src/game/Unit.h | 10 |
6 files changed, 34 insertions, 9 deletions
diff --git a/src/game/Spell.h b/src/game/Spell.h index 8b5c3e6d7c6..ba5e14b33f2 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -317,6 +317,7 @@ class Spell void EffectTriggerRitualOfSummoning(uint32 i); void EffectKillCredit(uint32 i); void EffectQuestFail(uint32 i); + void EffectRedirectThreat(uint32 i); Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL ); ~Spell(); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index a6e7be8d15d..59ff039cbc9 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1973,19 +1973,17 @@ void Aura::HandleAuraDummy(bool apply, bool Real) return; } - // Dark Fiend - if(GetId()==45934) + // Burning Winds + if(GetId()==46308) // casted only at creatures at spawn { - // Kill target if dispelled - if (m_removeMode==AURA_REMOVE_BY_DISPEL) - m_target->DealDamage(m_target, m_target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_target->CastSpell(m_target,47287,true,NULL,this); return; } - // Burning Winds - if(GetId()==46308) // casted only at creatures at spawn + // Misdirection + if(GetId()==34477) { - m_target->CastSpell(m_target,47287,true,NULL,this); + m_target->SetReducedThreatPercent(0, 0); return; } } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 66d810ce681..b5657f9bcba 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -191,7 +191,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= &Spell::EffectProspecting, //127 SPELL_EFFECT_PROSPECTING Prospecting spell &Spell::EffectApplyAreaAura, //128 SPELL_EFFECT_APPLY_AREA_AURA_FRIEND &Spell::EffectApplyAreaAura, //129 SPELL_EFFECT_APPLY_AREA_AURA_ENEMY - &Spell::EffectNULL, //130 SPELL_EFFECT_REDIRECT_THREAT + &Spell::EffectRedirectThreat, //130 SPELL_EFFECT_REDIRECT_THREAT &Spell::EffectUnused, //131 SPELL_EFFECT_131 used in some test spells &Spell::EffectNULL, //132 SPELL_EFFECT_PLAY_MUSIC sound id in misc value &Spell::EffectUnlearnSpecialization, //133 SPELL_EFFECT_UNLEARN_SPECIALIZATION unlearn profession specialization @@ -6296,3 +6296,9 @@ void Spell::EffectQuestFail(uint32 i) ((Player*)unitTarget)->FailQuest(m_spellInfo->EffectMiscValue[i]); } + +void Spell::EffectRedirectThreat(uint32 /*i*/) +{ + if(unitTarget) + m_caster->SetReducedThreatPercent((uint32)damage, unitTarget->GetGUID()); +}
\ No newline at end of file diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp index 05d8c70da60..b9711b8a2e7 100644 --- a/src/game/ThreatManager.cpp +++ b/src/game/ThreatManager.cpp @@ -357,6 +357,14 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchoolMask scho float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, schoolMask, pThreatSpell); + if(pVictim->GetReducedThreatPercent()) + { + float reducedThreat = threat * pVictim->GetReducedThreatPercent() / 100; + threat -= reducedThreat; + if(pVictim->GetMisdirectionTarget()) + iThreatContainer.addThreat(pVictim->GetMisdirectionTarget(), reducedThreat); + } + HostilReference* ref = iThreatContainer.addThreat(pVictim, threat); // Ref is not in the online refs, search the offline refs next if(!ref) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6582b4c1dec..ba88a341f94 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -234,6 +234,8 @@ Unit::Unit() m_charmInfo = NULL; m_unit_movement_flags = 0; m_isPossessed = false; + m_reducedThreatPercent = 0; + m_misdirectionTargetGUID = 0; // remove aurastates allowing special moves for(int i=0; i < MAX_REACTIVE; ++i) diff --git a/src/game/Unit.h b/src/game/Unit.h index 3f68ddabad7..5efc1a1b3fe 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1393,6 +1393,13 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void SetToNotify(); bool m_Notified, m_IsInNotifyList; + void SetReducedThreatPercent(uint32 pct, uint64 guid) + { + m_reducedThreatPercent = pct; + m_misdirectionTargetGUID = guid; + } + uint32 GetReducedThreatPercent() { return m_reducedThreatPercent; } + Unit *GetMisdirectionTarget() { return m_misdirectionTargetGUID ? GetUnit(*this, m_misdirectionTargetGUID) : NULL; } protected: explicit Unit (); @@ -1470,5 +1477,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject FollowerRefManager m_FollowingRefManager; ComboPointHolderSet m_ComboPointHolders; + + uint32 m_reducedThreatPercent; + uint64 m_misdirectionTargetGUID; }; #endif |