[8568] Use more correct spell target coordinates calculation for implicit target types 72, 73, 86

Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
Ambal 2009-09-30 14:57:05 +03:00
parent fec8a8faa1
commit 09c50ab921
2 changed files with 5 additions and 7 deletions

View file

@ -1349,9 +1349,8 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
case TARGET_RANDOM_CIRCUMFERENCE_POINT:
{
float angle = 2.0 * M_PI * rand_norm();
float dest_x = m_caster->GetPositionX() + cos(angle) * radius;
float dest_y = m_caster->GetPositionY() + sin(angle) * radius;
float dest_z = m_caster->GetMap()->GetHeight(dest_x, dest_y, MAX_HEIGHT);
float dest_x, dest_y, dest_z;
m_caster->GetClosePoint(dest_x, dest_y, dest_z, 0.0f, radius, angle);
m_targets.setDestination(dest_x, dest_y, dest_z);
TagUnitMap.push_back(m_caster);
@ -1361,9 +1360,8 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
{
radius *= sqrt(rand_norm()); // Get a random point in circle. Use sqrt(rand) to correct distribution when converting polar to Cartesian coordinates.
float angle = 2.0 * M_PI * rand_norm();
float dest_x = m_targets.m_destX + cos(angle) * radius;
float dest_y = m_targets.m_destY + sin(angle) * radius;
float dest_z = m_caster->GetMap()->GetHeight(dest_x, dest_y, MAX_HEIGHT);
float dest_x, dest_y, dest_z;
m_caster->GetClosePoint(dest_x, dest_y, dest_z, 0.0f, radius, angle);
m_targets.setDestination(dest_x, dest_y, dest_z);
if (radius > 0.0f)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8567"
#define REVISION_NR "8568"
#endif // __REVISION_NR_H__