[c12573] Improve target selection for TARGET_BEHIND_VICTIM

This commit is contained in:
Xfurry 2013-05-31 10:00:41 +01:00 committed by Antz
parent e241dd61ca
commit 3e2aefb538
2 changed files with 15 additions and 4 deletions

View file

@ -2664,22 +2664,23 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
pTarget = m_caster->getVictim(); pTarget = m_caster->getVictim();
else if (m_caster->GetTypeId() == TYPEID_PLAYER) else if (m_caster->GetTypeId() == TYPEID_PLAYER)
pTarget = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelectionGuid()); pTarget = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelectionGuid());
else if (m_targets.getUnitTarget())
pTarget = m_caster;
if (pTarget) if (pTarget)
{ {
float angle = 0.0f; float angle = 0.0f;
float dist = (radius && targetMode != TARGET_BEHIND_VICTIM) ? radius : CONTACT_DISTANCE;
switch (targetMode) switch (targetMode)
{ {
case TARGET_INFRONT_OF_VICTIM: break; case TARGET_INFRONT_OF_VICTIM: break;
case TARGET_BEHIND_VICTIM: angle = M_PI_F; break; case TARGET_BEHIND_VICTIM: angle = M_PI_F; break;
case TARGET_RIGHT_FROM_VICTIM: angle = -M_PI_F / 2; break; case TARGET_RIGHT_FROM_VICTIM: angle = -M_PI_F / 2; break;
case TARGET_LEFT_FROM_VICTIM: angle = M_PI_F / 2; break; case TARGET_LEFT_FROM_VICTIM: angle = M_PI_F / 2; break;
} }
float _target_x, _target_y, _target_z; float _target_x, _target_y, _target_z;
pTarget->GetClosePoint(_target_x, _target_y, _target_z, pTarget->GetObjectBoundingRadius(), dist, angle); pTarget->GetClosePoint(_target_x, _target_y, _target_z, pTarget->GetObjectBoundingRadius(), radius, angle);
if (pTarget->IsWithinLOS(_target_x, _target_y, _target_z)) if (pTarget->IsWithinLOS(_target_x, _target_y, _target_z))
{ {
targetUnitMap.push_back(m_caster); targetUnitMap.push_back(m_caster);
@ -8144,6 +8145,16 @@ void Spell::GetSpellRangeAndRadius(SpellEffectEntry const* spellEffect, float& r
} }
break; break;
} }
case SPELLFAMILY_DRUID:
{
switch (m_spellInfo->Id)
{
case 49376: // Feral Charge - Cat
// No default radius for this spell, so we need to use the contact distance
radius = CONTACT_DISTANCE;
break;
}
}
default: default:
break; break;
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12572" #define REVISION_NR "12573"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__