[9850] Fixed target selection for area spells casted from aura at enemy.

* Spell::GetCastingObject must be use for selection visual/point cast,
  not for friend/enemy checks. Add extanded GetAffectiveCasterObject
  for proper provide for referecned checks wild gameobject casted case.

* Also support chain damage spells casted by gameobjects.
This commit is contained in:
VladimirMangos 2010-05-08 00:27:25 +04:00
parent d1130af777
commit 921b0d668f
4 changed files with 29 additions and 15 deletions

View file

@ -1660,7 +1660,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
else
{
Unit* pUnitTarget = m_targets.getUnitTarget();
Unit* originalCaster = GetAffectiveCaster();
WorldObject* originalCaster = GetAffectiveCasterObject();
if(!pUnitTarget || !originalCaster)
break;
@ -6486,6 +6486,16 @@ void Spell::FillRaidOrPartyHealthPriorityTargets(UnitList &targetUnitMap, Unit*
}
}
WorldObject* Spell::GetAffectiveCasterObject() const
{
if (m_originalCasterGUID.IsEmpty())
return m_caster;
if (m_originalCasterGUID.IsGameobject() && m_caster->IsInWorld())
return m_caster->GetMap()->GetGameObject(m_originalCasterGUID);
return m_originalCaster;
}
WorldObject* Spell::GetCastingObject() const
{
if (m_originalCasterGUID.IsGameobject())