aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-07 11:36:41 -0500
committermegamage <none@none>2009-06-07 11:36:41 -0500
commitc48c20cb9866d22f1b03159ae258310ab10a9263 (patch)
tree9bff30e856003bb7be850979409906007dc34893
parent73299773235259a2bd2272f0c54b01a2435b7a01 (diff)
parenta29847bf8490833ba219f01fba1441d6c8f1b7a3 (diff)
*Merge. Note: A better way is needed for Sanctuary effect. (interrupt all spells towards self).
--HG-- branch : trunk
-rw-r--r--src/game/Spell.cpp14
-rw-r--r--src/game/Unit.cpp11
-rw-r--r--src/game/Unit.h1
3 files changed, 23 insertions, 3 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 49327ed359f..4b410480ebe 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1036,7 +1036,8 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
SpellMissInfo missInfo = DoSpellHitOnUnit(spellHitTarget, mask);
if(missInfo != SPELL_MISS_NONE)
{
- m_caster->SendSpellMiss(unit, m_spellInfo->Id, missInfo);
+ if(missInfo != SPELL_MISS_MISS)
+ m_caster->SendSpellMiss(unit, m_spellInfo->Id, missInfo);
m_damage = 0;
spellHitTarget = NULL;
}
@@ -1186,10 +1187,17 @@ SpellMissInfo 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
+ // I do not think this is a correct way to fix it. Sanctuary effect should make all delayed spells invalid
// 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()
+ && (unit->HasAuraType(SPELL_AURA_MOD_INVISIBILITY)
+ || unit->HasAuraTypeWithFamilyFlags(SPELL_AURA_MOD_STEALTH, SPELLFAMILY_ROGUE, SPELLFAMILYFLAG_ROGUE_VANISH))
+ && !unit->isVisibleForOrDetect(m_caster, true))
{
- return SPELL_MISS_EVADE;
+ // that was causing CombatLog errors
+ // return SPELL_MISS_EVADE;
+ return SPELL_MISS_MISS; // miss = do not send anything here
}
unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index d614b743b7b..13e0575d2ed 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -513,6 +513,17 @@ void Unit::UpdateInterruptMask()
m_interruptMask |= spell->m_spellInfo->ChannelInterruptFlags;
}
+bool Unit::HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint32 familyFlags) const
+{
+ if(!HasAuraType(auraType)) return false;
+ AuraEffectList const &auras = GetAurasByType(auraType);
+ for(AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
+ if(SpellEntry const *iterSpellProto = (*itr)->GetSpellProto())
+ if(iterSpellProto->SpellFamilyName == familyName && iterSpellProto->SpellFamilyFlags[0] & 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 ea99f8a2424..82e4df55a96 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1243,6 +1243,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void ClearInCombat();
uint32 GetCombatTimer() const { return m_CombatTimer; }
+ bool HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint32 familyFlags) const;
bool virtual HasSpell(uint32 /*spellID*/) const { return false; }
bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); }