Core/Spells: Fix spelleffect sanctuary

- No longer removes every attacker, but updates the visibility
  - Using that effect won't remove attackers that can still see through the stealth of the caster based on distance
- Ignores spells that were casted before or at the same time of that effect
- Trigger other needed spells when casting Shadowmeld

--HG--
branch : trunk
This commit is contained in:
linencloth
2010-11-13 18:04:56 +01:00
parent bf888285aa
commit 880ef0c398
7 changed files with 31 additions and 21 deletions
+6
View File
@@ -1138,6 +1138,9 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if (unit->isAlive() != target->alive)
return;
if (getState() == SPELL_STATE_DELAYED && !IsPositiveSpell(m_spellInfo->Id) && (getMSTime() - target->timeDelay) <= unit->m_lastSanctuaryTime)
return; // No missinfo in that case
// Get original caster (if exist) and calculate damage/healing from him data
Unit *caster = m_originalCaster ? m_originalCaster : m_caster;
@@ -3414,7 +3417,10 @@ uint64 Spell::handle_delayed(uint64 t_offset)
if (ihit->processed == false)
{
if (single_missile || ihit->timeDelay <= t_offset)
{
ihit->timeDelay = t_offset;
DoAllEffectOnTarget(&(*ihit));
}
else if (next_time == 0 || ihit->timeDelay < next_time)
next_time = ihit->timeDelay;
}
+2 -20
View File
@@ -5326,27 +5326,9 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/)
if (!unitTarget)
return;
std::list<Unit*> targets;
Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(unitTarget, unitTarget, m_caster->GetMap()->GetVisibilityRange());
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(unitTarget, targets, u_check);
unitTarget->VisitNearbyObject(m_caster->GetMap()->GetVisibilityRange(), searcher);
for (std::list<Unit*>::iterator iter = targets.begin(); iter != targets.end(); ++iter)
{
if (!(*iter)->hasUnitState(UNIT_STAT_CASTING))
continue;
unitTarget->getHostileRefManager().UpdateVisibility();
unitTarget->m_lastSanctuaryTime = getMSTime();
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
{
if ((*iter)->GetCurrentSpell(i)
&& (*iter)->GetCurrentSpell(i)->m_targets.getUnitTargetGUID() == unitTarget->GetGUID())
{
(*iter)->InterruptSpell(CurrentSpellTypes(i), false);
}
}
}
unitTarget->CombatStop();
unitTarget->getHostileRefManager().deleteReferences(); // stop all fighting
// Vanish allows to remove all threat and cast regular stealth so other spells can be used
if (m_caster->GetTypeId() == TYPEID_PLAYER
&& m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE