Fix for some combat log errors.
Only Vanish and Invisibility auras will now prevent from taking damage if target is not visible for caster. --HG-- branch : trunk
This commit is contained in:
+6
-3
@@ -1150,14 +1150,17 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
|
||||
}
|
||||
if( !m_caster->IsFriendlyTo(unit) )
|
||||
{
|
||||
// reset damage to 0 if target has Invisibility or Vanish aura (_only_ vanish, not stealth) and isn't visible for caster
|
||||
bool isVisibleForHit = ( (unit->HasAuraType(SPELL_AURA_MOD_INVISIBILITY) || unit->HasAuraTypeWithFamilyFlags(SPELL_AURA_MOD_STEALTH, SPELLFAMILY_ROGUE ,SPELLFAMILYFLAG_ROGUE_VANISH)) && !unit->isVisibleForOrDetect(m_caster, true)) ? false : true;
|
||||
|
||||
// for delayed spells ignore not visible explicit target
|
||||
if(m_spellInfo->speed > 0.0f && unit==m_targets.getUnitTarget() && !unit->isVisibleForOrDetect(m_caster,false))
|
||||
if(m_spellInfo->speed > 0.0f && unit==m_targets.getUnitTarget() && !isVisibleForHit)
|
||||
{
|
||||
m_caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE);
|
||||
// that was causing CombatLog errors
|
||||
//m_caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE);
|
||||
m_damage = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL);
|
||||
if(m_customAttr & SPELL_ATTR_CU_AURA_CC)
|
||||
unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CC);
|
||||
|
||||
@@ -616,6 +616,17 @@ bool Unit::HasAuraType(AuraType auraType) const
|
||||
return (!m_modAuras[auraType].empty());
|
||||
}
|
||||
|
||||
bool Unit::HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName ,uint64 familyFlags) const
|
||||
{
|
||||
if(!HasAuraType(auraType)) return false;
|
||||
AuraList const &auras = GetAurasByType(auraType);
|
||||
for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
|
||||
if(SpellEntry const *iterSpellProto = (*itr)->GetSpellProto())
|
||||
if(iterSpellProto->SpellFamilyName == familyName && iterSpellProto->SpellFamilyFlags & familyFlags)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Called by DealDamage for auras that have a chance to be dispelled on damage taken. */
|
||||
void Unit::RemoveSpellbyDamageTaken(uint32 damage, uint32 spell)
|
||||
{
|
||||
|
||||
@@ -1018,6 +1018,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
uint32 GetCombatTimer() const { return m_CombatTimer; }
|
||||
|
||||
bool HasAuraType(AuraType auraType) const;
|
||||
bool HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint64 familyFlags) const;
|
||||
bool HasAura(uint32 spellId, uint32 effIndex) const
|
||||
{ return m_Auras.find(spellEffectPair(spellId, effIndex)) != m_Auras.end(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user