*Merge. Note: A better way is needed for Sanctuary effect. (interrupt all spells towards self).

--HG--
branch : trunk
This commit is contained in:
megamage
2009-06-07 11:36:41 -05:00
3 changed files with 23 additions and 3 deletions
+10 -2
View File
@@ -1036,6 +1036,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
SpellMissInfo missInfo = DoSpellHitOnUnit(spellHitTarget, mask); SpellMissInfo missInfo = DoSpellHitOnUnit(spellHitTarget, mask);
if(missInfo != SPELL_MISS_NONE) if(missInfo != SPELL_MISS_NONE)
{ {
if(missInfo != SPELL_MISS_MISS)
m_caster->SendSpellMiss(unit, m_spellInfo->Id, missInfo); m_caster->SendSpellMiss(unit, m_spellInfo->Id, missInfo);
m_damage = 0; m_damage = 0;
spellHitTarget = NULL; spellHitTarget = NULL;
@@ -1186,10 +1187,17 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if( !m_caster->IsFriendlyTo(unit) ) 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 // 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); unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL);
+11
View File
@@ -513,6 +513,17 @@ void Unit::UpdateInterruptMask()
m_interruptMask |= spell->m_spellInfo->ChannelInterruptFlags; 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. */ /* Called by DealDamage for auras that have a chance to be dispelled on damage taken. */
void Unit::RemoveSpellbyDamageTaken(uint32 damage, uint32 spell) void Unit::RemoveSpellbyDamageTaken(uint32 damage, uint32 spell)
{ {
+1
View File
@@ -1243,6 +1243,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void ClearInCombat(); void ClearInCombat();
uint32 GetCombatTimer() const { return m_CombatTimer; } uint32 GetCombatTimer() const { return m_CombatTimer; }
bool HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint32 familyFlags) const;
bool virtual HasSpell(uint32 /*spellID*/) const { return false; } bool virtual HasSpell(uint32 /*spellID*/) const { return false; }
bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); } bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); }