Skip to content

Commit

Permalink
Fixed work spells with ..NOT_BREAK_STEALTH and without ..NO_INITIAL_A…
Browse files Browse the repository at this point in the history
…GGRO

* Target don't must lost stealth at hit by NOT_BREAK_STEALTH spell also.
* Target don't must aggro at hit not NO_INITIAL_AGGRO spell
  if caster still not detected by aggro. This possoble in case when cast not remove
  stealth (spell have NOT_BREAK_STEALTH)
* This fixed spell 921 wrong lost stealth at success and possible some other spells.

(backported from commit f73a788)
  • Loading branch information
VladimirMangos committed Aug 6, 2009
1 parent 02201fe commit 10e1fc9
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/game/Spell.cpp
Expand Up @@ -1037,14 +1037,25 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
return;
}

unit->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
// not break stealth by cast targeting
if (!(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NOT_BREAK_STEALTH))
unit->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);

if( !(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NO_INITIAL_AGGRO) )
// can cause back attack (if detected)
if (!(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NO_INITIAL_AGGRO) &&
m_caster->isVisibleForOrDetect(unit,false)) // stealth removed at Spell::cast if spell break it
{
if(!unit->IsStandState() && !unit->hasUnitState(UNIT_STAT_STUNNED))
// use speedup check to avoid re-remove after above lines
if (m_spellInfo->AttributesEx & SPELL_ATTR_EX_NOT_BREAK_STEALTH)
unit->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);

// caster can be detected but have stealth aura
m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);

if (!unit->IsStandState() && !unit->hasUnitState(UNIT_STAT_STUNNED))
unit->SetStandState(UNIT_STAND_STATE_STAND);

if(!unit->isInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI())
if (!unit->isInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI())
((Creature*)unit)->AI()->AttackedBy(m_caster);

unit->AddThreat(m_caster, 0.0f);
Expand Down

0 comments on commit 10e1fc9

Please sign in to comment.