*Fix misdirection.
--HG-- branch : trunk
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -1973,21 +1973,19 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||
return;
|
||||
}
|
||||
|
||||
// Dark Fiend
|
||||
if(GetId()==45934)
|
||||
{
|
||||
// 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);
|
||||
return;
|
||||
}
|
||||
|
||||
// Burning Winds
|
||||
if(GetId()==46308) // casted only at creatures at spawn
|
||||
{
|
||||
m_target->CastSpell(m_target,47287,true,NULL,this);
|
||||
return;
|
||||
}
|
||||
|
||||
// Misdirection
|
||||
if(GetId()==34477)
|
||||
{
|
||||
m_target->SetReducedThreatPercent(0, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// AT APPLY & REMOVE
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user