aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/Spell.cpp9
-rw-r--r--src/game/Unit.cpp11
-rw-r--r--src/game/Unit.h1
3 files changed, 18 insertions, 3 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index b43a57f9334..82756ad118f 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -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);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 6f248b75161..2ec904dd865 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -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)
{
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 5eb4530113c..9929c173206 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -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(); }