[7450] Fixes and improvements in TARGET_BEHIND_VICTIM, SPELL_EFFECT_JUMP2, SPELL_EFFECT_TELEPORT_UNITS work.

* Move near teleport code for player/creature in Unit::NearTeleportTo
* Allow correctly seelct target and end point orientation for script casted spells with TARGET_BEHIND_VICTIM
* Replace use BuildTeleportAckMsg by BuildHeartBeatMsg for creature teleports. BuildTeleportAckMsg
  set active mover for targeted player to affected creature and "freeze" player.
This commit is contained in:
VladimirMangos 2009-03-13 16:57:14 +03:00
parent 571c56ff07
commit 3a5d59c0c7
5 changed files with 93 additions and 70 deletions

View file

@ -426,6 +426,21 @@ void Spell::FillTargetMap()
// but need it support in some know cases
switch(m_spellInfo->EffectImplicitTargetA[i])
{
case TARGET_SELF:
switch(m_spellInfo->EffectImplicitTargetB[i])
{
case 0:
SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap);
break;
case TARGET_BEHIND_VICTIM: // use B case that not dependent from from A in fact
SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap);
break;
default:
SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap);
SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap);
break;
}
break;
case TARGET_CASTER_COORDINATES:
// Note: this hack with search required until GO casting not implemented
// environment damage spells already have around enemies targeting but this not help in case not existed GO casting support
@ -2051,8 +2066,15 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
}break;
case TARGET_BEHIND_VICTIM:
{
Unit *pTarget = m_caster->getVictim();
if(!pTarget && m_caster->GetTypeId() == TYPEID_PLAYER)
Unit *pTarget = NULL;
// explicit cast data from client or server-side cast
// some spell at client send caster
if(m_targets.getUnitTarget() && m_targets.getUnitTarget()!=m_caster)
pTarget = m_targets.getUnitTarget();
else if(m_caster->getVictim())
pTarget = m_caster->getVictim();
else if(m_caster->GetTypeId() == TYPEID_PLAYER)
pTarget = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelection());
if(pTarget)
@ -2060,9 +2082,13 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
float _target_x, _target_y, _target_z;
pTarget->GetClosePoint(_target_x, _target_y, _target_z, m_caster->GetObjectSize(), CONTACT_DISTANCE, M_PI);
if(pTarget->IsWithinLOS(_target_x,_target_y,_target_z))
{
TagUnitMap.push_back(m_caster);
m_targets.setDestination(_target_x, _target_y, _target_z);
}
}
}break;
break;
}
case TARGET_DYNAMIC_OBJECT_COORDINATES:
{
// if parent spell create dynamic object extract area from it